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/BllQualityServer/QualityInspectServer.cs | 77 ++++++++++++++++++++++++++++----------
1 files changed, 56 insertions(+), 21 deletions(-)
diff --git a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
index 89172ff..a60709d 100644
--- a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
+++ b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
@@ -1,5 +1,7 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Data;
+using System.Linq;
using System.Text;
using Model.ModelDto.BllQualityDto;
using Model.ModelVm;
@@ -9,6 +11,7 @@
using WMS.Entity.BllQualityEntity;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
+using WMS.Entity.SysEntity;
using WMS.IBLL.IBllQualityServer;
namespace WMS.BLL.BllQualityServer
@@ -87,47 +90,79 @@
{
throw new Exception("璐ㄦ鍙蜂笉鍙负绌猴紝璇锋牳鏌ワ紒");
}
- //楠岃瘉鍏ュ簱鍗曞彿鏄惁涓虹┖
- if (string.IsNullOrEmpty(model.ASNNo))
- {
- throw new Exception("鍏ュ簱鍗曞彿涓嶅彲涓虹┖锛岃鏍告煡锛�");
- }
//楠岃瘉鐗╂枡鍙锋槸鍚︿负绌�
if (string.IsNullOrEmpty(model.SkuNo))
{
throw new Exception("鐗╂枡鍙蜂笉鍙负绌猴紝璇锋牳鏌ワ紒");
+ }
+ //鑾峰彇鐗╂枡淇℃伅
+ var sku = Db.Queryable<SysMaterials>().First(a => a.IsDel == "0" && a.SkuNo == model.SkuNo);
+ if (sku == null)
+ {
+ throw new Exception("鐗╂枡淇℃伅涓虹┖锛岃鏍告煡锛�");
}
//楠岃瘉鎵规鍙锋槸鍚︿负绌�
if (string.IsNullOrEmpty(model.LotNo))
{
throw new Exception("鎵规鍙蜂笉鍙负绌猴紝璇锋牳鏌ワ紒");
}
-
-
- //鏌ユ壘璐ㄦ淇℃伅涓槸鍚﹀瓨鍦ㄥ悓鎵规璐ㄦ褰曞叆璁板綍
- BllQualityInspect quality = Db.Queryable<BllQualityInspect>().First(m => m.IsDel == "0" && m.ASNNo == model.ASNNo && m.SkuNo == model.SkuNo && m.LotNo == model.LotNo);
- if (quality != null)
+ int isTui = 0;
+ //楠岃瘉鍏ュ簱鍗曞彿鏄惁涓虹┖
+ if (!string.IsNullOrEmpty(model.ASNNo))
{
- throw new Exception("褰撳墠鎵规宸茶繘琛岃川妫�锛岃鏍告煡锛�");
+ //鏌ヨ鏄惁涓洪��璐у叆搴撳崟鎹�
+ var Arrival = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.Type == "3");
+ if (Arrival == null)
+ {
+ throw new Exception("鍙湁鍏ュ簱鍗曟嵁涓洪��璐у叆搴撳崟鍙緭鍏� 鍏ュ簱鍗曞彿锛岃鏍告煡锛�");
+ }
+
+ //鑾峰彇鍏ュ簱鍗曟槑缁�
+ var ArrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.LotNo.Contains(model.LotNo) && a.SkuNo == model.SkuNo);
+ if (ArrivalDetail == null)
+ {
+ throw new Exception("杈撳叆鐨勬壒娆℃垨鐗╂枡淇℃伅涓庡叆搴撳崟鎹笉绗︼紝璇锋牳鏌ワ紒");
+ }
+ isTui = 1;
}
- //鏌ユ壘鍚屾壒娆� 鍚屽崟鎹� 鍏ュ簱鍗曚俊鎭��
- BllArrivalNoticeDetail arrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.ASNNo == model.ASNNo && m.LotNo == model.LotNo);
+ //鏌ユ壘璐ㄦ淇℃伅涓槸鍚﹀瓨鍦ㄥ悓鎵规璐ㄦ褰曞叆璁板綍
+ //BllQualityInspect quality = Db.Queryable<BllQualityInspect>().First(m => m.IsDel == "0" && m.SkuNo == model.SkuNo && m.LotNo == model.LotNo);
+
+ //if (quality != null)
+ //{
+ ////鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟
+ //if (isTui == 1)
+ //{
+ // if (quality.ASNNo == model.ASNNo)
+ // {
+ // throw new Exception("褰撳墠閫�璐у叆搴撳崟宸插垱寤鸿川妫�淇℃伅锛岃鍕块噸澶嶅垱寤猴紒");
+ // }
+ //}
+ // throw new Exception("褰撳墠鐗╂枡鍜屾壒娆″凡杩涜璐ㄦ锛岃鏍告煡锛�");
+ //}
+
+ ////鏌ユ壘鍚屾壒娆� 鍚屽崟鎹� 鍏ュ簱鍗曚俊鎭��
+ //BllArrivalNoticeDetail arrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.ASNNo == model.ASNNo && m.LotNo == model.LotNo);
model.Origin = "WMS"; //鏉ユ簮
model.CreateTime = Db.GetDate(); //鍒涘缓鏃ユ湡
- model.SkuNo = arrivalDetail.SkuNo; //鐗╂枡鍙�
- model.SkuName = arrivalDetail.SkuName; //鐗╂枡鍚嶇О
+ model.SkuNo = sku.SkuNo; //鐗╂枡鍙�
+ model.SkuName = sku.SkuName; //鐗╂枡鍚嶇О
model.PassQty = 0; //鍚堟牸鏁伴噺
model.FailQty = 0; //涓嶅悎鏍兼暟閲�
- model.Standard = arrivalDetail.Standard; //瑙勬牸
- model.SupplierLot = arrivalDetail.SupplierLot; //渚涜揣鎵规
+ model.Standard = sku.Standard; //瑙勬牸
+ //model.SupplierLot = arrivalDetail.SupplierLot; //渚涜揣鎵规
//鏌ユ壘搴撳瓨鏄庣粏淇℃伅
- List<DataStockDetail> detail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.ASNNo == model.ASNNo && m.SkuNo == model.SkuNo && m.LotNo == model.LotNo).ToList();
+ List<DataStockDetail> detail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.SkuNo == model.SkuNo && m.LotNo == model.LotNo).ToList();
+ if (isTui == 1)
+ {
+ detail = detail.Where(m=> m.ASNNo == model.ASNNo).ToList();
+ }
foreach (var item in detail)
{
- List<BllBoxInfo> box = Db.Queryable<BllBoxInfo>().Where(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
+ List<DataBoxInfo> box = Db.Queryable<DataBoxInfo>().Where(a => a.IsDel == "0" && a.StockDetailId == item.Id && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
//鍒ゆ柇鍚堟牸鐘舵�佹槸鍚﹀悎鏍�
if (model.IsQualified == "1")
{
@@ -137,7 +172,7 @@
item.InspectStatus = "1"; //1鍚堟牸
foreach (var b1 in box)
{
- b1.InspectMark = "1"; //1鍚堟牸
+ b1.InspectStatus = "1"; //1鍚堟牸
}
}
else //涓嶅悎鏍�
@@ -147,7 +182,7 @@
item.InspectStatus = "2"; //2涓嶅悎鏍�
foreach (var b1 in box)
{
- b1.InspectMark = "2"; //2涓嶅悎鏍�
+ b1.InspectStatus = "2"; //2涓嶅悎鏍�
}
}
Db.Updateable(box).ExecuteCommand();
--
Gitblit v1.8.0