Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -179,6 +179,41 @@ public static class DictConst
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string SHENGCHANBULIAO = "24";
|
public const string SHENGCHANBULIAO = "24";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出入库单据状态code
|
||||||
|
/// </summary>
|
||||||
|
public const string DOCUMENTSTATU = "DocumentStatu";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单据状态新增
|
||||||
|
/// </summary>
|
||||||
|
public const string OUTSTOCKSTATUSADD = "1";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单据状态作业中
|
||||||
|
/// </summary>
|
||||||
|
public const string OUTSTOCKSTATUSWORKING = "2";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单据状态已呼叫
|
||||||
|
/// </summary>
|
||||||
|
public const string OUTSTOCKSTATUSCALLED = "3";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单据状态待配送
|
||||||
|
/// </summary>
|
||||||
|
public const string OUTSTOCKSTATUSTOBEDELIVERED = "4";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单据状态取消
|
||||||
|
/// </summary>
|
||||||
|
public const string OUTSTOCKSTATUSCANCEL = "7";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单据状态完成
|
||||||
|
/// </summary>
|
||||||
|
public const string OUTSTOCKSTATUSCOMPLETED = "8";
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
public string? data_type { get; set; }
|
public string? data_type { get; set; }
|
||||||
public string? enabled { get; set; }
|
public string? enabled { get; set; }
|
||||||
public string? equip_id { get; set; }
|
public string? equip_id { get; set; }
|
||||||
|
public string? equip_code { get; set; }
|
||||||
public string? label_name { get; set; }
|
public string? label_name { get; set; }
|
||||||
public string? label_point { get; set; }
|
public string? label_point { get; set; }
|
||||||
public string? remark { get; set; }
|
public string? remark { get; set; }
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace Tnb.EquipMgr
|
|||||||
data_type = a.data_type,
|
data_type = a.data_type,
|
||||||
enabled = a.enabled == 1 ? "是" : "否",
|
enabled = a.enabled == 1 ? "是" : "否",
|
||||||
equip_id = a.equip_id,
|
equip_id = a.equip_id,
|
||||||
|
equip_code = a.equip_code,
|
||||||
label_name = a.label_name,
|
label_name = a.label_name,
|
||||||
label_point = a.label_point,
|
label_point = a.label_point,
|
||||||
remark = a.remark
|
remark = a.remark
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class PrdKittingOutChangeStatusInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 来源单号
|
||||||
|
/// </summary>
|
||||||
|
public string code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 0 齐套出库 1 一般出库 2 物料出库
|
||||||
|
/// </summary>
|
||||||
|
public string type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
public string status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,7 +63,7 @@ public partial class PrdOutstockH : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发料工位
|
/// 发料工位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? workstation { get; set; }
|
public string? workstation_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所属产线
|
/// 所属产线
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr.Interfaces
|
namespace Tnb.ProductionMgr.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -5,6 +7,11 @@ namespace Tnb.ProductionMgr.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IPrdKittingOutService
|
public interface IPrdKittingOutService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 齐套出库 一般出库 物料出库 改状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<dynamic> ChangeStatusById(List<PrdKittingOutChangeStatusInput> inputs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,6 +519,7 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||||
string? code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
string? code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||||
|
string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
|
||||||
// DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
// DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||||
// DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
// DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||||
|
|
||||||
@@ -528,10 +529,34 @@ namespace Tnb.ProductionMgr
|
|||||||
input.sort = "desc";
|
input.sort = "desc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<string> statusList = new();
|
||||||
|
if (!string.IsNullOrEmpty(status))
|
||||||
|
{
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
statusList.Add(DictConst.OUTSTOCKSTATUSADD);
|
||||||
|
statusList.Add(DictConst.OUTSTOCKSTATUSCALLED);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
statusList.Add(DictConst.OUTSTOCKSTATUSTOBEDELIVERED);
|
||||||
|
statusList.Add(DictConst.OUTSTOCKSTATUSWORKING);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
statusList.Add(DictConst.OUTSTOCKSTATUSCANCEL);
|
||||||
|
statusList.Add(DictConst.OUTSTOCKSTATUSCOMPLETED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var queryable1 = db.Queryable<PrdKittingOutH>()
|
var queryable1 = db.Queryable<PrdKittingOutH>()
|
||||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||||
|
.LeftJoin<WmsKittingoutH>((a,b,c)=>a.id==c.source_id)
|
||||||
|
.LeftJoin<DictionaryTypeEntity>((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id)
|
||||||
.Where((a,b)=>a.workstation_id==input.stationId)
|
.Where((a,b)=>a.workstation_id==input.stationId)
|
||||||
.Select((a, b) => new FeedingRecordListOutput()
|
.WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode))
|
||||||
|
.Select((a, b,c,d,e) => new FeedingRecordListOutput()
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
code = a.code,
|
code = a.code,
|
||||||
@@ -539,13 +564,17 @@ namespace Tnb.ProductionMgr
|
|||||||
type = "0",
|
type = "0",
|
||||||
create_name = b.RealName,
|
create_name = b.RealName,
|
||||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||||
status = a.status
|
status = e.FullName
|
||||||
});
|
});
|
||||||
|
|
||||||
var queryable2 = db.Queryable<PrdOutstockH>()
|
var queryable2 = db.Queryable<PrdOutstockH>()
|
||||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||||
.Where((a,b)=>a.workstation==input.stationId)
|
.LeftJoin<WmsOutstockH>((a,b,c)=>a.id==c.source_id)
|
||||||
.Select((a, b) => new FeedingRecordListOutput()
|
.LeftJoin<DictionaryTypeEntity>((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id)
|
||||||
|
.Where((a,b)=>a.workstation_id==input.stationId)
|
||||||
|
.WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode))
|
||||||
|
.Select((a, b,c,d,e) => new FeedingRecordListOutput()
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
code = a.bill_code,
|
code = a.bill_code,
|
||||||
@@ -553,7 +582,7 @@ namespace Tnb.ProductionMgr
|
|||||||
type = a.type,
|
type = a.type,
|
||||||
create_name = b.RealName,
|
create_name = b.RealName,
|
||||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||||
status = a.status
|
status = e.FullName
|
||||||
});
|
});
|
||||||
var result = await db.UnionAll(queryable1,queryable2)
|
var result = await db.UnionAll(queryable1,queryable2)
|
||||||
.MergeTable()
|
.MergeTable()
|
||||||
@@ -570,7 +599,7 @@ namespace Tnb.ProductionMgr
|
|||||||
var db = _repository.AsSugarClient();
|
var db = _repository.AsSugarClient();
|
||||||
if (input.type == "0")
|
if (input.type == "0")
|
||||||
{
|
{
|
||||||
var result = db.Queryable<PrdKittingOutD>()
|
var result = await db.Queryable<PrdKittingOutD>()
|
||||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
||||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id)
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id)
|
||||||
@@ -588,7 +617,7 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = db.Queryable<PrdOutstockD>()
|
var result = await db.Queryable<PrdOutstockD>()
|
||||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
||||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id)
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id)
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ namespace Tnb.ProductionMgr
|
|||||||
public async Task<dynamic> KittingOut(KittingOutInput kittingOutInput)
|
public async Task<dynamic> KittingOut(KittingOutInput kittingOutInput)
|
||||||
{
|
{
|
||||||
PrdKittingOutH prdKittingOutH = new();
|
PrdKittingOutH prdKittingOutH = new();
|
||||||
|
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ISqlSugarClient db = _repository.AsSugarClient();
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
@@ -184,6 +185,7 @@ namespace Tnb.ProductionMgr
|
|||||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||||
collocation_scheme_code = kittingOutInput.collocation_scheme_code,
|
collocation_scheme_code = kittingOutInput.collocation_scheme_code,
|
||||||
source_id = prdKittingOutH.id,
|
source_id = prdKittingOutH.id,
|
||||||
|
source_code = prdKittingOutH.code,
|
||||||
create_id = _userManager.UserId,
|
create_id = _userManager.UserId,
|
||||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||||
}
|
}
|
||||||
@@ -205,7 +207,6 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
|
||||||
prdKittingOutH.warehouse_id = kittingOutInput.warehouse_id;
|
prdKittingOutH.warehouse_id = kittingOutInput.warehouse_id;
|
||||||
prdKittingOutH.location_code = kittingOutInput.location_code;
|
prdKittingOutH.location_code = kittingOutInput.location_code;
|
||||||
prdKittingOutH.material_id = kittingOutInput.material_id;
|
prdKittingOutH.material_id = kittingOutInput.material_id;
|
||||||
@@ -274,6 +275,7 @@ namespace Tnb.ProductionMgr
|
|||||||
public async Task<dynamic> KittingOutNew(KittingOutNewInput kittingOutInput)
|
public async Task<dynamic> KittingOutNew(KittingOutNewInput kittingOutInput)
|
||||||
{
|
{
|
||||||
PrdKittingOutH prdKittingOutH = new();
|
PrdKittingOutH prdKittingOutH = new();
|
||||||
|
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
||||||
string warehouse_id = "26103348825381";//二楼缓存仓
|
string warehouse_id = "26103348825381";//二楼缓存仓
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -310,6 +312,7 @@ namespace Tnb.ProductionMgr
|
|||||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||||
collocation_scheme_code = wmsCollocationSchemeH.bill_code,
|
collocation_scheme_code = wmsCollocationSchemeH.bill_code,
|
||||||
source_id = prdKittingOutH.id,
|
source_id = prdKittingOutH.id,
|
||||||
|
source_code = prdKittingOutH.code,
|
||||||
create_id = _userManager.UserId,
|
create_id = _userManager.UserId,
|
||||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||||
}
|
}
|
||||||
@@ -344,7 +347,6 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
|
||||||
prdKittingOutH.warehouse_id = warehouse_id;
|
prdKittingOutH.warehouse_id = warehouse_id;
|
||||||
prdKittingOutH.location_code = kittingOutInput.location_code;
|
prdKittingOutH.location_code = kittingOutInput.location_code;
|
||||||
prdKittingOutH.material_id = basMaterial.id;
|
prdKittingOutH.material_id = basMaterial.id;
|
||||||
@@ -358,6 +360,7 @@ namespace Tnb.ProductionMgr
|
|||||||
prdKittingOutH.create_id = _userManager.UserId;
|
prdKittingOutH.create_id = _userManager.UserId;
|
||||||
prdKittingOutH.create_time = DateTime.Now;
|
prdKittingOutH.create_time = DateTime.Now;
|
||||||
prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||||
|
prdKittingOutH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||||
List<PrdKittingOutD> prdKittingOutDs = new();
|
List<PrdKittingOutD> prdKittingOutDs = new();
|
||||||
foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs)
|
foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs)
|
||||||
{
|
{
|
||||||
@@ -401,5 +404,38 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 齐套出库 一般出库 物料出库 改状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> ChangeStatusById(List<PrdKittingOutChangeStatusInput> inputs)
|
||||||
|
{
|
||||||
|
// if(string.IsNullOrEmpty(input.code) || string.IsNullOrEmpty(input.type) || string.IsNullOrEmpty(input.status))
|
||||||
|
// throw Oops.Bah("参数错误");
|
||||||
|
if (inputs == null || inputs.Count <= 0)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
|
|
||||||
|
foreach (var input in inputs)
|
||||||
|
{
|
||||||
|
if (input.type == "0")
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdKittingOutH>().SetColumns(x => x.status == input.status)
|
||||||
|
.Where(x => x.code == input.code).ExecuteCommandAsync();
|
||||||
|
}else if (input.type == "1" || input.type == "2")
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdOutstockH>().SetColumns(x => x.status == input.status)
|
||||||
|
.Where(x => x.bill_code == input.code).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,6 +147,11 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
string locationId = location.id;
|
string locationId = location.id;
|
||||||
|
|
||||||
|
PrdOutstockH prdOutstockH = new()
|
||||||
|
{
|
||||||
|
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||||
|
};
|
||||||
|
|
||||||
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
|
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||||
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
||||||
input.outstock.bill_date = DateTime.Now;
|
input.outstock.bill_date = DateTime.Now;
|
||||||
@@ -154,6 +159,8 @@ namespace Tnb.ProductionMgr
|
|||||||
input.outstock.warehouse_id = warehouse_id;
|
input.outstock.warehouse_id = warehouse_id;
|
||||||
input.outstock.create_id = _userManager.UserId;
|
input.outstock.create_id = _userManager.UserId;
|
||||||
input.outstock.location_code = location?.location_code ?? "";
|
input.outstock.location_code = location?.location_code ?? "";
|
||||||
|
input.outstock.source_code = prdOutstockH.bill_code;
|
||||||
|
input.outstock.source_id = prdOutstockH.id;
|
||||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||||
|
|
||||||
List<string> materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList();
|
List<string> materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList();
|
||||||
@@ -195,20 +202,17 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PrdOutstockH prdOutstockH = new()
|
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||||
{
|
prdOutstockH.type = "1";
|
||||||
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
prdOutstockH.warehouse_id = warehouse_id;
|
||||||
bill_type = DictConst.SHENGCHANLINGLIAO,
|
prdOutstockH.location_code = generalOutstockInput.location_code;
|
||||||
type = "1",
|
prdOutstockH.create_id = _userManager.UserId;
|
||||||
warehouse_id = warehouse_id,
|
prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||||
location_code = generalOutstockInput.location_code,
|
prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
create_id = _userManager.UserId,
|
prdOutstockH.create_time = DateTime.Now;
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
prdOutstockH.workstation_id = generalOutstockInput.workstation_id;
|
||||||
bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
prdOutstockH.workline = workline?.Id ?? "";
|
||||||
create_time = DateTime.Now,
|
prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||||
workstation = generalOutstockInput.workstation_id,
|
|
||||||
workline = workline?.Id ?? ""
|
|
||||||
};
|
|
||||||
|
|
||||||
List<PrdOutstockD> prdOutstockDs = new();
|
List<PrdOutstockD> prdOutstockDs = new();
|
||||||
foreach (GeneralOutstockDInput item in generalOutstockInput.details)
|
foreach (GeneralOutstockDInput item in generalOutstockInput.details)
|
||||||
@@ -267,6 +271,11 @@ namespace Tnb.ProductionMgr
|
|||||||
if (location == null) throw Oops.Bah("未找到库位");
|
if (location == null) throw Oops.Bah("未找到库位");
|
||||||
string locationId = location.id;
|
string locationId = location.id;
|
||||||
|
|
||||||
|
PrdOutstockH prdOutstockH = new()
|
||||||
|
{
|
||||||
|
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||||
|
};
|
||||||
|
|
||||||
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
|
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||||
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
||||||
input.outstock.bill_date = DateTime.Now;
|
input.outstock.bill_date = DateTime.Now;
|
||||||
@@ -274,6 +283,8 @@ namespace Tnb.ProductionMgr
|
|||||||
input.outstock.warehouse_id = warehouse_id;
|
input.outstock.warehouse_id = warehouse_id;
|
||||||
input.outstock.create_id = _userManager.UserId;
|
input.outstock.create_id = _userManager.UserId;
|
||||||
input.outstock.location_code = location?.location_code ?? "";
|
input.outstock.location_code = location?.location_code ?? "";
|
||||||
|
input.outstock.source_code = prdOutstockH.bill_code;
|
||||||
|
input.outstock.source_id = prdOutstockH.id;
|
||||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(materialOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(materialOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||||
|
|
||||||
List<string> materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList();
|
List<string> materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList();
|
||||||
@@ -315,8 +326,6 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PrdOutstockH prdOutstockH = new PrdOutstockH();
|
|
||||||
prdOutstockH.bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE);
|
|
||||||
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
|
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||||
prdOutstockH.type = "2";
|
prdOutstockH.type = "2";
|
||||||
prdOutstockH.warehouse_id = warehouse_id;
|
prdOutstockH.warehouse_id = warehouse_id;
|
||||||
@@ -325,8 +334,9 @@ namespace Tnb.ProductionMgr
|
|||||||
prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||||
prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
prdOutstockH.create_time = DateTime.Now;
|
prdOutstockH.create_time = DateTime.Now;
|
||||||
prdOutstockH.workstation = materialOutstockInput.workstation_id;
|
prdOutstockH.workstation_id = materialOutstockInput.workstation_id;
|
||||||
prdOutstockH.workline = workline?.Id ?? "";
|
prdOutstockH.workline = workline?.Id ?? "";
|
||||||
|
prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||||
|
|
||||||
List<PrdOutstockD> prdOutstockDs = new List<PrdOutstockD>();
|
List<PrdOutstockD> prdOutstockDs = new List<PrdOutstockD>();
|
||||||
foreach (var item in materialOutstockInput.details)
|
foreach (var item in materialOutstockInput.details)
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采购收货,销售发货,审核、审核反审核 输入参数
|
||||||
|
/// </summary>
|
||||||
|
public class PurchaseAndSaleAuditUpInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 要更新的id集合列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> ids { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 1、审核 2、反审核
|
||||||
|
/// </summary>
|
||||||
|
public EnumAuditType auditType { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Entity.Constraints
|
||||||
|
{
|
||||||
|
public interface IPurchaseAndSaleAuitEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 审核状态
|
||||||
|
/// </summary>
|
||||||
|
public int? audit_status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using JNPF.Common.Contracts;
|
using JNPF.Common.Contracts;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr.Entities;
|
namespace Tnb.WarehouseMgr.Entities;
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
|
|||||||
/// 采购收货主表
|
/// 采购收货主表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("wms_purchase_h")]
|
[SugarTable("wms_purchase_h")]
|
||||||
public partial class WmsPurchaseH : BaseEntity<string>
|
public partial class WmsPurchaseH : BaseEntity<string>, IPurchaseAndSaleAuitEntity
|
||||||
{
|
{
|
||||||
public WmsPurchaseH()
|
public WmsPurchaseH()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using JNPF.Common.Contracts;
|
using JNPF.Common.Contracts;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr.Entities;
|
namespace Tnb.WarehouseMgr.Entities;
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
|
|||||||
/// 销售发货主表
|
/// 销售发货主表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("wms_sale_h")]
|
[SugarTable("wms_sale_h")]
|
||||||
public partial class WmsSaleH : BaseEntity<string>
|
public partial class WmsSaleH : BaseEntity<string>, IPurchaseAndSaleAuitEntity
|
||||||
{
|
{
|
||||||
public WmsSaleH()
|
public WmsSaleH()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Enums
|
||||||
|
{
|
||||||
|
public enum EnumAuditType
|
||||||
|
{
|
||||||
|
审核 = 1,
|
||||||
|
反审核 = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -131,10 +131,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
|
|
||||||
List<string> carryIds = new();
|
List<string> carryIds = new();
|
||||||
|
var mapKeys = new List<string> { "tablefield120", "details" };
|
||||||
//tablefield120 出库物料明细
|
//tablefield120 出库物料明细
|
||||||
if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull())
|
if (input.data.Keys.Any(k => mapKeys.Contains(k))) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()
|
||||||
{
|
{
|
||||||
List<WmsOutstockD> outStockDList = input.data["tablefield120"].ToObject<List<WmsOutstockD>>();
|
List<WmsOutstockD> outStockDList = new();
|
||||||
|
if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull())
|
||||||
|
{
|
||||||
|
outStockDList = input.data["tablefield120"].ToObject<List<WmsOutstockD>>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outStockDList = input.data["details"].ToObject<List<WmsOutstockD>>();
|
||||||
|
}
|
||||||
if (outStockDList?.Count > 0)
|
if (outStockDList?.Count > 0)
|
||||||
{
|
{
|
||||||
List<WmsCarryMat> carryMats = new();
|
List<WmsCarryMat> carryMats = new();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Tnb.Common.Utils;
|
|||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
@@ -21,71 +22,53 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 采购收货、销售发货,通用业务类
|
/// 采购收货、销售发货,通用业务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TEntity"></typeparam>
|
/// <typeparam name="TSubEntity"></typeparam>
|
||||||
public class WmsPurchaseAndSaleCommonService<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, IPurchaseAndSaleEntity, IPurchaseAndSaleQueryEntity
|
public class WmsPurchaseAndSaleCommonService<TSubEntity> : BaseWareHouseService where TSubEntity : BaseEntity<string>, IPurchaseAndSaleEntity, IPurchaseAndSaleQueryEntity
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IWmsPDAScanInStockService _wmsPDAScanInStockService;
|
|
||||||
private readonly IWmsOutStockService _wmsOutStockService;
|
|
||||||
private static Dictionary<string, object> s_materialMap = new();
|
private static Dictionary<string, object> s_materialMap = new();
|
||||||
|
|
||||||
public WmsPurchaseAndSaleCommonService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager, IWmsOutStockService? wmsOutStockService = null)
|
public WmsPurchaseAndSaleCommonService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager)
|
||||||
{
|
{
|
||||||
_db = repo.AsSugarClient();
|
_db = repo.AsSugarClient();
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_wmsOutStockService = wmsOutStockService!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<bool> PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input)
|
protected async Task<List<TSubEntity>> PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input)
|
||||||
{
|
{
|
||||||
if (input == null) throw new ArgumentNullException("input");
|
if (input == null) throw new ArgumentNullException("input");
|
||||||
if (input.details == null) throw new ArgumentNullException(nameof(input.details));
|
if (input.details == null) throw new ArgumentNullException(nameof(input.details));
|
||||||
|
|
||||||
|
|
||||||
var dicMaterialPurchaseArriveQty = input.details.ToDictionary(x => x.material_id, x => x.purchase_arriveqty);
|
|
||||||
var materialIds = input.details.Select(x => x.material_id).ToList();
|
var materialIds = input.details.Select(x => x.material_id).ToList();
|
||||||
var purchaseDs = await _db.Queryable<TEntity>().Where(it => materialIds.Contains(it.material_id)).ToListAsync();
|
var purchaseDs = await _db.Queryable<TSubEntity>().Where(it => materialIds.Contains(it.material_id)).ToListAsync();
|
||||||
|
|
||||||
if (purchaseDs?.Count > 0)
|
if (purchaseDs?.Count > 0)
|
||||||
{
|
{
|
||||||
var errMaterialTipList = new List<(string materialName, decimal purchaseArriveQty, decimal topPurchaseQty)>();
|
var errMaterialTipList = new List<(string materialName, decimal purchaseArriveQty, decimal topPurchaseQty)>();
|
||||||
|
|
||||||
foreach (var pd in purchaseDs)
|
foreach (var pd in purchaseDs)
|
||||||
{
|
{
|
||||||
pd.purchase_prqty += dicMaterialPurchaseArriveQty.ContainsKey(pd.material_id) ? dicMaterialPurchaseArriveQty[pd.material_id] : 0;
|
|
||||||
var pdInput = input.details.Find(x => x.material_id == pd.material_id);
|
var pdInput = input.details.Find(x => x.material_id == pd.material_id);
|
||||||
if (pdInput != null)
|
if (pdInput != null)
|
||||||
{
|
{
|
||||||
|
pd.purchase_prqty += pdInput.purchase_arriveqty;
|
||||||
|
|
||||||
var topPurchaseQty = pd.purchase_qty - pd.purchase_prqty;
|
var topPurchaseQty = pd.purchase_qty - pd.purchase_prqty;
|
||||||
if (pdInput.purchase_arriveqty > topPurchaseQty)
|
if (pdInput.purchase_arriveqty > topPurchaseQty && s_materialMap.ContainsKey(pdInput.material_id) && s_materialMap[pdInput.material_id] != null)
|
||||||
{
|
{
|
||||||
if (s_materialMap.ContainsKey(pdInput.material_id) && s_materialMap[pdInput.material_id] != null)
|
errMaterialTipList.Add((s_materialMap[pdInput.material_id].ToString()!, pdInput.purchase_arriveqty, topPurchaseQty));
|
||||||
{
|
continue;
|
||||||
errMaterialTipList.Add((s_materialMap[pdInput.material_id].ToString()!, pdInput.purchase_arriveqty, topPurchaseQty));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pd.purchase_prqty >= pd.purchase_qty)
|
|
||||||
{
|
pd.line_status = pd.purchase_prqty >= pd.purchase_qty ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||||
pd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errMaterialTipList.Count > 0)
|
if (errMaterialTipList.Count > 0)
|
||||||
{
|
{
|
||||||
var errMsgList = new List<string>();
|
var itemType = typeof(TSubEntity) == typeof(WmsPurchaseD) ? "收货数" : "发货数";
|
||||||
if (typeof(TEntity) == typeof(WmsPurchaseD))
|
var errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际{itemType}:{x.purchaseArriveQty}已超出可{itemType}:{x.topPurchaseQty}").ToList();
|
||||||
{
|
|
||||||
errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际收货数:{x.purchaseArriveQty}已超出可收货数:{x.topPurchaseQty}").ToList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际发货数:{x.purchaseArriveQty}已超出可发货数:{x.topPurchaseQty}").ToList();
|
|
||||||
}
|
|
||||||
var errMsg = string.Join("\r\n", errMsgList);
|
var errMsg = string.Join("\r\n", errMsgList);
|
||||||
throw new AppFriendlyException(errMsg, 500);
|
throw new AppFriendlyException(errMsg, 500);
|
||||||
}
|
}
|
||||||
@@ -95,40 +78,45 @@ namespace Tnb.WarehouseMgr
|
|||||||
x.modify_id = _userManager.UserId;
|
x.modify_id = _userManager.UserId;
|
||||||
x.modify_time = DateTime.Now;
|
x.modify_time = DateTime.Now;
|
||||||
});
|
});
|
||||||
|
|
||||||
await _db.Updateable(purchaseDs).ExecuteCommandAsync();
|
await _db.Updateable(purchaseDs).ExecuteCommandAsync();
|
||||||
|
|
||||||
if (purchaseDs.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
if (purchaseDs.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||||
{
|
{
|
||||||
var purchase = await _db.Queryable<WmsPurchaseH>().FirstAsync(it => it.bill_code == input.bill_code);
|
var purchase = await _db.Queryable<WmsPurchaseH>().FirstAsync(it => it.id == purchaseDs.First().bill_id);
|
||||||
|
|
||||||
if (purchase != null)
|
if (purchase != null)
|
||||||
{
|
{
|
||||||
purchase.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
purchase.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||||
purchase.modify_id = _userManager.UserId;
|
purchase.modify_id = _userManager.UserId;
|
||||||
purchase.modify_time = DateTime.Now;
|
purchase.modify_time = DateTime.Now;
|
||||||
|
|
||||||
await _db.Updateable(purchase).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
await _db.Updateable(purchase).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VisualDevModelDataCrInput visualDevModelDataInput = new();
|
|
||||||
visualDevModelDataInput.data = PocoToDictionary.ToDictionary(input) as Dictionary<string, object>;
|
|
||||||
if (_wmsOutStockService != null)
|
|
||||||
{
|
|
||||||
await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(purchaseDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<List<TEntity>> GetDetailsByPkId(string pkId)
|
|
||||||
|
protected async Task<List<TSubEntity>> GetDetailsByPkId(string pkId)
|
||||||
{
|
{
|
||||||
if (s_materialMap.Count == 0)
|
if (s_materialMap.Count == 0)
|
||||||
{
|
{
|
||||||
s_materialMap = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
s_materialMap = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
||||||
}
|
}
|
||||||
var list = await _db.Queryable<TEntity>().Where(it => it.bill_id == pkId)
|
var list = await _db.Queryable<TSubEntity>().Where(it => it.bill_id == pkId)
|
||||||
.Mapper(it => it.material_name = s_materialMap.ContainsKey(it.material_id) ? s_materialMap[it.material_id]?.ToString() ?? "" : "")
|
.Mapper(it => it.material_name = s_materialMap.ContainsKey(it.material_id) ? s_materialMap[it.material_id]?.ToString() ?? "" : "")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async Task<bool> Audit<TEntity>(PurchaseAndSaleAuditUpInput input) where TEntity : BaseEntity<string>, IPurchaseAndSaleAuitEntity, new()
|
||||||
|
{
|
||||||
|
return await _db.Updateable<TEntity>().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,23 +62,28 @@ namespace Tnb.WarehouseMgr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
WmsInstockH? instock = null;
|
||||||
blFlag = await PurchaseAndSaleUpdate(input);
|
var purchaseDs = await PurchaseAndSaleUpdate(input);
|
||||||
if (blFlag)
|
List<WmsInstockD> instockDs = new();
|
||||||
|
if (purchaseDs?.Count > 0)
|
||||||
{
|
{
|
||||||
var instock = input.Adapt<WmsInstockH>();
|
instock = input.Adapt<WmsInstockH>();
|
||||||
instock.id = SnowflakeIdHelper.NextId();
|
instock.id = SnowflakeIdHelper.NextId();
|
||||||
instock.create_id = _userManager.UserId;
|
instock.create_id = _userManager.UserId;
|
||||||
instock.create_time = DateTime.Now;
|
instock.create_time = DateTime.Now;
|
||||||
instock.org_id = _userManager.User.OrganizeId;
|
instock.org_id = _userManager.User.OrganizeId;
|
||||||
await _db.Insertable(instock).ExecuteCommandAsync();
|
await _db.Insertable(instock).ExecuteCommandAsync();
|
||||||
|
|
||||||
var instockD = input.details.Adapt<WmsInstockD>();
|
instockDs = purchaseDs.Adapt<List<WmsInstockD>>();
|
||||||
instockD.create_id = _userManager.UserId;
|
instockDs.ForEach(instockD =>
|
||||||
instockD.create_time = DateTime.Now;
|
{
|
||||||
instockD.org_id = _userManager.User.OrganizeId;
|
instockD.create_id = _userManager.UserId;
|
||||||
await _db.Insertable(instockD).ExecuteCommandAsync();
|
instockD.create_time = DateTime.Now;
|
||||||
|
instockD.org_id = _userManager.User.OrganizeId;
|
||||||
|
});
|
||||||
|
await _db.Insertable(instockDs).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
//通知Mes接口
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
@@ -101,5 +106,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
return await GetDetailsByPkId(id);
|
return await GetDetailsByPkId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审核反审核
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">
|
||||||
|
///
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<bool> Audit(PurchaseAndSaleAuditUpInput input)
|
||||||
|
{
|
||||||
|
return await Audit<WmsPurchaseH>(input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.Common.Utils;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -17,23 +21,56 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class WmsSaleService : WmsPurchaseAndSaleCommonService<WmsSaleD>
|
public class WmsSaleService : WmsPurchaseAndSaleCommonService<WmsSaleD>
|
||||||
{
|
{
|
||||||
|
private readonly IWmsOutStockService _wmsOutStockService;
|
||||||
|
|
||||||
public WmsSaleService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager, IWmsOutStockService wmsOutStockService)
|
public WmsSaleService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager, IWmsOutStockService wmsOutStockService)
|
||||||
: base(repo, userManager, wmsOutStockService: wmsOutStockService)
|
: base(repo, userManager)
|
||||||
{
|
{
|
||||||
|
_wmsOutStockService = wmsOutStockService;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 销售发货
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">
|
||||||
|
///
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<dynamic> Sale(PurchaseAndReceiveUpInput input)
|
public async Task<dynamic> Sale(PurchaseAndReceiveUpInput input)
|
||||||
{
|
{
|
||||||
return await PurchaseAndSaleUpdate(input);
|
_ = await PurchaseAndSaleUpdate(input);
|
||||||
|
VisualDevModelDataCrInput visualDevModelDataInput = new();
|
||||||
|
visualDevModelDataInput.data = PocoToDictionary.ToDictionary(input) as Dictionary<string, object>;
|
||||||
|
visualDevModelDataInput.data["location_id"] = "26412597341221";
|
||||||
|
visualDevModelDataInput.data["location_code"] = "YCL01-01-01";
|
||||||
|
if (_wmsOutStockService != null)
|
||||||
|
{
|
||||||
|
await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput);
|
||||||
|
}
|
||||||
|
return await Task.FromResult(1);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据销售发货主表Id获取子表明细
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpGet("id")]
|
[HttpGet("id")]
|
||||||
public async Task<dynamic> GetSaleDetailsByBillId(string id)
|
public async Task<dynamic> GetSaleDetailsByBillId(string id)
|
||||||
{
|
{
|
||||||
return await GetDetailsByPkId(id);
|
return await GetDetailsByPkId(id);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 审核反审核
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">
|
||||||
|
///
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<bool> Audit(PurchaseAndSaleAuditUpInput input)
|
||||||
|
{
|
||||||
|
return await Audit<WmsSaleH>(input);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user