From f2b3c45b78bb9fc021869c4ae35e6de039b50bbf Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期五, 18 十月 2024 18:40:52 +0800
Subject: [PATCH] 修改问题
---
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 303 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 221 insertions(+), 82 deletions(-)
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index fdbe63d..bb09e1f 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -29,17 +29,117 @@
{
private static readonly SqlSugarScope Db = DataContext.Db;
+ #region 淇敼鎵樼洏缁戝畾鏃跺叆搴撳崟鍘婚櫎鍙樹负鐗╂枡+鏁伴噺
+
+ /// <summary>
+ /// 鑾峰彇鍗曟嵁鏄庣粏鏄剧ず鐨勭墿鏂�
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ public List<ArrivalNoticeDetailDto> GetArrivalNoticesInfo(ArrivalNoticeVm model)
+ {
+ 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 list = new List<ArrivalNoticeDetailDto>();
+ if (model.Type.Contains("0"))//0璐存爣
+ {
+ list = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && data.Contains(m.ASNNo) && !string.IsNullOrWhiteSpace(m.PackagNo)).Select(m => new ArrivalNoticeDetailDto()).ToList();
+ }
+ else if (model.Type.Contains("1"))//1涓嶈创鏍�
+ {
+ list = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && data.Contains(m.ASNNo) && string.IsNullOrWhiteSpace(m.PackagNo)).Select(m=>new ArrivalNoticeDetailDto()).ToList();
+ }
+ else
+ {
+ throw new Exception("椤电绫诲瀷鍙傛暟閿欒");
+ }
+
+ List<ArrivalNoticeDetailDto> noticeList = new List<ArrivalNoticeDetailDto>();
+ foreach (var item in list)
+ {
+ if (string.IsNullOrEmpty(item.LotNo))
+ {
+ noticeList.Add(item);
+ }
+ else
+ {
+ string[] LotNoList = item.LotNo.Split(';');
+ foreach (var item2 in LotNoList)
+ {
+ ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto()
+ {
+ Id = item.Id,
+ ASNNo = item.ASNNo,
+ CompleteQty = item.CompleteQty,
+ CompleteTime = item.CompleteTime,
+ CreateTime = item.CreateTime,
+ Qty = item.Qty,
+ FactQty = item.FactQty,
+ LotNo = item2,
+ Money = item.Money,
+ PackagNo = item.PackagNo,
+ PackagName = item.PackagName,
+ Status = item.Status,
+ SkuNo = item.SkuNo,
+ SkuName = item.SkuName,
+ };
+
+
+ noticeList.Add(entry);
+ }
+ }
+ }
+ //List<ArrivalNoticeDetailDto> list = new List<ArrivalNoticeDetailDto>();
+ //foreach (var item in noticeList)
+ //{
+ // string str = BySkuNoGetPackInfo(item.SkuNo);
+ // if (str == "瀛樺湪")
+ // {
+ // list.Add(item);
+ // }
+ //}
+
+ return noticeList;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+
+ #endregion
+
// 鑾峰彇鍗曟嵁鍒楄〃
- public List<ArrivalNoticeDto> GetArrivalNotices(ArrivalNoticeVm model)
+ public List<string> GetArrivalNotices(ArrivalNoticeVm model)
{
string sqlString = string.Empty;
try
{
// 鏈叧鍗曠殑鍗曟嵁
- sqlString = $"select * from BllArrivalNotice where Type in ({model.Type}) and Status != '3' and Status != '4' and IsDel='0' order by CreateTime;";
- var modelList = Db.Ado.SqlQuery<ArrivalNoticeDto>(sqlString);
+ //sqlString = $"select * from BllArrivalNotice where Type in ({model.Type}) and Status != '3' and Status != '4' and IsDel='0' order by CreateTime;";
+ //var modelList = Db.Ado.SqlQuery<ArrivalNoticeDto>(sqlString);
- return modelList;
+ //model.Type锛氬崟鎹被鍨� 鍦ㄨ繖閲屼唬琛ㄥ墠绔〉绛剧被鍨嬶細鍗虫爣绛鹃〉绛撅細璐存爣鐗╂枡锛� 鏁伴噺椤电锛氫笉璐磋〃鐗╂枡锛屽師鍥狅細鎳掑緱鍔犲弬鏁�
+ var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status != "3" && m.Status != "4").Select(m=>m.ASNNo).ToList();
+ var list = new List<string>();
+ if (model.Type.Contains("0"))//0璐存爣
+ {
+ list = Db.Queryable<BllArrivalNoticeDetail>().Where(m =>m.IsDel == "0" && data.Contains(m.ASNNo) && !string.IsNullOrWhiteSpace(m.PackagNo)).Select(m => m.ASNNo).Distinct().ToList();
+ }
+ else if(model.Type.Contains("1"))//1涓嶈创鏍�
+ {
+ list = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && data.Contains(m.ASNNo) && string.IsNullOrWhiteSpace(m.PackagNo)).Select(m=>m.ASNNo).Distinct().ToList();
+ }
+ else
+ {
+ throw new Exception("椤电绫诲瀷鍙傛暟閿欒");
+ }
+
+
+ return list;
}
catch (Exception ex)
{
@@ -1699,9 +1799,73 @@
var data = new { BoxNo = boxNo };
var jsonData = JsonConvert.SerializeObject(data);
+ #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);
+
+ var comTime = DateTime.Now;
+ //娣诲姞绠辩爜淇℃伅琛ㄤ腑 //鏆傛椂杩欎簺鍐�--娣诲姞鏁版嵁锛屽悗缁渶瑕佸拰璧嬬爜绯荤粺瀵规帴鍚� 鏍规嵁鏄庣‘杩斿洖鐨勬暟鎹牸寮忔洿鏀�
+ 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();
+
+ #endregion
+
+ #region 姝e紡鐗堟湰
+
+
////绋嬪簭姝e紡鍙戝竷鍚庢斁寮�
//var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
- //var response = HttpHelper.DoPost(url, jsonData,"鑾峰彇绠辩爜淇℃伅", "璧嬬爜");
+ //var response = HttpHelper.DoPost(url, jsonData, "鑾峰彇绠辩爜淇℃伅", "璧嬬爜");
//var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
////瑙f瀽杩斿洖鏁版嵁
@@ -1709,55 +1873,13 @@
//if (fuMaModel.Success == 0)
//{
- var datas = Assembly.GetExecutingAssembly();
- var s = "0";
- //string filePath = "Assembly.GetExecutingAssembly()";
- //string json = File.ReadAllText(filePath);
- //var person = JsonConvert.DeserializeObject<BllBoxInfo>(json);
-
- //var comTime = DateTime.Now;
- ////娣诲姞绠辩爜淇℃伅琛ㄤ腑 //鏆傛椂杩欎簺鍐�--娣诲姞鏁版嵁锛屽悗缁渶瑕佸拰璧嬬爜绯荤粺瀵规帴鍚� 鏍规嵁鏄庣‘杩斿洖鐨勬暟鎹牸寮忔洿鏀�
- //var boxInfo = new BllBoxInfo()
- //{
- // ASNNo = "",
- // //ASNDetailNo = 0,
- // OrderCode = "",
- // //BindNo = 0,
- // BoxNo = person.BoxNo,
- // BoxNo2 = "",
- // BoxNo3 = "",
- // PalletNo = "",
- // Qty = 0,
- // FullQty = 0,
- // Status = "0",
- // SkuNo = "",
- // SkuName = "",
- // LotNo = "",
- // LotText = "",
- // SupplierLot = "",
- // ProductionTime = DateTime.Now,
- // ExpirationTime = DateTime.Now,
- // //CompleteTime = comTime,
- // InspectMark = "0",
- // BitBoxMark = "0",
- // InspectStatus = "0",
- // Origin = "璧嬬爜",
- // Standard = "box.Standard",
- // PackageStandard = "box.PackageStandard",
- // StoreTime = DateTime.Now,
- // CreateUser = 0,
- // CreateTime = comTime,
- //};
- //Db.Insertable(boxInfo).ExecuteCommand();
-
//}
//if (fuMaModel.Success == -1)
//{
// throw new Exception($"璧嬬爜绯荤粺杩斿洖鐘舵�佸紓甯革細{fuMaModel.Message}");
//}
-
+ #endregion
-
}
catch (Exception e)
{
@@ -1778,12 +1900,19 @@
{
throw new Exception("璇锋壂鎻忓绠辨潯鐮�!");
}
- var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo == model.BoxNo);
- if (count == 0)
+ if (!string.IsNullOrWhiteSpace(model.ASNNo))
{
- GetBoxInfoByFuMa("",""); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ var asnData = Db.Queryable<BllArrivalNotice>().First(m => m.IsDel == "0" && m.ASNNo == model.ASNNo);
+ if (asnData != null && (asnData.Type == "0" || asnData.Type == "3"))
+ {
+ var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo == model.BoxNo);
+ if (count == 0)
+ {
+ GetBoxInfoByFuMa(model.BoxNo, ""); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+ }
+ }
+
}
-
string sqlString = $@"SELECT
ASNNo,
BoxNo,
@@ -1797,7 +1926,7 @@
AND BoxNo = '{model.BoxNo}'
GROUP BY ASNNo,BoxNo,SkuNo,SkuName,LotNo; ";
var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString);
- if (models == null)
+ if (models.Count == 0)
{
throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
}
@@ -1909,18 +2038,27 @@
if (string.IsNullOrEmpty(model.AsnNo))
{
- throw new Exception("-1:鍗曟嵁鍙蜂笉鍙负绌�!");
+ throw new Exception("-1:鐗╂枡鏄庣粏涓嶅彲涓虹┖!");
}
- if (model.AsnDetailId == null || model.AsnDetailId == 0)
- {
- throw new Exception("-1:鐗╂枡涓嶅彲涓虹┖!");
- }
+ //if (model.AsnDetailId == null || model.AsnDetailId == 0)
+ //{
+ // throw new Exception("-1:鐗╂枡鏄庣粏涓嶅彲涓虹┖!");
+ //}
if (string.IsNullOrEmpty(model.PalletNo))
{
throw new Exception("-1:鎵樼洏鍙蜂笉鍙负绌�!");
}
+ var detailId = model.AsnNo.Split("-");
+ model.AsnDetailId = int.Parse(detailId[0]);
+ // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
+ var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId);
+ if (detail == null)
+ {
+ throw new Exception("-1:褰撳墠鐗╂枡鏈煡璇㈠埌鍗曟嵁锛岃鏍稿疄!");
+ }
+ model.AsnNo = detail.ASNNo;
//鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
- var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo);
+ var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == detail.ASNNo);
if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
{
throw new Exception("-1:璇ュ崟鎹凡鍏冲崟!");
@@ -1937,10 +2075,11 @@
else
{
//浠庣墿鏂欏悕绉�-鎵规涓彇鍑烘壒娆�
- int indexOfDash = model.LotNo.IndexOf("-");
- if (indexOfDash != -1)
+ var indexOfDash = model.LotNo.Split("-");
+ var len = indexOfDash.Length;
+ if (len >= 1)
{
- model.LotNo = model.LotNo.Substring(indexOfDash + 1);
+ model.LotNo =indexOfDash[len-1];
}
else
{
@@ -2027,12 +2166,7 @@
{
throw new Exception("璇ユ墭鐩樺湪搴撳瓨宸叉湁淇℃伅锛岃鏍稿疄锛�");
}
- // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
- var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
- if (detail == null)
- {
- throw new Exception("-1:褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
- }
+
#region 鍖呰
var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0");
var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo);
@@ -2201,29 +2335,29 @@
factQty += box.Qty;
boxFullQty += box.Qty;
}
- if (boxFullQty > bNum)
- {
- throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
- }
+ //if (boxFullQty > bNum)
+ //{
+ // throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
+ //}
}
Db.Updateable(boxInfoList).ExecuteCommand();
// 鏇存柊鎵樼洏缁戝畾琛�
bind.Qty += factQty;
}
- if (bind.FullQty < bind.Qty && isDeposit == 0 && isTextTable == 0)
- {
- throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
- }
+ //if (bind.FullQty < bind.Qty && isDeposit == 0 && isTextTable == 0)
+ //{
+ // throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
+ //}
- if (bind.FullQty == bind.Qty)
+ if (bind.FullQty <= bind.Qty)
{
bind.BitPalletMark = "0";
}
- if (bind.Qty > pNum && isDeposit == 0 && isTextTable == 0)
- {
- throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
- }
+ //if (bind.Qty > pNum && isDeposit == 0 && isTextTable == 0)
+ //{
+ // throw new Exception($"缁戝畾澶辫触锛寋bind.PalletNo}鎵樼洏缁戝畾鏁伴噺澶т簬璇ョ墿鍝佹墭鐩樺寘瑁呮暟閲忥紒");
+ //}
Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
// 鏇存敼鍏ュ簱鍗曟槑缁嗗凡缁勬暟閲�
@@ -2490,7 +2624,7 @@
PackagNo = sku.PackagNo,
IsBale = bindInfo.IsBale,
IsBelt = bindInfo.IsBelt,
-
+ Demo = bindInfo.Demo,
CreateUser = (int)model.CreateUser,
CreateTime = serverTime
};
@@ -2506,8 +2640,13 @@
detailModel.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉�
}
#region 缁存姢璐ㄦ缁撴灉
+
//鑾峰彇璇ユ壒娆℃渶缁堣川妫�缁撴灉
var quality = Db.Queryable<BllQualityInspect>().Where(a => a.LotNo == noticeDetail.LotNo && a.IsDel == "0").OrderByDescending(a => a.CreateTime).First();
+ if (notice.Type == "3")
+ {
+ quality = Db.Queryable<BllQualityInspect>().Where(a => a.LotNo == noticeDetail.LotNo && a.ASNNo == notice.ASNNo && a.IsDel == "0").OrderByDescending(a => a.CreateTime).First();
+ }
if (quality != null)
{
//淇敼鍚堟牸涓嶅悎鏍兼暟閲�
--
Gitblit v1.8.0