From 2560a7e73dacbca9404e4f6f31596323c8e95fef Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期三, 26 十一月 2025 15:17:26 +0800
Subject: [PATCH] 格式化代码
---
Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs | 133 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 128 insertions(+), 5 deletions(-)
diff --git a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
index 0cc581b..c818606 100644
--- a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
+++ b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
@@ -80,7 +80,7 @@
skuname = "%" + model.SkuName + "%", //鐗╂枡鍚嶇О
lotno = model.LotNo, //鎵规鍙�
isqualified = model.IsQualified, //鏄惁鍚堟牸
- origin=model.Origin//鏉ユ簮
+ origin = model.Origin//鏉ユ簮
});
return qualityList;
}
@@ -166,7 +166,7 @@
{
sqlStr += $" and LotNo='{model.LotNo}' ";
}
- BllArrivalNoticeDetail arrivalDetail = Db.SqlQueryable<BllArrivalNoticeDetail>(sqlStr).First();
+ BllArrivalNoticeDetail arrivalDetail = Db.SqlQueryable<BllArrivalNoticeDetail>(sqlStr).First();
if (arrivalDetail == null)
{
throw new Exception("鏈壘鍒板叆搴撳崟淇℃伅锛�");
@@ -195,7 +195,7 @@
List<DataStockDetail> detail = Db.SqlQueryable<DataStockDetail>(sqlStr2).ToList();
foreach (var item in detail)
{
- List<BllBoxInfo> box = Db.Queryable<BllBoxInfo>().Where(a => a.IsDel == "0" && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
+ //List<BllBoxInfo> box = Db.Queryable<BllBoxInfo>().Where(a => a.IsDel == "0" && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
//鍒ゆ柇鍚堟牸鐘舵�佹槸鍚﹀悎鏍�
if (model.IsQualified == "1")
{
@@ -211,12 +211,17 @@
item.InspectStatus = "2"; //2涓嶅悎鏍�
}
- Db.Updateable(box).ExecuteCommand();
+ //Db.Updateable(box).ExecuteCommand();
Db.Updateable(item).ExecuteCommand();
}
Db.Updateable(arrivalDetail).ExecuteCommand();
var isquality = Db.Insertable(model).ExecuteCommand();
+
+ //淇敼搴撳瓨绠辩爜璐ㄦ鐘舵��
+ string uptDataBoxStatusSql = $@"update DataBoxInfo set InspectStatus='1' where IsDel='0' and SkuNo='{model.SkuNo}' and LotNo='{model.LotNo}' and StockDetailId in (select Id from DataStockDetail where IsDel='0' and SkuNo='{model.SkuNo}' and LotNo='{model.LotNo}' and InspectStatus='1') ";
+ int uptDataBoxStatus = Db.Ado.ExecuteCommand(uptDataBoxStatusSql);
+
return isquality;
}
@@ -226,7 +231,7 @@
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
- public string InsertQualitySap(SendQualityVm model)
+ /*public string InsertQualitySap(SendQualityVm model)
{
try
{
@@ -341,6 +346,124 @@
//鎶涘嚭寮傚父
throw new Exception("鎺ユ敹SAP涓嬪彂搴撳瓨璋冩暣鍗曞紓甯�:", ex);
}
+ }*/
+
+ public string InsertQualitySap(SendQualityVm model)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(model.orderNo) || model.adjustmentDList.Count <= 0)
+ {
+ throw new Exception("鍙傛暟閿欒");
+ }
+ //var asnInfo = Db.Queryable<BllArrivalNotice>().First(w => w.IsDel == "0" && w.OrderCode == model.orderNo);
+ //if (asnInfo == null)
+ //{
+ // throw new Exception($"鏈煡璇㈠埌{model.orderNo}瀵瑰簲鐨勫叆搴撳崟淇℃伅");
+ //}
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+
+ foreach (var item in model.adjustmentDList)
+ {
+ //var asnDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.IsDel == "0" && w.ASNNo == asnInfo.ASNNo && w.OrderDetailCode == item.lineNo && w.SkuNo == item.skuNo && w.LotNo == item.lotNo);
+ //if (asnDetail == null)
+ //{
+ // throw new Exception($"鏈煡璇㈠埌{item.lineNo}瀵瑰簲鐨勫叆搴撳崟鏄庣粏淇℃伅");
+ //}
+ //asnDetail.InspectStatus = item.IsQualified;
+ ////鏇存柊鍏ュ簱鍗曟槑缁嗚川妫�鐘舵��
+ //Db.Updateable(asnDetail).ExecuteCommand();
+
+ //鑾峰彇鐗╂枡淇℃伅
+ var sku = Db.Queryable<SysMaterials>().First(a => a.IsDel == "0" && a.SkuNo == item.skuNo);
+ if (sku == null)
+ {
+ throw new Exception($"鐗╂枡缂栫爜涓簕item.skuNo}鐨勭墿鏂欎俊鎭笉瀛樺湪锛岃鏍告煡锛�");
+ }
+
+ string toDayTime = DateTime.Now.ToString("yyyyMMdd");
+ var maxInspectNo = model.orderNo;
+ //var maxInspectNo = Db.Queryable<BllQualityInspect>().Where(m => m.IsDel == "0" && m.InspectNo.Contains("SAP")).Max(m => m.InspectNo);
+ //if (string.IsNullOrWhiteSpace(maxInspectNo))
+ //{
+ // maxInspectNo = "SAP" + toDayTime + "0001";
+ //}
+ //else
+ //{
+ // var lotStr = maxInspectNo.Substring(3, 8);
+ // if (lotStr == toDayTime)
+ // {
+ // maxInspectNo = "SAP" + toDayTime + (int.Parse(maxInspectNo.Replace("SAP", "").Substring(8, 4)) + 1).ToString().PadLeft(4, '0');
+ // }
+ // else
+ // {
+ // maxInspectNo = "SAP" + toDayTime + "0001";
+ // }
+ //}
+ var qualityModel = new BllQualityInspect
+ {
+ ASNNo = "",
+ InspectNo = maxInspectNo,
+ SkuNo = item.skuNo,
+ SkuName = item.skuName,
+ Standard = sku.Standard,
+ LotNo = item.lotNo,
+ IsQualified = item.IsQualified,
+ Origin = "SAP",
+ FailQty = 0,
+ PassQty = 0
+ };
+
+ //鏌ユ壘搴撳瓨淇℃伅
+ var stockDetailList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SkuNo == item.skuNo && w.LotNo == item.lotNo).ToList();
+ foreach (var datailItem in stockDetailList)
+ {
+ List<DataBoxInfo> boxList = Db.Queryable<DataBoxInfo>().Where(a => a.IsDel == "0" && a.SkuNo == item.skuNo && a.LotNo == item.lotNo && a.PalletNo == datailItem.PalletNo).ToList();
+ foreach (var boxItem in boxList)
+ {
+ if (item.IsQualified == "0")//涓嶅悎鏍�
+ {
+ boxItem.InspectStatus = "2";
+ }
+ else//鍚堟牸
+ {
+ boxItem.InspectStatus = "1";
+ }
+ }
+ //鏇存柊绠辩爜鏄庣粏璐ㄦ鐘舵��
+ Db.Updateable(boxList).ExecuteCommand();
+
+ if (item.IsQualified == "0")//涓嶅悎鏍�
+ {
+ datailItem.InspectStatus = "2";
+ //涓嶅悎鏍兼暟閲�
+ qualityModel.FailQty += datailItem.Qty;
+ }
+ else//鍚堟牸
+ {
+ datailItem.InspectStatus = "1";
+ //鍚堟牸鏁伴噺
+ qualityModel.PassQty += datailItem.Qty;
+ }
+ //鏇存柊搴撳瓨鏄庣粏璐ㄦ鐘舵��
+ Db.Updateable(datailItem).ExecuteCommand();
+ }
+ //娣诲姞璐ㄦ鍙樻洿璁板綍
+ Db.Insertable(qualityModel).ExecuteCommand();
+ }
+ //鎻愪氦浜嬪姟
+ Db.CommitTran();
+
+ return "0";
+ }
+ catch (Exception ex)
+ {
+ //鍥炴粴浜嬪姟
+ Db.RollbackTran();
+ //鎶涘嚭寮傚父
+ throw new Exception($"鎺ユ敹SAP涓嬪彂搴撳瓨璋冩暣鍗曞紓甯�:{ex}");
+ }
}
#endregion
--
Gitblit v1.8.0