From f2bc08e28dda7022202f07217f6a3c150f818af7 Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期一, 20 一月 2025 08:32:16 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/liudongl/jc24-wms --- Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs | 127 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 113 insertions(+), 14 deletions(-) diff --git a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs index a446c6b..386cd35 100644 --- a/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs +++ b/Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs @@ -6,6 +6,7 @@ using Model.ModelDto.BllQualityDto; using Model.ModelVm; using SqlSugar; +using Utility.Tools; using WMS.DAL; using WMS.Entity.BllAsnEntity; using WMS.Entity.BllQualityEntity; @@ -32,7 +33,7 @@ /// <returns></returns> public List<BllQualityInspectDto> GetBllQualityList(BllQualityInspect model) { - string str = "select q.Id Id,q.InspectNo InspectNo,q.ASNNo ASNNo,q.LotNo LotNo,q.SupplierLot SupplierLot,q.SkuNo SkuNo,q.SkuName SkuName,q.Standard Standard,q.PassQty PassQty,q.FailQty FailQty,q.Origin Origin,q.InspectTime InspectTime,q.IsOut IsOut,q.IsQualified IsQualified,q.IsDel IsDel,q.CreateTime CreateTime,u.RealName CreateUserName,q.UpdateTime UpdateTime,q.UpdateUser UpdateUserName from BllQualityInspect q left join SysUserInfor u on q.CreateUser = u.id where q.IsDel = @isdel"; + string str = "select q.Id Id,q.InspectNo InspectNo,q.ASNNo ASNNo,q.Status Status,q.LotNo LotNo,q.SupplierLot SupplierLot,q.SkuNo SkuNo,q.SkuName SkuName,q.Standard Standard,q.PassQty PassQty,q.FailQty FailQty,q.Origin Origin,q.InspectTime InspectTime,q.IsOut IsOut,q.IsQualified IsQualified,q.IsDel IsDel,q.CreateTime CreateTime,u.RealName CreateUserName,q.UpdateTime UpdateTime,q.UpdateUser UpdateUserName from BllQualityInspect q left join SysUserInfor u on q.CreateUser = u.id where q.IsDel = @isdel"; ////鍒ゆ柇鍏ュ簱鍗曞彿鏄惁涓虹┖ //if (!string.IsNullOrEmpty(model.ASNNo)) @@ -131,34 +132,132 @@ //if (quality != null) //{ - ////鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟 - //if (isTui == 1) - //{ - // if (quality.ASNNo == model.ASNNo) - // { - // throw new Exception("褰撳墠閫�璐у叆搴撳崟宸插垱寤鸿川妫�淇℃伅锛岃鍕块噸澶嶅垱寤猴紒"); - // } - //} + ////鍒ゆ柇鏄惁涓洪��璐у叆搴撳崟 + //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.Status = "0";//瀹℃牳鐘舵�� model.Origin = "WMS"; //鏉ユ簮 model.CreateTime = Db.GetDate(); //鍒涘缓鏃ユ湡 model.SkuNo = sku.SkuNo; //鐗╂枡鍙� model.SkuName = sku.SkuName; //鐗╂枡鍚嶇О - model.PassQty = 0; //鍚堟牸鏁伴噺 - model.FailQty = 0; //涓嶅悎鏍兼暟閲� + //model.PassQty = 0; //鍚堟牸鏁伴噺 + //model.FailQty = 0; //涓嶅悎鏍兼暟閲� model.Standard = sku.Standard; //瑙勬牸 + //model.SupplierLot = arrivalDetail.SupplierLot; //渚涜揣鎵规 + + //鏌ユ壘搴撳瓨鏄庣粏淇℃伅 + //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<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") + // { + // //鍚堟牸 鐩稿悓鎵规搴撳瓨淇℃伅鍏ㄩ儴鏀逛负鍚堟牸鐘舵�� 涓斿悎鏍兼暟閲忓鍔犱负鍚屾壒娆″悓鍗曞彿璇ョ墿鏂欏叏閮ㄦ暟閲忎箣鍜� + // model.PassQty += item.Qty; + // //淇敼搴撳瓨鏄庣粏鍚堟牸鐘舵�� + // item.InspectStatus = "1"; //1鍚堟牸 + // foreach (var b1 in box) + // { + // b1.InspectStatus = "1"; //1鍚堟牸 + // } + // } + // else //涓嶅悎鏍� + // { + // //涓嶅悎鏍� 鐩稿悓鎵规銆佸叆搴撳崟搴撳瓨淇℃伅鍏ㄩ儴鏀逛负涓嶅悎鏍肩墿鏂� 涓斾笉鍚堟牸鏁伴噺澧炲姞涓哄悓鎵规鍚屽崟鍙疯鐗╂枡鍏ㄩ儴鏁伴噺涔嬪拰 + // model.FailQty += item.Qty; + // item.InspectStatus = "2"; //2涓嶅悎鏍� + // foreach (var b1 in box) + // { + // b1.InspectStatus = "2"; //2涓嶅悎鏍� + // } + // } + // Db.Updateable(box).ExecuteCommand(); + // Db.Updateable(item).ExecuteCommand(); + //} + var isquality = Db.Insertable(model).ExecuteCommand(); + + return isquality; + } + + /// <summary> + /// 璐ㄦ澶嶆牳淇℃伅 + /// </summary> + /// <param name="id"></param> + /// <param name="userNo"></param> + /// <param name="password"></param> + /// <param name="userId"></param> + /// <returns></returns> + /// <exception cref="Exception"></exception> + public int FinshQuality(int id,string userNo, string password, int userId) + { + var loginPwd = Md5Tools.CalcMd5(password); + var date = Db.Queryable<SysUserInfor>().First(m => m.IsDel == "0" && m.UserName == userNo && m.PassWord == loginPwd); + + if (date == null) //璐﹀彿瀵嗙爜鏄惁姝g‘ + { + throw new Exception("璐﹀彿瀵嗙爜涓嶆纭垨娌℃湁姝よ处鍙�"); + } + if (date.Status != "0") //褰撳墠璐﹀彿鏄惁姝e父鍚敤 + { + throw new Exception("褰撳墠璐﹀彿闈炲惎鐢ㄧ姸鎬�"); + } + + var model = Db.Queryable<BllQualityInspect>().First(m=>m.IsDel == "0" && m.Id == id); + if (model == null) + { + throw new Exception("鏈煡璇㈠埌璐ㄦ淇℃伅"); + } + if (date.Id == model.CreateUser) + { + throw new Exception("澶嶆牳澶辫触锛屽鏍镐汉鍛樺拰鍏抽棴璁㈠崟浜哄憳涓嶈兘鐩稿悓锛�"); + } + int isTui = 0; + //楠岃瘉鍏ュ簱鍗曞彿鏄惁涓虹┖ + if (!string.IsNullOrEmpty(model.ASNNo)) + { + //鏌ヨ鏄惁涓洪��璐у叆搴撳崟鎹� + var Arrival = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && (a.Type == "3" || a.Type == "4")); + 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; + } + + + + model.Status = "1"; //瑙勬牸 + model.UpdateTime = DateTime.Now; + model.UpdateUser = userId; //model.SupplierLot = arrivalDetail.SupplierLot; //渚涜揣鎵规 //鏌ユ壘搴撳瓨鏄庣粏淇℃伅 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(); + detail = detail.Where(m => m.ASNNo == model.ASNNo).ToList(); } foreach (var item in detail) { @@ -188,7 +287,7 @@ Db.Updateable(box).ExecuteCommand(); Db.Updateable(item).ExecuteCommand(); } - var isquality = Db.Insertable(model).ExecuteCommand(); + var isquality = Db.Updateable(model).ExecuteCommand(); return isquality; } -- Gitblit v1.8.0