From 1650f3fe1467d21074b597042861c46f3a8c4447 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期二, 01 四月 2025 10:11:24 +0800
Subject: [PATCH] 问题修改
---
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 447 +++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 367 insertions(+), 80 deletions(-)
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 47e501b..491e79b 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -24,6 +24,7 @@
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Net.WebSockets;
+using WMS.BLL.SysServer;
namespace WMS.BLL.BllPdaServer
{
@@ -43,7 +44,7 @@
try
{
//model.Type锛氬崟鎹被鍨� 鍦ㄨ繖閲屼唬琛ㄥ墠绔〉绛剧被鍨嬶細鍗虫爣绛鹃〉绛撅細璐存爣鐗╂枡锛� 鏁伴噺椤电锛氫笉璐磋〃鐗╂枡锛屽師鍥狅細鎳掑緱鍔犲弬鏁�
- var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status != "3" && m.Status != "4").Select(m => m.ASNNo).ToList();
+ var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status !="2" && m.Status != "3" && m.Status != "4").Select(m => m.ASNNo).ToList();
var list = new List<ArrivalNoticeDetailDto>();
if (model.Type.Contains("0"))//0璐存爣
{
@@ -266,6 +267,42 @@
}
}
+
+
+ /// <summary>
+ /// 楠岃瘉鍦扮爜鏄惁瀛樺湪
+ /// </summary>
+ /// <param name="locatNo">鍦扮爜</param>
+ /// <returns>"":鍙娇鐢� -1:涓嶅彲浣跨敤锛堝師鍥�)</returns>
+ public string IsEnableLocatNo(string locatNo)
+ {
+ string sqlMsg = "";
+ string sqlString = string.Empty;
+ try
+ {
+ sqlString = $"select * from SysStorageLocat where LocatNo = '{locatNo}' and WareHouseNo = 'W02' and isdel = '0';";
+ var models = Db.Ado.SqlQuery<PalletBindVm>(sqlString);
+
+ if (models.Count > 0)
+ {
+ if (models[0].Status != "0")
+ {
+ sqlMsg = "-1:姝ゅ簱浣嶄娇鐢ㄤ腑锛岃鍦ㄥ簱鍐呰鏍稿疄!";
+ }
+ }
+ else
+ {
+ sqlMsg = "-1:搴撲綅涓嶅瓨鍦�!";
+ }
+
+ return sqlMsg;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
// 鏍规嵁绠辩爜鎴栨墭鐩樺彿鑾峰彇绠辨敮淇℃伅 liudl
public List<BoxInfoDto> GetBoxInfos(BoxInfoVm model)
{
@@ -333,6 +370,7 @@
public string BindNullPallet(PalletBindVm model)
{
string strMsg = "";
+ string type = model.BindType == "0" ? "PDA" : "鍙犳墭鏈�";
try
{
var datetime = Db.GetDate();
@@ -440,7 +478,7 @@
LotText = "",
SupplierLot = "",
InspectStatus = "1",
- Origin = "PDA",
+ Origin = type,
BoxNo = "",
BoxNo2 = "",
BoxNo3 = "",
@@ -461,6 +499,120 @@
// 鎻掑叆鎿嶄綔鏃ュ織
new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "绌烘墭鍏ュ簱", model.PalletNo, "娣诲姞", $"鍦≒DA涓婃坊鍔犱簡绌烘墭鐩樿泛", (int)model.CreateUser);
+
+ return strMsg;
+ }
+ catch (Exception ex)
+ {
+ Db.Ado.RollbackTran();
+ throw ex;
+ }
+ }
+
+ // 鍙犳墭鏈虹粦瀹氱┖鎵樼洏
+ public string BindNullPallets(PalletsBind model)
+ {
+ string strMsg = "";
+ string type = model.BindType == "0" ? "PDA" : "鍙犳墭鏈�";
+ try
+ {
+ var datetime = Db.GetDate();
+
+ //鑾峰彇鎵樼洏缁戝畾淇℃伅
+ string str = "select * from BllPalletBind where IsDel = '0' and PalletNo = @palletno and Status = '0' ";
+ List<PalletBindVm> list = Db.Ado.SqlQuery<PalletBindVm>(str, new
+ {
+ palletno = model.PalletNo //鎵樼洏鍙�
+ });
+ //鍒ゆ柇鏄惁宸茬粦瀹氳鎵樼洏
+ if (list.Count > 0)
+ {
+ strMsg = "-1:璇ユ墭鐩樺凡琚粦瀹�!";
+ return strMsg;
+ }
+ if (string.IsNullOrEmpty(model.PalletNo))
+ {
+ strMsg = "-1:鎵樼洏鍙蜂笉鍙负绌�!";
+ return strMsg;
+ }
+ if (model.Qty == null || model.Qty == 0)
+ {
+ strMsg = "-1:绌烘墭鐩樻暟閲忎笉鍙负绌�!";
+ return strMsg;
+ }
+ //鑾峰彇鎵樼洏淇℃伅
+ var pallet = Db.Queryable<SysPallets>().First(a => a.IsDel == "0" && a.PalletNo == model.PalletNo);
+
+ if (pallet == null)
+ {
+ strMsg = "-1:鎵樼洏淇℃伅涓虹┖!";
+ return strMsg;
+ }
+ if (pallet.Status != "0")
+ {
+ strMsg = "-1:璇ユ墭鐩樻鍦ㄤ娇鐢�!";
+ return strMsg;
+ }
+
+ Db.BeginTran();
+
+ // 鎻掑叆鎵樼洏缁戝畾琛�
+ var modelpb = new BllPalletBind
+ {
+ ASNNo = "",
+ ASNDetailNo = 0,
+ TaskNo = "", //浠诲姟鍙�
+ PalletNo = model.PalletNo,
+ Qty = (int)model.Qty,
+ Status = "0", //绛夊緟鎵ц
+ Type = "1", //0 鐗╂枡鎵� 1 绌烘墭
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ InspectMark = "0", //0 鍚� 1 鏄�
+ BitPalletMark = "0",
+ IsBale = "0",
+ IsBelt = "0",
+ CreateTime = Db.GetDate()
+ };
+ var id = Db.Insertable(modelpb).ExecuteReturnIdentity();
+
+ var modelbb = new BllBoxInfo
+ {
+ ASNNo = "",
+ ASNDetailNo = null,
+ BindNo = id,
+ PalletNo = model.PalletNo,
+ Status = "1",
+ CompleteTime = DateTime.Now,
+ Qty = (int)model.Qty,
+ FullQty = null,
+ SkuNo = "100099",
+ SkuName = "鎵樼洏",
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ InspectStatus = "1",
+ Origin = type,
+ BoxNo = "",
+ BoxNo2 = "",
+ BoxNo3 = "",
+ InspectMark = "",
+ BitBoxMark = "0",
+
+ CreateTime = datetime
+ };
+ Db.Insertable(modelbb).ExecuteCommand();
+
+
+ // 鏇存敼鎵樼洏浣跨敤鐘舵��
+ string sqlStr = string.Empty;
+ sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
+ Db.Ado.ExecuteCommand(sqlStr);
+ Db.CommitTran();
+
+ // 鎻掑叆鎿嶄綔鏃ュ織
+ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "绌烘墭鍏ュ簱", model.PalletNo, "娣诲姞", $"鍦≒DA涓婃坊鍔犱簡绌烘墭鐩樿泛", 1);
return strMsg;
}
@@ -1646,8 +1798,8 @@
SupplierLot = "",
InspectMark = "0",
BitPalletMark = "1",
- IsBale = "0",
- IsBelt = "0",
+ IsBale = arrivalnotice.IsBale,
+ IsBelt = arrivalnotice.IsBelt,
CreateUser = userId
};
// 鎻掑叆鎵樼洏缁戝畾琛�
@@ -1720,8 +1872,8 @@
BitPalletMark = "1",
InspectStatus = sku.IsInspect,// 缁勭洏鐨勬椂鍊欏氨瑕侀粯璁よ瀹氬ソ鏄惁鍚堟牸
PackagNo = sku.PackagNo,
- IsBale = null,
- IsBelt = null,
+ IsBale = arrivalnotice.IsBale,
+ IsBelt = arrivalnotice.IsBelt,
CreateUser = userId,
CreateTime = serverTime
};
@@ -1794,10 +1946,18 @@
#region 浜у搧缁勬墭
- public void GetBoxInfoByFuMa(string boxNo,string url)
+ public void GetBoxInfoByFuMa(string boxNo,string url,string fuMaTokenUrl,string levelType)
{
try
{
+ if (levelType == "0")
+ {
+ throw new Exception("鏈壘鍒拌鐗╂枡鐨勭鍖呰绾у埆");
+ }
+ if (levelType == "3")
+ {
+ throw new Exception("鏈皟璇曡绾у埆鍖呰锛�");
+ }
var list = new List<BllBoxInfo>();
var data = new { BoxNo = boxNo };
@@ -1805,83 +1965,194 @@
#region 娴嬭瘯鐗堟湰
- //璇诲彇json鏂囦欢锛屾坊鍔犳暟鎹�
- var ss = AppDomain.CurrentDomain.BaseDirectory;
- string filePath = Path.Combine(ss, "CreateBoxInfo.json");
- string json = File.ReadAllText(filePath);
- var person = JsonConvert.DeserializeObject<List<BllBoxInfo>>(json);
+ ////璇诲彇json鏂囦欢锛屾坊鍔犳暟鎹�
+ //var ss = AppDomain.CurrentDomain.BaseDirectory;
+ //string filePath = Path.Combine(ss, "CreateBoxInfo.json");
+ //string json = File.ReadAllText(filePath);
+ //var person = JsonConvert.DeserializeObject<List<BllBoxInfo>>(json);
var comTime = DateTime.Now;
- //娣诲姞绠辩爜淇℃伅琛ㄤ腑 //鏆傛椂杩欎簺鍐�--娣诲姞鏁版嵁锛屽悗缁渶瑕佸拰璧嬬爜绯荤粺瀵规帴鍚� 鏍规嵁鏄庣‘杩斿洖鐨勬暟鎹牸寮忔洿鏀�
- foreach (var item in person)
- {
- if (item.BoxNo!= boxNo)
- {
- continue;
- }
+ ////娣诲姞绠辩爜淇℃伅琛ㄤ腑 //鏆傛椂杩欎簺鍐�--娣诲姞鏁版嵁锛屽悗缁渶瑕佸拰璧嬬爜绯荤粺瀵规帴鍚� 鏍规嵁鏄庣‘杩斿洖鐨勬暟鎹牸寮忔洿鏀�
+ //foreach (var item in person)
+ //{
+ // if (item.BoxNo!= boxNo)
+ // {
+ // continue;
+ // }
- var sku = Db.Queryable<SysMaterials>().First(m=>m.IsDel =="0" && m.SkuNo == item.SkuNo);
- if (sku == null)
- {
- continue;
- }
- var boxInfo = new BllBoxInfo()
- {
- ASNNo = "",
- //ASNDetailNo = 0,
- OrderCode = "",
- //BindNo = 0,
- BoxNo = item.BoxNo,
- BoxNo2 = item.BoxNo2,
- BoxNo3 = item.BoxNo3,
- PalletNo = "",
- Qty = item.Qty,
- FullQty = item.FullQty,
- Status = "0",
- SkuNo = item.SkuNo,
- SkuName = sku.SkuName,
- LotNo = item.LotNo,
- LotText = item.LotText,
- SupplierLot = item.SupplierLot,
- ProductionTime = item.ProductionTime,
- ExpirationTime = item.ExpirationTime,
- //CompleteTime = comTime,
- InspectMark = item.InspectMark,
- BitBoxMark = item.BitBoxMark,
- InspectStatus = item.InspectStatus,
- Origin = "璧嬬爜",
- Standard = item.Standard,
- PackageStandard = item.PackageStandard,
- StoreTime = item.StoreTime,
- QtyOrd = item.QtyOrd,
- QtyCount = item.QtyCount,
- CreateUser = 0,
- CreateTime = comTime,
- };
- list.Add(boxInfo);
- }
- Db.Insertable(list).ExecuteCommand();
+ // var sku = Db.Queryable<SysMaterials>().First(m=>m.IsDel =="0" && m.SkuNo == item.SkuNo);
+ // if (sku == null)
+ // {
+ // continue;
+ // }
+ // var boxInfo = new BllBoxInfo()
+ // {
+ // ASNNo = "",
+ // //ASNDetailNo = 0,
+ // OrderCode = "",
+ // //BindNo = 0,
+ // BoxNo = item.BoxNo,
+ // BoxNo2 = item.BoxNo2,
+ // BoxNo3 = item.BoxNo3,
+ // PalletNo = "",
+ // Qty = item.Qty,
+ // FullQty = item.FullQty,
+ // Status = "0",
+ // SkuNo = item.SkuNo,
+ // SkuName = sku.SkuName,
+ // LotNo = item.LotNo,
+ // LotText = item.LotText,
+ // SupplierLot = item.SupplierLot,
+ // ProductionTime = item.ProductionTime,
+ // ExpirationTime = item.ExpirationTime,
+ // //CompleteTime = comTime,
+ // InspectMark = item.InspectMark,
+ // BitBoxMark = item.BitBoxMark,
+ // InspectStatus = item.InspectStatus,
+ // Origin = "璧嬬爜",
+ // Standard = item.Standard,
+ // PackageStandard = item.PackageStandard,
+ // StoreTime = item.StoreTime,
+ // QtyOrd = item.QtyOrd,
+ // QtyCount = item.QtyCount,
+ // CreateUser = 0,
+ // CreateTime = comTime,
+ // };
+ // list.Add(boxInfo);
+ //}
+ //Db.Insertable(list).ExecuteCommand();
#endregion
#region 姝e紡鐗堟湰
+ var token = new Token().GetFuMaToken(fuMaTokenUrl);
+ var getParentVal = levelType == "1" ? "true" : "false";
+ var getChildrenVal = levelType == "2" ? "true" : "false";
+ Dictionary<string, string> paramDic = new Dictionary<string, string>
+ {
+ { "Token", token }, //鍒嗛厤鐨勪护鐗岋紙鍙橀噺锛�
+ { "Barcode", boxNo },//瑕佹煡璇㈢殑鏉$爜
+ { "getParent", getParentVal },//鏄惁鏌ヨ鐖剁爜
+ { "getChildren", getChildrenVal } //鏄惁鏌ヨ瀛愮爜 aaa
+ };
+ //绋嬪簭姝e紡鍙戝竷鍚庢斁寮�
+ var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+ var response = HttpHelper.DoGet(url, "璧嬬爜", "鑾峰彇绠辩爜淇℃伅", paramDic);
+ var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
- ////绋嬪簭姝e紡鍙戝竷鍚庢斁寮�
- //var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
- //var response = HttpHelper.DoPost(url, jsonData, "鑾峰彇绠辩爜淇℃伅", "璧嬬爜");
- //var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
+ //瑙f瀽杩斿洖鏁版嵁
+ var fuMaModel = JsonConvert.DeserializeObject<FuMaGetBoxModel>(response);
+ if (fuMaModel.IsSuccess)
+ {
+ //璧嬬爜杩斿洖淇℃伅鎴愬姛鐘舵��
+ if (fuMaModel.Product == null || fuMaModel.Barcodes.Count == 0)
+ {
+ throw new Exception("浜у搧淇℃伅鎴栫鏀俊鎭负绌�");
+ }
- ////瑙f瀽杩斿洖鏁版嵁
- //var fuMaModel = JsonConvert.DeserializeObject<FuMaModel>(response);
- //if (fuMaModel.Success == 0)
- //{
+ if (levelType == "1")
+ {
+ if (fuMaModel.Barcodes.First().Barcode != boxNo)
+ {
+ throw new Exception("鑾峰彇淇℃伅涓嶄竴鑷�");
+ }
- //}
- //if (fuMaModel.Success == -1)
- //{
- // throw new Exception($"璧嬬爜绯荤粺杩斿洖鐘舵�佸紓甯革細{fuMaModel.Message}");
- //}
+ var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == fuMaModel.MaterialNum);
+ if (sku == null)
+ {
+ throw new Exception("鏈煡璇㈠埌绠辩爜涓拰璧嬬爜鎻愪緵鐨勭墿鏂欎俊鎭竴鑷寸殑鏁版嵁");
+ }
+ var boxInfo = new BllBoxInfo()
+ {
+ ASNNo = "",
+ //ASNDetailNo = 0,
+ OrderCode = "",
+ //BindNo = 0,
+ BoxNo = fuMaModel.Barcodes.First().Barcode,
+ PalletNo = "",
+ Qty = fuMaModel.Barcodes.First().BoxItemQty,
+ FullQty = fuMaModel.BoxItemQty,
+ Status = "0",
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ LotNo = fuMaModel.Barcodes.First().BatchNo,
+ //LotText = "",
+ //SupplierLot = item.SupplierLot,
+ ProductionTime = DateTime.Parse(fuMaModel.Barcodes.First().ProductionDate),
+ ExpirationTime = DateTime.Parse(fuMaModel.Barcodes.First().ExpirationDate),
+ //CompleteTime = comTime,
+ InspectMark = "0",
+ BitBoxMark = fuMaModel.Barcodes.First().Status == "闆剁" ? "1" : "0",
+ InspectStatus = "0",
+ Origin = "璧嬬爜",
+ Standard = fuMaModel.Product.Spec,
+ PackageStandard = fuMaModel.Product.PackageSpec,
+ //StoreTime = item.StoreTime,
+ //QtyOrd = item.QtyOrd,
+ //QtyCount = item.QtyCount,
+ CreateUser = 0,
+ CreateTime = comTime,
+ };
+ list.Add(boxInfo);
+ }
+ else
+ {
+ foreach (var item in fuMaModel.Barcodes)
+ {
+ if (item.Barcode == boxNo)
+ {
+ continue; //鑾峰彇鏀爜鏃剁涓�涓爜涓虹埗鐮�
+ }
+
+ var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == fuMaModel.MaterialNum);
+ if (sku == null)
+ {
+ throw new Exception("鏈煡璇㈠埌绠辩爜涓拰璧嬬爜鎻愪緵鐨勭墿鏂欎俊鎭竴鑷寸殑鏁版嵁");
+ }
+ var boxInfo = new BllBoxInfo()
+ {
+ ASNNo = "",
+ //ASNDetailNo = 0,
+ OrderCode = "",
+ //BindNo = 0,
+ BoxNo = item.ParentBarcode,
+ BoxNo3 = item.Barcode,
+ PalletNo = "",
+ Qty = item.MinLevelCount,
+ FullQty = fuMaModel.BoxItemQty,
+ Status = "0",
+ SkuNo = sku.SkuNo,
+ SkuName = sku.SkuName,
+ LotNo = item.BatchNo,
+ //LotText = "",
+ //SupplierLot = item.SupplierLot,
+ ProductionTime = DateTime.Parse(item.ProductionDate),
+ ExpirationTime = DateTime.Parse(item.ExpirationDate),
+ //CompleteTime = comTime,
+ InspectMark = "0",
+ BitBoxMark = item.Status == "闆剁" ? "1" : "0",
+ InspectStatus = "0",
+ Origin = "璧嬬爜",
+ Standard = fuMaModel.Product.AuthorizedNo,
+ PackageStandard = fuMaModel.Product.PackageSpec,
+ //StoreTime = item.StoreTime,
+ //QtyOrd = item.QtyOrd,
+ QtyCount = (int)fuMaModel.BoxItemQty,
+ CreateUser = 0,
+ CreateTime = comTime,
+ };
+ list.Add(boxInfo);
+ }
+ }
+
+ Db.Insertable(list).ExecuteCommand();
+ }
+ else
+ {
+ //璧嬬爜杩斿洖淇℃伅澶辫触鐘舵��
+ throw new Exception($"璧嬬爜绯荤粺杩斿洖鐘舵�佸紓甯革細{fuMaModel.Message}");
+ }
#endregion
}
@@ -1896,7 +2167,7 @@
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
- public List<BoxInfoDto> GetBindBoxInfos(BoxInfoVm model)
+ public List<BoxInfoDto> GetBindBoxInfos(BoxInfoVm model, string url, string fuMaTokenUrl)
{
try
{
@@ -1916,7 +2187,22 @@
var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo == model.BoxNo);
if (count == 0)
{
- GetBoxInfoByFuMa(model.BoxNo, ""); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ //鑾峰彇鐗╂枡鍖呰绾у埆
+ string level = "0";
+ var levelType = Db.Queryable<SysPackag>().First(w => w.IsDel == "0" && w.PackagNo == detail.SkuNo);
+ if (levelType.L1Name == "绠�")
+ {
+ level = "1";
+ }
+ if (levelType.L2Name == "绠�")
+ {
+ level = "2";
+ }
+ if (levelType.L3Name == "绠�")
+ {
+ level = "3";
+ }
+ GetBoxInfoByFuMa(model.BoxNo, url, fuMaTokenUrl, level); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
}
}
}
@@ -1953,7 +2239,7 @@
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
- public List<BoxInfoDto> GetBindBoxInfo2s(BoxInfoVm model)
+ public List<BoxInfoDto> GetBindBoxInfo2s(BoxInfoVm model, string url, string fuMaTokenUrl)
{
try
{
@@ -2019,8 +2305,8 @@
}
else
{
- // GetBoxInfoByFuMa(model.BoxNo3, ""); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
- }
+ GetBoxInfoByFuMa(model.BoxNo3, url, fuMaTokenUrl,"3"); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ }
}
}
}
@@ -2367,6 +2653,7 @@
DateTime proTime;
DateTime expTime;
+ DateTime sortTime;
var bl1 = DateTime.TryParse(detail.Lot1, out proTime);
var bl2 = DateTime.TryParse(detail.Lot2, out expTime);
@@ -2395,8 +2682,8 @@
SupplierLot = detail.SupplierLot,
InspectMark = "0",
BitPalletMark = "1",
- IsBale = "0",
- IsBelt = "0",
+ IsBale = detail.IsBale,
+ IsBelt = detail.IsBelt,
CreateUser = userId,
Demo = model.Demo,
--
Gitblit v1.8.0