diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
index ab3fad04..8fa89a1b 100644
--- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
+++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
@@ -179,6 +179,41 @@ public static class DictConst
///
public const string SHENGCHANBULIAO = "24";
+ ///
+ /// 出入库单据状态code
+ ///
+ public const string DOCUMENTSTATU = "DocumentStatu";
+
+ ///
+ /// 出库单据状态新增
+ ///
+ public const string OUTSTOCKSTATUSADD = "1";
+
+ ///
+ /// 出库单据状态作业中
+ ///
+ public const string OUTSTOCKSTATUSWORKING = "2";
+
+ ///
+ /// 出库单据状态已呼叫
+ ///
+ public const string OUTSTOCKSTATUSCALLED = "3";
+
+ ///
+ /// 出库单据状态待配送
+ ///
+ public const string OUTSTOCKSTATUSTOBEDELIVERED = "4";
+
+ ///
+ /// 出库单据状态取消
+ ///
+ public const string OUTSTOCKSTATUSCANCEL = "7";
+
+ ///
+ /// 出库单据状态完成
+ ///
+ public const string OUTSTOCKSTATUSCOMPLETED = "8";
+
#endregion
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/InstockInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/InstockInput.cs
index 66479a8a..73363b30 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/InstockInput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/InstockInput.cs
@@ -4,6 +4,5 @@ namespace Tnb.ProductionMgr.Entities.Dto
{
public string equip_code { get; set; }
public string label_code { get; set; }
- public string as_location_code { get; set; }
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs
new file mode 100644
index 00000000..94cfd047
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs
@@ -0,0 +1,20 @@
+namespace Tnb.ProductionMgr.Entities.Dto
+{
+ public class PrdKittingOutChangeStatusInput
+ {
+ ///
+ /// 来源单号
+ ///
+ public string code { get; set; }
+
+ ///
+ /// 0 齐套出库 1 一般出库 2 物料出库
+ ///
+ public string type { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public string status { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs
index 787a4198..5d31f9a8 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs
@@ -63,7 +63,7 @@ public partial class PrdOutstockH : BaseEntity
///
/// 发料工位
///
- public string? workstation { get; set; }
+ public string? workstation_id { get; set; }
///
/// 所属产线
diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs
index 82f82e86..68a697ea 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs
@@ -43,5 +43,12 @@ namespace Tnb.ProductionMgr.Interfaces
///
///
public Task InstockTubeThree(PrdReport prdReport);
+
+ ///
+ /// 外包装入库申请
+ ///
+ ///
+ ///
+ public Task InstockOutPack(InstockInput inut);
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs
index a9e6babd..91b17a8c 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs
@@ -1,3 +1,5 @@
+using Tnb.ProductionMgr.Entities.Dto;
+
namespace Tnb.ProductionMgr.Interfaces
{
///
@@ -5,6 +7,11 @@ namespace Tnb.ProductionMgr.Interfaces
///
public interface IPrdKittingOutService
{
-
+ ///
+ /// 齐套出库 一般出库 物料出库 改状态
+ ///
+ ///
+ ///
+ public Task ChangeStatusById(List inputs);
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
index 08625689..4087a392 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
@@ -519,6 +519,7 @@ namespace Tnb.ProductionMgr
Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>();
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 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()
.LeftJoin((a, b) => a.create_id == b.Id)
+ .LeftJoin((a,b,c)=>a.id==c.source_id)
+ .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU)
+ .LeftJoin((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()
.LeftJoin((a, b) => a.create_id == b.Id)
- .Where((a,b)=>a.workstation==input.stationId)
- .Select((a, b) => new FeedingRecordListOutput()
+ .LeftJoin((a,b,c)=>a.id==c.source_id)
+ .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU)
+ .LeftJoin((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,
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()
+ var result = await db.Queryable()
.LeftJoin((a, b) => a.material_id == b.id)
.LeftJoin((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
.LeftJoin((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()
+ var result = await db.Queryable()
.LeftJoin((a, b) => a.material_id == b.id)
.LeftJoin((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
.LeftJoin((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id)
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
index 80cc8a35..abbf5355 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
@@ -263,7 +263,6 @@ namespace Tnb.ProductionMgr
{
string equip_code = inut.equip_code;
string label_code = inut.label_code;
- string as_location_code = inut.as_location_code;
string warehouse_id = "2";
if (!string.IsNullOrEmpty(equip_code))
{
@@ -621,5 +620,15 @@ namespace Tnb.ProductionMgr
return result2.IsSuccess ? "true" : "false";
}
+
+ ///
+ /// 外包装入库申请
+ ///
+ ///
+ ///
+ public Task InstockOutPack(InstockInput inut)
+ {
+ throw new NotImplementedException();
+ }
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs
index cbff6ef9..7bc067f5 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs
@@ -165,6 +165,7 @@ namespace Tnb.ProductionMgr
public async Task 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(),
}
@@ -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 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(),
}
@@ -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 prdKittingOutDs = new();
foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs)
{
@@ -401,5 +404,38 @@ namespace Tnb.ProductionMgr
}
}
+
+ ///
+ /// 齐套出库 一般出库 物料出库 改状态
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task ChangeStatusById(List 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().SetColumns(x => x.status == input.status)
+ .Where(x => x.code == input.code).ExecuteCommandAsync();
+ }else if (input.type == "1" || input.type == "2")
+ {
+ await db.Updateable().SetColumns(x => x.status == input.status)
+ .Where(x => x.bill_code == input.code).ExecuteCommandAsync();
+ }
+ }
+
+ return true;
+ }
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs
index 597ab613..d677dcf0 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs
@@ -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 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 = 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 prdOutstockDs = new();
foreach (GeneralOutstockDInput item in generalOutstockInput.details)
@@ -266,6 +270,11 @@ namespace Tnb.ProductionMgr
BasLocation location = await db.Queryable().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 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;
@@ -325,8 +334,9 @@ namespace Tnb.ProductionMgr
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 = materialOutstockInput.workstation_id;
+ prdOutstockH.workstation_id = materialOutstockInput.workstation_id;
prdOutstockH.workline = workline?.Id ?? "";
+ prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD;
List prdOutstockDs = new List();
foreach (var item in materialOutstockInput.details)
diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs
index 12879acb..5ac1eaf7 100644
--- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs
@@ -25,62 +25,74 @@ namespace Tnb.ProductionMgr
//获取注塑装箱状态
private void GetZSPackStatus(object state)
{
- string[] strs = new string[1] { "TY4C-ZHUSU1" };
- string sign = "agvMode";
- foreach (string s in strs)
+ try
{
- Dictionary dic = _redisData.HGetAll(s).Result;
- foreach (KeyValuePair kv in dic)
+ string[] strs = new string[1] { "TY4C-ZHUSU1" };
+ string sign = "agvMode";
+ foreach (string s in strs)
{
- if (!kv.Key.Contains(sign))
+ Dictionary dic = _redisData.HGetAll(s).Result;
+ foreach (KeyValuePair kv in dic)
{
- continue;
- }
-
- JObject? res = JsonConvert.DeserializeObject(kv.Value);
- if (res != null && res["Value"] != null)
- {
- if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求))
+ if (!kv.Key.Contains(sign))
{
- InstockInput instockInput = new()
+ continue;
+ }
+ JObject? res = JsonConvert.DeserializeObject(kv.Value);
+ if (res != null && res["Value"] != null)
+ {
+ if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求))
{
- equip_code = res["TagName"]!.ToString()
- };
- _ = _prdInstockService.InstockTypeOne(instockInput);
+ InstockInput instockInput = new()
+ {
+ equip_code = res["DevName"]!.ToString(),
+ label_code = res["TagName"]!.ToString()
+ };
+ _prdInstockService.InstockTypeOne(instockInput);
+ }
}
}
}
}
+ catch (Exception)
+ {
+ }
}
//获取挤出装箱状态
private void GetJCPackStatus(object state)
{
- string[] strs = new string[1] { "TY4C-SHUSONG-JC" };
- string sign = "AGVFullCall";
- foreach (string s in strs)
+ try
{
- Dictionary dic = _redisData.HGetAll(s).Result;
- foreach (KeyValuePair kv in dic)
+ string[] strs = new string[1] { "TY4C-SHUSONG-JC" };
+ string sign = "AGVFullCall";
+ foreach (string s in strs)
{
- if (!kv.Key.Contains(sign))
+ Dictionary dic = _redisData.HGetAll(s).Result;
+ foreach (KeyValuePair kv in dic)
{
- continue;
- }
-
- JObject? res = JsonConvert.DeserializeObject(kv.Value);
- if (res != null && res["Value"] != null)
- {
- if (res.Value("Value"))
+ if (!kv.Key.Contains(sign))
{
- InstockInput instockInput = new()
+ continue;
+ }
+ JObject? res = JsonConvert.DeserializeObject(kv.Value);
+ if (res != null && res["Value"] != null)
+ {
+ if (res.Value("Value"))
{
- equip_code = res["TagName"]!.ToString()
- };
- _ = _prdInstockService.InstockTypeOne(instockInput);
+ InstockInput instockInput = new()
+ {
+ equip_code = res["DevName"]!.ToString(),
+ label_code = res["TagName"]!.ToString()
+ };
+ _prdInstockService.InstockTypeOne(instockInput);
+ }
}
}
}
}
+ catch (Exception)
+ {
+ }
}
//获取限位状态
private void GetLimitStatus(object state)
@@ -90,29 +102,38 @@ namespace Tnb.ProductionMgr
Console.WriteLine($"获取挤出装箱状态");
string data = _redisData.GetHash("TY4C-SHUSONG-JC", "AGVFullCall").Result;
Console.WriteLine(data);*/
- /*
- string[] strs = new string[1] { "TY4C-WAIBAO" };
- string sign = "AGVCall";
- foreach (string s in strs)
+ try
{
- Dictionary dic = _redisData.HGetAll(s).Result;
- foreach (KeyValuePair kv in dic)
+ string[] strs = new string[1] { "TY4C-WAIBAO" };
+ string sign = "AGVCall";
+ foreach (string s in strs)
{
- if (!kv.Key.Contains(sign))
+ Dictionary dic = _redisData.HGetAll(s).Result;
+ foreach (KeyValuePair kv in dic)
{
- continue;
- }
-
- JObject? res = JsonConvert.DeserializeObject(kv.Value);
- if (res != null && res["Value"] != null)
- {
- if (res.Value("Value"))
+ if (!kv.Key.Contains(sign))
{
- //
+ continue;
+ }
+ JObject? res = JsonConvert.DeserializeObject(kv.Value);
+ if (res != null && res["Value"] != null)
+ {
+ if (res.Value("Value"))
+ {
+ InstockInput instockInput = new()
+ {
+ equip_code = res["DevName"]!.ToString(),
+ label_code = res["TagName"]!.ToString()
+ };
+ _prdInstockService.InstockOutPack(instockInput);
+ }
}
}
}
- }*/
+ }
+ catch (Exception)
+ {
+ }
}
public void Dispose()
{
@@ -122,9 +143,9 @@ namespace Tnb.ProductionMgr
}
public Task StartAsync(CancellationToken cancellationToken)
{
- // ZSpacktimer = new Timer(GetZSPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
- // JCpacktimer = new Timer(GetJCPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
- // limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
+ ZSpacktimer = new Timer(GetZSPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
+ JCpacktimer = new Timer(GetJCPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
+ limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
index ff4126df..1ac31664 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
@@ -45,4 +45,26 @@ namespace Tnb.QcMgr.Entities
///
public int? pronum { get; set; }
}
+
+
+ public class CreateTaskEntity
+ {
+ ///
+ /// 物料方案编号
+ ///
+ public List materialids { get; set; }
+ ///
+ /// 触发条件
+ ///
+ public EnumTriggerEvent? triggerevent { get; set; }
+
+ public string maintableid { get; set; }
+ }
+ public class TaskEntity
+ {
+ public List materialids { get; set; }
+ public QcCheckPlanH qcCheckPlanH { get; set; }
+ public string maintableid { get; set; }
+
+ }
}
diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs
index 1041014a..2a093936 100644
--- a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs
+++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs
@@ -32,5 +32,7 @@ namespace Tnb.QcMgr.Interfaces
///
public Task CreateTask(TriggerPlanEntity entity);
+ public Task CreateWmsTask(CreateTaskEntity entity);
+
}
}
diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
index 9fafc113..283da28c 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
@@ -286,6 +286,109 @@ namespace Tnb.QcMgr
}
}
+ ///
+ /// WMS出库入库检
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task CreateWmsTask(CreateTaskEntity entity)
+ {
+ ISugarQueryable Query = _repository.AsSugarClient().Queryable
+ ((a, b) => new object[] {
+ JoinType.Inner,a.id== b.mainid,
+ });
+ GetQuery(Query, entity);
+ List list = await Query.ToListAsync();
+ List taskEntities = new List();
+ foreach (QcCheckPlanH data in list)
+ {
+ if (entity.materialids.Count>0)
+ {
+ if (_repository.AsSugarClient().Queryable().Where(p => p.planid == data.id).Any())
+ {
+ var Materials= _repository.AsSugarClient().Queryable().Where(p => p.planid == data.id).Select(p=>p.materialid).ToList();
+ var Intersect = entity.materialids.Intersect(Materials).ToList();
+ if (Intersect.Count > 0)
+ {
+ taskEntities.Add(new TaskEntity { maintableid=entity.maintableid, materialids = Intersect!, qcCheckPlanH = data });
+ }
+ }
+ }
+ }
+ if (taskEntities.Count > 0)
+ {
+ await SaveTask(taskEntities);
+ }
+ }
+
+ private void GetQuery(ISugarQueryable Query, CreateTaskEntity entity)
+ {
+ List DictionaryData = _repository.AsSugarClient().Queryable
+ ((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
+ .Where((a, b) => b.FullName == "质检类型选择").ToList();
+ QcTriggerEvent TriggerEvent = new();
+ EnumTriggerEvent? enumTriggerEvent = entity.triggerevent;
+ RemarkAttribute remark = RemarkAttribute.GetRemark(enumTriggerEvent);
+ string type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id;
+ TriggerEvent = _repository.AsSugarClient().Queryable().Where(p => p.type == type && p.name == remark.CheckContent).First();
+ Query = Query.Where((a, b) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id));
+ }
+
+ private async Task SaveTask(List taskEntities)
+ {
+ DictionaryDataEntity DictionaryData = _repository.AsSugarClient().Queryable
+ ((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
+ .Where((a, b) => b.FullName == "质检状态" && a.FullName == "待执行").First();
+ foreach (var entity in taskEntities)
+ {
+ List plands = await _repository.AsSugarClient().Queryable().Where(p =>p.mainid== entity.qcCheckPlanH.id).ToListAsync();
+
+ foreach (string s in entity.materialids)
+ {
+ DateTime time = DateTime.Now;
+ QcCheckExecH qcCheckExecH = new()
+ {
+ id = SnowflakeIdHelper.NextId(),
+ checktype = entity.qcCheckPlanH.checktype,
+ status = DictionaryData.Id,
+ tasktime = time.ToString("yyyy-MM-dd HH:mm:ss"),
+ materialid = s,
+ create_id = _userManager.UserId,
+ create_time = time,
+ extras= entity.maintableid
+ };
+ List ExecDs = new();
+ foreach (var pland in plands)
+ {
+ QcCheckExecD QcCheckExecD = new()
+ {
+ mainid = qcCheckExecH.id,
+ extype = pland.extype,
+ excontent = pland.excontent,
+ check = pland.check,
+ errorcause = pland.errorcause,
+ errorlevel = pland.errorlevel,
+ remark = pland.remark,
+ attachment = pland.attachment,
+ isexec = pland.isexec,
+ custom = pland.custom,
+ typeid = pland.typeid,
+ itemid = pland.itemid,
+ create_id = _userManager.UserId,
+ create_time = time
+ };
+ ExecDs.Add(QcCheckExecD);
+ }
+ _ = await _repository.AsSugarClient().Insertable(qcCheckExecH).ExecuteCommandAsync();
+ _ = await _repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync();
+ }
+
+ }
+ }
+
+
+
///
/// 根据计划生成任务
///
diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
index 34a86548..51b94859 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
@@ -15,6 +15,8 @@ using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.QcMgr.Entities;
using Tnb.QcMgr.Interfaces;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
+using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.QcMgr
{
@@ -29,12 +31,16 @@ namespace Tnb.QcMgr
private const string ModuleId = "26745613138709";
private readonly ISqlSugarRepository _repository;
private readonly IUserManager _userManager;
+ private readonly IWmsSaleService _wmsSaleService;
+ private readonly IWmsPurchaseService _wmsPurchaseService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
- public QcCheckTaskService(ISqlSugarRepository repository, IUserManager userManager)
+ public QcCheckTaskService(ISqlSugarRepository repository, IUserManager userManager, IWmsSaleService wmsSaleService, IWmsPurchaseService wmsPurchaseService)
{
_repository = repository;
_userManager = userManager;
OverideFuncs.GetListAsync = GetListAsync;
+ _wmsSaleService= wmsSaleService;
+ _wmsPurchaseService= wmsPurchaseService;
}
private async Task GetListAsync(VisualDevModelListQueryInput input)
@@ -44,7 +50,7 @@ namespace Tnb.QcMgr
{
{ "ok", "合格" },
{ "no", "不合格" },
- { "barelyok", "让步合格" },
+ { "barelyOk", "让步合格" },
{ "await", "待检" },
{ "temporarily", "暂控" }
};
@@ -197,6 +203,14 @@ namespace Tnb.QcMgr
ISqlSugarClient db = _repository.AsSugarClient();
try
{
+ Dictionary dic = new()
+ {
+ { "ok", 1 },
+ { "no", 2 },
+ { "barelyOk", 4 },
+ { "await", 8 },
+ { "temporarily", 16 }
+ };
QcCheckExecH QcCheckExecH = await db.Queryable().Where(p => p.id == CheckTaskInput.mainid).FirstAsync();
DictionaryTypeEntity DictionaryType = await db.Queryable().Where(p => p.FullName == "质检状态").FirstAsync();
DictionaryDataEntity DictionaryData = await db.Queryable().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "已完成").FirstAsync();
@@ -267,6 +281,22 @@ namespace Tnb.QcMgr
_ = await db.Updateable(QcCheckExecH).ExecuteCommandAsync();
_ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync();
_ = await db.Insertable(QcCheckExecDinsert).ExecuteCommandAsync();
+ //出厂检
+ if (QcCheckExecH.checktype == "26589783783701" && !string.IsNullOrEmpty(QcCheckExecH.extras))
+ {
+ MesCheckdCallbackUpinput mesCheckdCallbackUpinput = new MesCheckdCallbackUpinput();
+ mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
+ mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
+ await _wmsSaleService.MesCheckdSaleCallback(mesCheckdCallbackUpinput);
+ }
+ //入厂检
+ else if (QcCheckExecH.checktype == "26589773352981" && !string.IsNullOrEmpty(QcCheckExecH.extras))
+ {
+ MesCheckdCallbackUpinput mesCheckdCallbackUpinput = new MesCheckdCallbackUpinput();
+ mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
+ mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
+ await _wmsPurchaseService.MesCheckdPurchaseCallback(mesCheckdCallbackUpinput);
+ }
await db.Ado.CommitTranAsync();
}
catch (Exception)
diff --git a/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj b/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj
index 612c4841..1cf08455 100644
--- a/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj
+++ b/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj
@@ -10,6 +10,7 @@
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs
index 07ec571e..c50e9373 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs
@@ -20,5 +20,6 @@
///
public string WriteTagUrl { get; set; }
+ public string Environment { get; set; }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs
index 1a440145..72a7107c 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs
@@ -50,5 +50,11 @@
/// AGV心跳
///
public const string AGVKeepalive = "AGVKeepalive";
+ ///
+ /// 运行环境名称
+ ///
+ public const string EnvironmentName = "TIANYI";
+
+
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs
new file mode 100644
index 00000000..c0675af0
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
+{
+ ///
+ /// Mes检验后回传输入参数
+ ///
+ public class MesCheckdCallbackUpinput
+ {
+ ///
+ /// 主表Id
+ ///
+ public string maintableid { get; set; }
+ ///
+ /// 检验结论
+ ///
+ public int check_conclusion { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs
new file mode 100644
index 00000000..34944d0c
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs
@@ -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
+{
+ ///
+ /// 采购收货,销售发货,审核、审核反审核 输入参数
+ ///
+ public class PurchaseAndSaleAuditUpInput
+ {
+ ///
+ /// 要更新的id集合列表
+ ///
+ public List ids { get; set; }
+ ///
+ /// 1、审核 2、反审核
+ ///
+ public EnumAuditType auditType { get; set; }
+
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs
new file mode 100644
index 00000000..0e1d9728
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs
@@ -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
+ {
+ ///
+ /// 审核状态
+ ///
+ public int? audit_status { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs
new file mode 100644
index 00000000..c5a3935b
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Entity.Constraints
+{
+ ///
+ /// 修改出入库检验状态
+ ///
+ public interface InOutCheckStatusUpdateEntity
+ {
+ ///
+ /// 检验状态
+ ///
+ public int? check_conclusion { get; set; }
+ ///
+ /// 是否检验
+ ///
+ public int? is_check { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs
index 97516e77..44e6c1c0 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs
@@ -1,6 +1,7 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
+using Tnb.WarehouseMgr.Entities.Entity.Constraints;
namespace Tnb.WarehouseMgr.Entities;
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
/// 入库申请主表
///
[SugarTable("wms_instock_h")]
-public partial class WmsInstockH : BaseEntity
+public partial class WmsInstockH : BaseEntity, InOutCheckStatusUpdateEntity
{
public WmsInstockH()
{
@@ -212,4 +213,8 @@ public partial class WmsInstockH : BaseEntity
/// 采购单号
///
public string purchase_code { get; set; }
+ ///
+ /// 检验结论
+ ///
+ public int? check_conclusion { get; set; }
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs
index 6416d598..c6ef40ab 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs
@@ -1,6 +1,7 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
+using Tnb.WarehouseMgr.Entities.Entity.Constraints;
namespace Tnb.WarehouseMgr.Entities;
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
/// 出库申请主表
///
[SugarTable("wms_outstock_h")]
-public partial class WmsOutstockH : BaseEntity
+public partial class WmsOutstockH : BaseEntity, InOutCheckStatusUpdateEntity
{
public WmsOutstockH()
{
@@ -170,4 +171,12 @@ public partial class WmsOutstockH : BaseEntity
/// 载具Id
///
public string carry_id { get; set; }
+ ///
+ /// 检验结论
+ ///
+ public int? check_conclusion { get; set; }
+ ///
+ /// 是否检验
+ ///
+ public int? is_check { get; set; }
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs
index 78b24706..fd0c9f7f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs
@@ -1,6 +1,7 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
+using Tnb.WarehouseMgr.Entities.Entity.Constraints;
namespace Tnb.WarehouseMgr.Entities;
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
/// 采购收货主表
///
[SugarTable("wms_purchase_h")]
-public partial class WmsPurchaseH : BaseEntity
+public partial class WmsPurchaseH : BaseEntity, IPurchaseAndSaleAuitEntity
{
public WmsPurchaseH()
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs
index 269fb93c..24e35d0b 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs
@@ -1,6 +1,7 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
+using Tnb.WarehouseMgr.Entities.Entity.Constraints;
namespace Tnb.WarehouseMgr.Entities;
@@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
/// 销售发货主表
///
[SugarTable("wms_sale_h")]
-public partial class WmsSaleH : BaseEntity
+public partial class WmsSaleH : BaseEntity, IPurchaseAndSaleAuitEntity
{
public WmsSaleH()
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs
new file mode 100644
index 00000000..90aeb6b5
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs
@@ -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,
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs
new file mode 100644
index 00000000..b28063ac
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
+
+namespace Tnb.WarehouseMgr.Interfaces
+{
+ ///
+ /// 采购收货
+ ///
+ public interface IWmsPurchaseService
+ {
+ Task MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs
new file mode 100644
index 00000000..ad4a89fc
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
+
+namespace Tnb.WarehouseMgr.Interfaces
+{
+ ///
+ /// 销售发货
+ ///
+ public interface IWmsSaleService
+ {
+ Task MesCheckdSaleCallback(MesCheckdCallbackUpinput input);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj
index 7d6b065d..1e562b1a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj
+++ b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj
@@ -9,11 +9,16 @@
Debug;Release;tianyi
+
+
+
+
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index f8a94183..6015c8d9 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -382,38 +382,42 @@ namespace Tnb.WarehouseMgr
await db.Ado.CommitTranAsync();
- //呼梯操作
- //获取目标库位为电梯库位的任务
- List<(string endlocation_code, string device_id, string id, string? start_floor)> endLocCodes = disTasks
- .Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
- !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
- .Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
- if (endLocCodes?.Count > 0)
+ if(_eleCtlCfg.Environment == ElevatorConsts.EnvironmentName)
{
-
- await CallingLanding(endLocCodes);
- }
- //执行电梯任务
- List? elevatorTasks = disTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
-
- if (elevatorTasks?.Count > 0)
- {
- Logger.Information($"当前电梯任务数:{elevatorTasks?.Count ?? 0}");
- Logger.Information("准备执行电梯任务");
- Logger.Information("执行电梯任务");
-
- foreach (WmsDistaskH? elevatorTask in elevatorTasks)
+ //呼梯操作
+ //获取目标库位为电梯库位的任务
+ List<(string endlocation_code, string device_id, string id, string? start_floor)> endLocCodes = disTasks
+ .Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
+ !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
+ .Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
+ if (endLocCodes?.Count > 0)
{
- await ExecuteTargetFloorTask(elevatorTask);
- }
+ await CallingLanding(endLocCodes);
+ }
+ //执行电梯任务
+ List? elevatorTasks = disTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
+
+ if (elevatorTasks?.Count > 0)
+ {
+ Logger.Information($"当前电梯任务数:{elevatorTasks?.Count ?? 0}");
+ Logger.Information("准备执行电梯任务");
+ Logger.Information("执行电梯任务");
+
+ foreach (WmsDistaskH? elevatorTask in elevatorTasks)
+ {
+ await ExecuteTargetFloorTask(elevatorTask);
+ }
+
+ }
+ ////调用AGV创建任务链接口
+ List agvTasks = disTasks.Where(it => !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
+ if (agvTasks?.Count > 0)
+ {
+ await AgvDispatch(agvTasks, agvCts.Token);
+ }
}
- ////调用AGV创建任务链接口
- List agvTasks = disTasks.Where(it => !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
- if (agvTasks?.Count > 0)
- {
- await AgvDispatch(agvTasks, agvCts.Token);
- }
+
}
}
catch (Exception ex) when (ex is HttpRequestException hReqEx)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs
index 3f81c037..ba4fcd7d 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs
@@ -208,6 +208,9 @@ namespace Tnb.WarehouseMgr
}
}
}
+ else {
+ throw new AppFriendlyException("没有匹配的空载具可以出库", 500);
+ }
await _db.Ado.CommitTranAsync();
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
index 355db6b3..e88b7040 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
@@ -74,6 +74,7 @@ namespace Tnb.WarehouseMgr
public async Task OutStockApplyFor(VisualDevModelDataCrInput input)
{
+ List outStockDList = new();
try
{
await _db.Ado.BeginTranAsync();
@@ -131,10 +132,20 @@ namespace Tnb.WarehouseMgr
List carryIds = new();
+ var mapKeys = new List { "tablefield120", "details" };
+
//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 outStockDList = input.data["tablefield120"].ToObject>();
+
+ if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull())
+ {
+ outStockDList = input.data["tablefield120"].ToObject>();
+ }
+ else
+ {
+ outStockDList = input.data["details"].ToObject>();
+ }
if (outStockDList?.Count > 0)
{
List carryMats = new();
@@ -378,7 +389,7 @@ namespace Tnb.WarehouseMgr
{
await InvokeGenPretaskExcute();
}
- return Task.FromResult(true);
+ return Task.FromResult((input.data["ReturnIdentity"].ToString(), outStockDList));
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs
index a0288bf5..1ced5f17 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using JNPF.Common.Contracts;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
+using JNPF.Common.Extension;
using JNPF.FriendlyException;
using SqlSugar;
using Tnb.BasicData.Entities;
@@ -13,7 +14,9 @@ using Tnb.Common.Utils;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
+using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr
@@ -21,71 +24,53 @@ namespace Tnb.WarehouseMgr
///
/// 采购收货、销售发货,通用业务类
///
- ///
- public class WmsPurchaseAndSaleCommonService : BaseWareHouseService where TEntity : BaseEntity, IPurchaseAndSaleEntity, IPurchaseAndSaleQueryEntity
+ ///
+ public class WmsPurchaseAndSaleCommonService : BaseWareHouseService where TSubEntity : BaseEntity, IPurchaseAndSaleEntity, IPurchaseAndSaleQueryEntity
{
private readonly ISqlSugarClient _db;
private readonly IUserManager _userManager;
- private readonly IWmsPDAScanInStockService _wmsPDAScanInStockService;
- private readonly IWmsOutStockService _wmsOutStockService;
private static Dictionary s_materialMap = new();
- public WmsPurchaseAndSaleCommonService(ISqlSugarRepository repo, IUserManager userManager, IWmsOutStockService? wmsOutStockService = null)
+ public WmsPurchaseAndSaleCommonService(ISqlSugarRepository repo, IUserManager userManager)
{
_db = repo.AsSugarClient();
_userManager = userManager;
- _wmsOutStockService = wmsOutStockService!;
}
- protected async Task PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input)
+ protected async Task> PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input)
{
if (input == null) throw new ArgumentNullException("input");
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 purchaseDs = await _db.Queryable().Where(it => materialIds.Contains(it.material_id)).ToListAsync();
+ var purchaseDs = await _db.Queryable().Where(it => materialIds.Contains(it.material_id)).ToListAsync();
if (purchaseDs?.Count > 0)
{
var errMaterialTipList = new List<(string materialName, decimal purchaseArriveQty, decimal topPurchaseQty)>();
+
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);
if (pdInput != null)
{
+ pd.purchase_prqty += pdInput.purchase_arriveqty;
+
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 = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
- }
- else
- {
- pd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID;
- }
+
+ pd.line_status = pd.purchase_prqty >= pd.purchase_qty ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ON_ID;
}
+
if (errMaterialTipList.Count > 0)
{
- var errMsgList = new List();
- if (typeof(TEntity) == typeof(WmsPurchaseD))
- {
- errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际收货数:{x.purchaseArriveQty}已超出可收货数:{x.topPurchaseQty}").ToList();
- }
- else
- {
- errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际发货数:{x.purchaseArriveQty}已超出可发货数:{x.topPurchaseQty}").ToList();
- }
+ var itemType = typeof(TSubEntity) == typeof(WmsPurchaseD) ? "收货数" : "发货数";
+ var errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际{itemType}:{x.purchaseArriveQty}已超出可{itemType}:{x.topPurchaseQty}").ToList();
var errMsg = string.Join("\r\n", errMsgList);
throw new AppFriendlyException(errMsg, 500);
}
@@ -95,40 +80,65 @@ namespace Tnb.WarehouseMgr
x.modify_id = _userManager.UserId;
x.modify_time = DateTime.Now;
});
+
await _db.Updateable(purchaseDs).ExecuteCommandAsync();
+
if (purchaseDs.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
{
- var purchase = await _db.Queryable().FirstAsync(it => it.bill_code == input.bill_code);
+ var purchase = await _db.Queryable().FirstAsync(it => it.id == purchaseDs.First().bill_id);
+
if (purchase != null)
{
purchase.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
purchase.modify_id = _userManager.UserId;
purchase.modify_time = DateTime.Now;
+
await _db.Updateable(purchase).UpdateColumns(it => it.status).ExecuteCommandAsync();
}
}
}
- VisualDevModelDataCrInput visualDevModelDataInput = new();
- visualDevModelDataInput.data = PocoToDictionary.ToDictionary(input) as Dictionary;
- if (_wmsOutStockService != null)
- {
- await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput);
- }
-
- return await Task.FromResult(true);
+
+ return await Task.FromResult(purchaseDs);
}
- protected async Task> GetDetailsByPkId(string pkId)
+
+ protected async Task> GetDetailsByPkId(string pkId)
{
if (s_materialMap.Count == 0)
{
s_materialMap = await _db.Queryable().ToDictionaryAsync(x => x.id, x => x.name);
}
- var list = await _db.Queryable().Where(it => it.bill_id == pkId)
+ var list = await _db.Queryable().Where(it => it.bill_id == pkId)
.Mapper(it => it.material_name = s_materialMap.ContainsKey(it.material_id) ? s_materialMap[it.material_id]?.ToString() ?? "" : "")
.ToListAsync();
return list;
}
+
+ protected async Task Audit(PurchaseAndSaleAuditUpInput input) where TEntity : BaseEntity, IPurchaseAndSaleAuitEntity, new()
+ {
+ return await _db.Updateable().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync();
+ }
+
+ protected async Task UpdateChackStatus(MesCheckdCallbackUpinput input) where TEntity : BaseEntity, InOutCheckStatusUpdateEntity, new()
+ {
+ var stock = await _db.Queryable().SingleAsync(it => it.id == input.maintableid);
+ stock.check_conclusion = input.check_conclusion;
+ stock.is_check = 1;
+ var isOk = await _db.Updateable(stock).UpdateColumns(it => new { it.check_conclusion, it.is_check }).ExecuteCommandHasChangeAsync();
+ var preTask = await _db.Queryable().FirstAsync(it => it.require_id == input.maintableid);
+ if (preTask != null)
+ {
+ var carry = await _db.Queryable().SingleAsync(it => it.id == preTask.carry_id);
+ if (carry != null)
+ {
+ carry.check_conclusion = input.check_conclusion;
+ carry.is_check = 1;
+ isOk = await _db.Updateable(carry).UpdateColumns(it => new { it.check_conclusion, it.is_check }).ExecuteCommandHasChangeAsync();
+ }
+ }
+ return isOk;
+ }
+
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs
index 293ffdb2..70a14f5f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs
@@ -18,6 +18,9 @@ using NPOI.OpenXmlFormats.Dml.Diagram;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.Common.Utils;
+using Tnb.QcMgr.Entities;
+using Tnb.QcMgr.Entities.Enums;
+using Tnb.QcMgr.Interfaces;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
@@ -30,15 +33,17 @@ namespace Tnb.WarehouseMgr
/// 采购收货
///
[OverideVisualDev(ModuleConsts.MODULE_WMSPURCHASE_ID)]
- public class WmsPurchaseService : WmsPurchaseAndSaleCommonService
+ public class WmsPurchaseService : WmsPurchaseAndSaleCommonService, IWmsPurchaseService
{
private readonly ISqlSugarClient _db;
private readonly IUserManager _userManager;
- public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager)
+ private readonly IQcCheckPlanService _qcCheckPlanService;
+ public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService)
: base(repo, userManager)
{
_db = repo.AsSugarClient();
_userManager = userManager;
+ _qcCheckPlanService = qcCheckPlanService;
}
private async Task xxx(VisualDevModelDataCrInput input)
@@ -62,24 +67,33 @@ namespace Tnb.WarehouseMgr
try
{
await _db.Ado.BeginTranAsync();
-
- blFlag = await PurchaseAndSaleUpdate(input);
- if (blFlag)
+ WmsInstockH? instock = null;
+ var purchaseDs = await PurchaseAndSaleUpdate(input);
+ List instockDs = new();
+ if (purchaseDs?.Count > 0)
{
- var instock = input.Adapt();
+ instock = input.Adapt();
instock.id = SnowflakeIdHelper.NextId();
instock.create_id = _userManager.UserId;
instock.create_time = DateTime.Now;
instock.org_id = _userManager.User.OrganizeId;
await _db.Insertable(instock).ExecuteCommandAsync();
- var instockD = input.details.Adapt();
- instockD.create_id = _userManager.UserId;
- instockD.create_time = DateTime.Now;
- instockD.org_id = _userManager.User.OrganizeId;
- await _db.Insertable(instockD).ExecuteCommandAsync();
+ instockDs = purchaseDs.Adapt>();
+ instockDs.ForEach(instockD =>
+ {
+ instockD.create_id = _userManager.UserId;
+ instockD.create_time = DateTime.Now;
+ instockD.org_id = _userManager.User.OrganizeId;
+ });
+ await _db.Insertable(instockDs).ExecuteCommandAsync();
}
-
+ //通知Mes接口
+ CreateTaskEntity ctEntity = new();
+ ctEntity.maintableid = instock.id;
+ ctEntity.materialids = instockDs.Select(x => x.material_id).ToList();
+ ctEntity.triggerevent = EnumTriggerEvent.入厂检按物料编号;
+ _ = _qcCheckPlanService.CreateWmsTask(ctEntity);
await _db.Ado.CommitTranAsync();
}
catch (Exception ex)
@@ -101,5 +115,29 @@ namespace Tnb.WarehouseMgr
{
return await GetDetailsByPkId(id);
}
+
+ ///
+ /// 审核反审核
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Audit(PurchaseAndSaleAuditUpInput input)
+ {
+ return await Audit(input);
+ }
+ ///
+ /// mes 检验完后通知wms(采购) 回调接口
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input)
+ {
+ return await UpdateChackStatus(input);
+ }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs
index 4c59a752..d11fa558 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs
@@ -4,36 +4,95 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
+using Tnb.Common.Utils;
+using Tnb.QcMgr.Entities.Enums;
+using Tnb.QcMgr.Entities;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Interfaces;
+using Tnb.QcMgr.Interfaces;
namespace Tnb.WarehouseMgr
{
///
/// 销售发货
///
- public class WmsSaleService : WmsPurchaseAndSaleCommonService
+ public class WmsSaleService : WmsPurchaseAndSaleCommonService, IWmsSaleService
{
- public WmsSaleService(ISqlSugarRepository repo, IUserManager userManager, IWmsOutStockService wmsOutStockService)
- : base(repo, userManager, wmsOutStockService: wmsOutStockService)
+ private readonly IWmsOutStockService _wmsOutStockService;
+ private readonly IQcCheckPlanService _qcCheckPlanService;
+
+ public WmsSaleService(ISqlSugarRepository repo, IUserManager userManager, IWmsOutStockService wmsOutStockService, IQcCheckPlanService qcCheckPlanService)
+ : base(repo, userManager)
{
-
+ _wmsOutStockService = wmsOutStockService;
+ _qcCheckPlanService = qcCheckPlanService;
}
-
+ ///
+ /// 销售发货
+ ///
+ ///
+ ///
+ ///
+ ///
[HttpPost]
public async Task Sale(PurchaseAndReceiveUpInput input)
{
- return await PurchaseAndSaleUpdate(input);
- }
+ _ = await PurchaseAndSaleUpdate(input);
+ VisualDevModelDataCrInput visualDevModelDataInput = new();
+ visualDevModelDataInput.data = PocoToDictionary.ToDictionary(input) as Dictionary;
+ visualDevModelDataInput.data["location_id"] = "26412597341221";
+ visualDevModelDataInput.data["location_code"] = "YCL01-01-01";
+ (string pkId, List outStockDList) multi = await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput);
+
+ CreateTaskEntity ctEntity = new();
+ ctEntity.maintableid = multi.pkId;
+ ctEntity.materialids = multi.outStockDList?.Select(x => x.material_id!).ToList() ?? Array.Empty().ToList();
+ ctEntity.triggerevent = EnumTriggerEvent.出厂检按入厂频次;
+ _ = _qcCheckPlanService.CreateWmsTask(ctEntity);
+
+ return await Task.FromResult(1);
+ }
+ ///
+ /// 根据销售发货主表Id获取子表明细
+ ///
+ ///
+ ///
[HttpGet("id")]
public async Task GetSaleDetailsByBillId(string id)
{
return await GetDetailsByPkId(id);
}
+ ///
+ /// 审核反审核
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Audit(PurchaseAndSaleAuditUpInput input)
+ {
+ return await Audit(input);
+ }
+
+ ///
+ /// mes 检验完后通知wms(销售) 回调接口
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task MesCheckdSaleCallback(MesCheckdCallbackUpinput input)
+ {
+ return await UpdateChackStatus(input);
+ }
}
}
diff --git a/apihost/Tnb.API.Entry/Configurations/ElevatorControlSettings.json b/apihost/Tnb.API.Entry/Configurations/ElevatorControlSettings.json
index 33b95bee..caecf272 100644
--- a/apihost/Tnb.API.Entry/Configurations/ElevatorControlSettings.json
+++ b/apihost/Tnb.API.Entry/Configurations/ElevatorControlSettings.json
@@ -3,5 +3,6 @@
"token": "780BE4144636CF47DDF3920B0F1D069B",
"GetTagListUrl": "http://192.168.11.110:9100/Dev/GetTagList",
"GetTagUrl": "http://192.168.11.110:9100/Dev/GetTag",
- "WriteTagUrl": "http://192.168.11.110:9100/Dev/writeTag"
+ "WriteTagUrl": "http://192.168.11.110:9100/Dev/writeTag",
+ "Environment": ""
}
\ No newline at end of file