From 7ab32aab1cfd8b71940ade95fa69aec0b95e95c3 Mon Sep 17 00:00:00 2001
From: liudl <673013083@qq.com>
Date: 星期日, 16 二月 2025 16:36:40 +0800
Subject: [PATCH] Merge branch 'master' of http://47.95.120.53:8083/r/WCSNet6
---
Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs | 308 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 300 insertions(+), 8 deletions(-)
diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
index 6de853a..8890284 100644
--- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
+++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
@@ -1,4 +1,6 @@
-锘縰sing DocumentFormat.OpenXml.Presentation;
+锘縰sing Dm.filter;
+using DocumentFormat.OpenXml.Drawing.Charts;
+using DocumentFormat.OpenXml.Presentation;
using Elastic.Clients.Elasticsearch;
using Furion.Logging;
using Newtonsoft.Json;
@@ -85,7 +87,7 @@
result.Msg = "浠诲姟:" + models.TaskNo + ";宸插瓨鍦�!";
return result;
}
- if (models.TaskType == "0")
+ if (models.TaskType == "0" && models.TaskType == "0")
{
models.Order = 1;
}
@@ -93,11 +95,30 @@
{
models.Order = 2;
}
+ Enum type;
+ var bale = "0";
+ if (models.TaskType == "0" )
+ {
+ type = TaskTypeEnum.In;
+ }
+ else if (models.TaskType == "1")
+ {
+ type = TaskTypeEnum.Out;
+ }
+ else if (models.TaskType == "3")
+ {
+ type = TaskTypeEnum.In;
+ bale = "1";//瑁瑰寘
+ }
+ else
+ {
+ type = TaskTypeEnum.Move;
+ }
//鏂板浠诲姟
var taskAdd = new WcsTask()
{
TaskNo = models.TaskNo,
- TaskType = TaskTypeEnum.Out,
+ TaskType = (TaskTypeEnum?)type,
Status = TaskStatusEnum.Wait,
//IsSuccess =TaskSuccessEnum.Success,
Levels = 999,
@@ -107,6 +128,8 @@
EndLocate = models.EndLocate,
EndRoadway= models.EndRoadway,
PalletNo = models.PalletNo,
+ IsBale = bale,
+
//LotNo =models.LotNo,
//SkuNo=models.SkuNo,
@@ -124,7 +147,7 @@
}
/// <summary>
- /// WCS鎺ユ敹WMS涓嬪彂鐨勫叆搴撳崟浠诲姟
+ /// WCS鎺ユ敹WMS涓嬪彂鐨勫嚭鍏ュ簱鍗曚换鍔�
/// </summary>
/// <param name="models"></param>
/// <returns></returns>
@@ -137,12 +160,17 @@
{
foreach (var item in models)
{
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹WMS鎺ㄩ�佺殑绠辩爜淇℃伅锛�" + str);
// 楠岃瘉浠诲姟鏄惁宸插瓨鍦�
//var taskInfo = _db.Queryable<WcsOderTask>().First(w => w.OrderNo == item.OrderNo && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
//if (taskInfo == null)
//{
- var orderAdd = new WcsOderTask()
+ //var taskid = _db.Queryable<WcsOderTask>().OrderByDescending(w=>w.CreateTime).First();
+ //int newid = (int)taskid.Id + 1;
+ var orderAdd = new WcsOderTask()
{
+
OrderNo = item.OrderNo,
TaskNo = "",
LotNo = item.LotNo,
@@ -151,6 +179,8 @@
BoxType = item.BoxType,
Qty = item.Qty,
TaskType = (TaskTypeEnum)item.TaskType,
+ CreateTime = DateTime.Now,
+ Status = TaskStatusEnum.Wait,
};
_db.Insertable(orderAdd).ExecuteCommand();
//}
@@ -210,7 +240,7 @@
}
if (item.DelistList2.Count == 0)
{
- throw new Exception("鍊肩爜闆嗗悎涓嶈兘涓虹┖");
+ throw new Exception("鏀爜闆嗗悎涓嶈兘涓虹┖");
}
//浜岀骇鐮�
foreach (var item2 in item.DelistList2)
@@ -227,6 +257,11 @@
{
throw new Exception("鐢熶骇鏃ユ湡鎴栧け鏁堟棩鏈熸牸寮忛敊璇�");
};
+ DateTime? stortime = null;
+ if (!string.IsNullOrWhiteSpace(models.StoreTime))
+ {
+ stortime = DateTime.Parse(models.StoreTime);
+ }
var boxAdd = new WcsBoxInfo()
{
@@ -236,6 +271,7 @@
SkuName = models.SkuName,
Standard = models.Standard,
LotNo = models.LotNo,
+ LineNo = models.LineNo, // 浜х嚎鍙锋垨浜х嚎鍚嶇О
Qty = item2.Qty,
FullQty = models.FullQty,
//SupplierLot = models.SupplierLot,
@@ -244,14 +280,14 @@
//InspectStatus = models.InspectStatus锛�
ProductionTime = proTime,
ExpirationTime = expTime,
- StoreTime = DateTime.Parse(models.StoreTime),
+ StoreTime = stortime,
EndLotFlag = string.IsNullOrWhiteSpace(models.EndBatchMark) ? "0" : models.EndBatchMark,
BoxNo2 = item.BoxNo2,
BoxNo3 = item2.BoxNo3,
QtyCount = item2.QtyCount,
QtyOrd = item2.QtyOrd,
-
+
Status = "0",
Level = level,
@@ -276,4 +312,260 @@
}
}
+ /// <summary>
+ /// WCS鎺ュ彈璧嬬爜绯荤粺鎺ㄩ�佺殑绠辩爜绉婚櫎
+ /// </summary>
+ /// <param name="models">绠辩爜淇℃伅</param>
+ /// <returns>鍙嶉淇℃伅</returns>
+ [HttpPost]
+ [AllowAnonymous]
+ public ResponseFuMaModel DelgatesHttpBoxInfo(FumaBoxInfoInput models)
+ {
+
+ try
+ {
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹璧嬬爜鎺ㄩ�佺殑绠辩爜绉婚櫎锛�" + str);
+ var num = _db.Queryable<WcsBoxInfo>().Where(m => m.BoxNo == models.BoxNo && m.IsDelete == false).ToList();
+ if (num.Count > 0)
+ {
+ //WCS瀛樺湪绠辩爜淇℃伅锛屾洿鏂扮鐮佷俊鎭�(闇�鍒ゆ柇绠辩爜鏄惁宸茬粍鐩樺叆搴�)
+ var num2 = num.Count(m => m.Status != "0" || !string.IsNullOrWhiteSpace(m.PalletNo));
+ if (num2 > 0)
+ {
+ throw new Exception("璇ョ宸茬洏鍏ュ簱锛屼笉鍙洿鏂颁俊鎭�");
+ }
+ }
+ if (num.Count == 0)
+ {
+ throw new Exception("鏈壘鍒拌绠辩爜锛岀鐮佺Щ闄ゅけ璐ワ紒");
+ }
+
+ _db.Deleteable(num).ExecuteCommand();
+ return new ResponseFuMaModel() { Success = "0", Message = "绉婚櫎绠辩爜鎴愬姛" };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseFuMaModel() { Success = "-1", Message = ex.Message };
+ }
+ }
+
+ /// <summary>
+ /// WCS鎺ュ彈璧嬬爜绯荤粺鎺ㄩ�佺殑缁撴壒鎬绘暟閲�
+ /// </summary>
+ /// <param name="models">缁撴壒鏁伴噺淇℃伅</param>
+ /// <returns>鍙嶉淇℃伅</returns>
+ [HttpPost]
+ [AllowAnonymous]
+ public ResponseFuMaModel HttpTotalNum(FumaJiepiModel models)
+ {
+
+ try
+ {
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹璧嬬爜鎺ㄩ�佺殑瀹屽伐缁撴壒鎬绘暟閲忥細" + str);
+ //鏌ョ湅璧嬬爜涓嬪彂鐨勪换鍔′俊鎭槸鍚︽鍦ㄥ垎鎷�
+ var num = _db.Queryable<WcsCheckTask>().Where(m => m.SkuNo == models.SkuNo &&m.LotNo == models.LotNo && m.Status == "1").ToList();
+ if (num.Count < 1)
+ {
+ return new ResponseFuMaModel() { Success = "-1", Message = "璇ユ壒娆℃湭杩涜鍒嗘嫞鎴栧凡缁撴壒" };
+ }
+
+ //鑾峰彇鍖呰鏁伴噺
+ int Fqty = int.Parse(models.FinishQty);
+ var boxinfolog = _db.Queryable<WcsBoxInfoLog>().Where(m => m.SkuNo == models.SkuNo && m.LotNo == models.LotNo && m.BitBoxMark == "0").First();
+ if (boxinfolog == null)
+ {
+ var boxinfo = _db.Queryable<WcsBoxInfo>().Where(m => m.SkuNo == models.SkuNo && m.LotNo == models.LotNo && m.BitBoxMark == "0").First();
+ Fqty = (int)(Fqty /boxinfo.QtyCount);
+ }
+ else
+ {
+ Fqty = (int)(Fqty / boxinfolog.QtyCount);
+ }
+
+ //鍐欏叆璇ヤ换鍔″畬鎴愭暟閲�
+ foreach (var item in num)
+ {
+ item.FinishQty = Fqty;
+ }
+ _db.Updateable(num).ExecuteCommand();
+
+ return new ResponseFuMaModel() { Success = "0", Message = "鎺ュ彈瀹屽伐缁撴壒鏁伴噺鎴愬姛" };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseFuMaModel() { Success = "-1", Message = ex.Message };
+ }
+ }
+
+
+ /// <summary>
+ /// WCS鎺ュ彈WMS鍏ュ簱鏀捐揣纭鎺ュ彛
+ /// </summary>
+ /// <param name="models"></param>
+ /// <returns>鍙嶉淇℃伅</returns>
+ [HttpPost]
+ [AllowAnonymous]
+ public IsBaleModel2 HttpInConfirm(PortModel models)
+ {
+
+ try
+ {
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹WMS鍏ュ簱鏀捐揣纭锛屾斁璐у彛锛�" + models.Port+"鍏ュ簱鍙�");
+
+ var portno = "";
+ switch (models.Port)
+ {
+ case "033":
+ portno = "33";
+ break;
+ case "039":
+ portno = "39";
+ break;
+ case "044":
+ portno = "44";
+ break;
+ case "051":
+ portno = "51";
+ break;
+ }
+
+ //妫�娴嬪叆搴撳彛鐘舵�侊紝120涓哄彲鏀撅紝鍗犵敤鍒欎慨鏀逛负130
+
+ WcsDeviceDto mod = new WcsDeviceDto();
+ var plcConn = mod.PLCUtil;
+ //鑾峰彇宸ヤ綅鐐逛綅淇℃伅
+ var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.LedIP != null && s.StationNum == portno).First();
+ var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "PLC娴佺▼瀛�").First();
+
+ var (res1, val) = plcConn.GetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos);
+ if (val.ToString() == "120")
+ {
+ //璇诲彇鎴愬姛鍚庡啓鍏�130
+ modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS娴佺▼瀛�").First();
+ var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "130");//鍗犵敤姝ゅ伐浣�
+ if (ret.IsSucceed)
+ {
+ //鍥炰紶WMS鍙斁淇″彿
+ return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" };
+ }
+ }
+ return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" };
+ }
+ catch (Exception ex)
+ {
+ return new IsBaleModel2() { Success = -1, Message = ex.Message };
+ }
+ }
+
+
+ /// <summary>
+ /// WCS鎺ュ彈WMS鍏ュ簱鏀捐揣璇锋眰鎺ュ彛
+ /// </summary>
+ /// <param name="models"></param>
+ /// <returns>鍙嶉淇℃伅</returns>
+ [HttpPost]
+ [AllowAnonymous]
+ public IsBaleModel2 HttpInRequest(PortRequestModel models)
+ {
+ try
+ {
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹WMS鍏ュ簱鏀捐揣纭锛屾斁璐у彛锛�" + models.Port + "鍏ュ簱鍙�");
+
+ var portno = "";
+ switch (models.Port)
+ {
+ case "033":
+ portno = "33";
+ break;
+ case "039":
+ portno = "39";
+ break;
+ case "044":
+ portno = "44";
+ break;
+ case "051":
+ portno = "51";
+ break;
+ }
+
+ WcsDeviceDto mod = new WcsDeviceDto();
+ var plcConn = mod.PLCUtil;
+ //鑾峰彇宸ヤ綅鐐逛綅淇℃伅
+ var listPlcDevice = _db.Queryable<WcsDevice>().Where(s=>s.LedIP != null && s.StationNum == portno).First();
+ var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "浠诲姟鍙�").First();
+ plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, models.TaskNo);//鍐欏叆浠诲姟鍙�
+ //
+ modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS娴佺▼瀛�").First();
+ var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "140");//鍐欏叆寮�濮嬫斁璐т俊鍙�
+ if (ret.IsSucceed)
+ {
+ //鍥炰紶WMS鏀捐揣淇″彿
+ return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" };
+ }
+ return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" };
+ }
+ catch (Exception ex)
+ {
+ return new IsBaleModel2() { Success = -1, Message = ex.Message };
+ }
+ }
+
+
+
+ /// <summary>
+ /// WCS鎺ュ彈WMS灏忚溅鏀惧畬鎴愭帴鍙�
+ /// </summary>
+ /// <param name="models"></param>
+ /// <returns>鍙嶉淇℃伅</returns>
+ [HttpPost]
+ [AllowAnonymous]
+ public IsBaleModel2 HttpInFinish(PortModel models)
+ {
+
+ try
+ {
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹WMS鍏ュ簱鏀捐揣纭锛屾斁璐у彛锛�" + models.Port + "鍏ュ簱鍙�");
+
+ var portno = "";
+ switch (models.Port)
+ {
+ case "033":
+ portno = "33";
+ break;
+ case "039":
+ portno = "39";
+ break;
+ case "044":
+ portno = "44";
+ break;
+ case "051":
+ portno = "51";
+ break;
+ }
+
+ WcsDeviceDto mod = new WcsDeviceDto();
+ var plcConn = mod.PLCUtil;
+ //鑾峰彇宸ヤ綅鐐逛綅淇℃伅
+ var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.LedIP != null && s.StationNum == portno).First();
+ var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS娴佺▼瀛�").First();
+
+ var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "160");//鏀惧畬鎴�
+ if (ret.IsSucceed)
+ {
+ //鍥炰紶WMS鏀捐揣淇″彿
+ return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" };
+ }
+ return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" };
+ }
+ catch (Exception ex)
+ {
+ return new IsBaleModel2() { Success = -1, Message = ex.Message };
+ }
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0