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>
|
||||
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
|
||||
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
@@ -5,6 +7,11 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// </summary>
|
||||
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>>();
|
||||
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? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
|
||||
@@ -527,11 +528,35 @@ namespace Tnb.ProductionMgr
|
||||
input.sidx = "create_time";
|
||||
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>()
|
||||
.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)
|
||||
.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,
|
||||
code = a.code,
|
||||
@@ -539,13 +564,17 @@ namespace Tnb.ProductionMgr
|
||||
type = "0",
|
||||
create_name = b.RealName,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
status = a.status
|
||||
status = e.FullName
|
||||
});
|
||||
|
||||
var queryable2 = db.Queryable<PrdOutstockH>()
|
||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<WmsOutstockH>((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)
|
||||
.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,
|
||||
code = a.bill_code,
|
||||
@@ -553,7 +582,7 @@ namespace Tnb.ProductionMgr
|
||||
type = a.type,
|
||||
create_name = b.RealName,
|
||||
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)
|
||||
.MergeTable()
|
||||
@@ -570,7 +599,7 @@ namespace Tnb.ProductionMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
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<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id)
|
||||
@@ -588,7 +617,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = db.Queryable<PrdOutstockD>()
|
||||
var result = await db.Queryable<PrdOutstockD>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
||||
.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)
|
||||
{
|
||||
PrdKittingOutH prdKittingOutH = new();
|
||||
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
||||
try
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
@@ -184,6 +185,7 @@ namespace Tnb.ProductionMgr
|
||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||
collocation_scheme_code = kittingOutInput.collocation_scheme_code,
|
||||
source_id = prdKittingOutH.id,
|
||||
source_code = prdKittingOutH.code,
|
||||
create_id = _userManager.UserId,
|
||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||
}
|
||||
@@ -205,7 +207,6 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
||||
prdKittingOutH.warehouse_id = kittingOutInput.warehouse_id;
|
||||
prdKittingOutH.location_code = kittingOutInput.location_code;
|
||||
prdKittingOutH.material_id = kittingOutInput.material_id;
|
||||
@@ -274,6 +275,7 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> KittingOutNew(KittingOutNewInput kittingOutInput)
|
||||
{
|
||||
PrdKittingOutH prdKittingOutH = new();
|
||||
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
||||
string warehouse_id = "26103348825381";//二楼缓存仓
|
||||
try
|
||||
{
|
||||
@@ -310,6 +312,7 @@ namespace Tnb.ProductionMgr
|
||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||
collocation_scheme_code = wmsCollocationSchemeH.bill_code,
|
||||
source_id = prdKittingOutH.id,
|
||||
source_code = prdKittingOutH.code,
|
||||
create_id = _userManager.UserId,
|
||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||
}
|
||||
@@ -344,7 +347,6 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
|
||||
prdKittingOutH.warehouse_id = warehouse_id;
|
||||
prdKittingOutH.location_code = kittingOutInput.location_code;
|
||||
prdKittingOutH.material_id = basMaterial.id;
|
||||
@@ -358,6 +360,7 @@ namespace Tnb.ProductionMgr
|
||||
prdKittingOutH.create_id = _userManager.UserId;
|
||||
prdKittingOutH.create_time = DateTime.Now;
|
||||
prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
prdKittingOutH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||
List<PrdKittingOutD> prdKittingOutDs = new();
|
||||
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;
|
||||
|
||||
PrdOutstockH prdOutstockH = new()
|
||||
{
|
||||
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||
};
|
||||
|
||||
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 = DateTime.Now;
|
||||
@@ -154,6 +159,8 @@ namespace Tnb.ProductionMgr
|
||||
input.outstock.warehouse_id = warehouse_id;
|
||||
input.outstock.create_id = _userManager.UserId;
|
||||
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);
|
||||
|
||||
List<string> materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList();
|
||||
@@ -195,20 +202,17 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdOutstockH prdOutstockH = new()
|
||||
{
|
||||
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||
bill_type = DictConst.SHENGCHANLINGLIAO,
|
||||
type = "1",
|
||||
warehouse_id = warehouse_id,
|
||||
location_code = generalOutstockInput.location_code,
|
||||
create_id = _userManager.UserId,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
create_time = DateTime.Now,
|
||||
workstation_id = generalOutstockInput.workstation_id,
|
||||
workline = workline?.Id ?? ""
|
||||
};
|
||||
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||
prdOutstockH.type = "1";
|
||||
prdOutstockH.warehouse_id = warehouse_id;
|
||||
prdOutstockH.location_code = generalOutstockInput.location_code;
|
||||
prdOutstockH.create_id = _userManager.UserId;
|
||||
prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
prdOutstockH.create_time = DateTime.Now;
|
||||
prdOutstockH.workstation_id = generalOutstockInput.workstation_id;
|
||||
prdOutstockH.workline = workline?.Id ?? "";
|
||||
prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||
|
||||
List<PrdOutstockD> prdOutstockDs = new();
|
||||
foreach (GeneralOutstockDInput item in generalOutstockInput.details)
|
||||
@@ -266,6 +270,11 @@ namespace Tnb.ProductionMgr
|
||||
BasLocation location = await db.Queryable<BasLocation>().Where(x=>x.location_code==materialOutstockInput.location_code).FirstAsync();
|
||||
if (location == null) throw Oops.Bah("未找到库位");
|
||||
string locationId = location.id;
|
||||
|
||||
PrdOutstockH prdOutstockH = new()
|
||||
{
|
||||
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||
};
|
||||
|
||||
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
||||
@@ -274,6 +283,8 @@ namespace Tnb.ProductionMgr
|
||||
input.outstock.warehouse_id = warehouse_id;
|
||||
input.outstock.create_id = _userManager.UserId;
|
||||
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);
|
||||
|
||||
List<string> materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList();
|
||||
@@ -315,8 +326,6 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdOutstockH prdOutstockH = new PrdOutstockH();
|
||||
prdOutstockH.bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE);
|
||||
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||
prdOutstockH.type = "2";
|
||||
prdOutstockH.warehouse_id = warehouse_id;
|
||||
@@ -327,6 +336,7 @@ namespace Tnb.ProductionMgr
|
||||
prdOutstockH.create_time = DateTime.Now;
|
||||
prdOutstockH.workstation_id = materialOutstockInput.workstation_id;
|
||||
prdOutstockH.workline = workline?.Id ?? "";
|
||||
prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||
|
||||
List<PrdOutstockD> prdOutstockDs = new List<PrdOutstockD>();
|
||||
foreach (var item in materialOutstockInput.details)
|
||||
|
||||
Reference in New Issue
Block a user