From b78a8a99a9817b29289dc637711ab122cee829a8 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 10 9月 2024 13:16:29 +0800
Subject: [PATCH] 去掉密码验证

---
 iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs |   94 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 86 insertions(+), 8 deletions(-)

diff --git a/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs b/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs
index b7f4f72..9633936 100644
--- a/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs
+++ b/iWara.SCADA.Code/iWare.Wms.Application/Service/Pda/PdaService.cs
@@ -486,13 +486,13 @@
         public async Task<string> outBoundWorkPiece([FromBody] OutBoundInput input)
         {
 
-            if (input.Password == null || !input.Password.Equals("123456"))
-            {
-                throw Oops.Oh("淇敼宸ヤ欢璐ㄩ噺鐘舵�佸け璐ワ細瀵嗙爜杈撳叆閿欒锛�");
-            }
+            //if (input.Password == null || !input.Password.Equals("123456"))
+            //{
+            //    throw Oops.Oh("淇敼宸ヤ欢璐ㄩ噺鐘舵�佸け璐ワ細瀵嗙爜杈撳叆閿欒锛�");
+            //}
             if (input.WorkPieceInfoLst.Count < 1)
             {
-                throw Oops.Oh("宸ヤ欢鍑哄簱澶辫触锛氭暟鎹笉鑳戒负绌猴紒");
+                throw Oops.Oh("宸ヤ欢鍏ュ簱澶辫触锛氭暟鎹笉鑳戒负绌猴紒");
             }
 
             List<OutBoundDetailsInput> WorkPieceInfoLst = input.WorkPieceInfoLst;
@@ -504,22 +504,31 @@
 
             List<WorkPieceInfo> db_WorkPieceInfoList = await _workPieceInfoRep.Where(w => queryOP80NewCodeList.Contains(w.OP80NewCode) && w.IsDeleted == false).ToListAsync();
 
+            var addOutBoundLogList = new List<WorkPieceOutboundRecord>();
+
             foreach (var item in WorkPieceInfoLst)
             {
-                var itemModel = db_itemModelList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode);
+                var itemModel = db_itemModelList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode && w.IsDeleted == false);
                 if (itemModel != null)
                 {
                     //itemModel.IsDeleted = true;
                     //itemModel.Remark = itemModel.Remark ?? "" + "浜屾鍙戣揣鑷姩鎾ら攢鍙戣揣";
                     //await _workPieceOutboundRep.UpdateAsync(itemModel);
+
+                    /*
                     var createitme = itemModel.CreatedTime == null ? "" : (((DateTimeOffset)itemModel.CreatedTime).UtcDateTime.ToString("yyyy-MM-dd HH:mm:ss"));
                     throw Oops.Oh($"鎴愬搧鐮亄itemModel.OP80NewCode}宸插嚭搴擄紝鍑哄簱鏃堕棿:{createitme}");
+
+                    //*/
+
+                    //涓嶅啀鎻愮ず鍑烘潵锛岃嚜鍔ㄥ拷鐣� 銆怑ditby shaocx,2024-09-04銆�
+                    continue;
                 }
                 var workPiece = db_WorkPieceInfoList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode);
                 if (workPiece != null)
                 {
                     workPiece.OutPerson = CurrentUserInfo.Name;
-                    workPiece.OutRemark = "鎾ら攢宸ヤ欢鍑哄簱";
+                    workPiece.OutRemark = "鎾ら攢宸ヤ欢鍏ュ簱";
                     workPiece.OutTime = DateTime.Now;
                     workPiece.IsOut = false;
 
@@ -537,9 +546,28 @@
                 };
                 addOutBoundList.Add(outBoundLog);
 
+                var outBoundLogRecord = new WorkPieceOutboundRecord
+                {
+                    OperationType = OutboundOperationType.鍏ュ簱.ToString(),
+                    WorkPieceID = workPiece?.WorkPieceID,
+                    OP80NewCode = item.OP80NewCode,
+
+                    CreatedUserId = CurrentUserInfo.UserId,
+                    CreatedUserName = CurrentUserInfo.Name,
+
+
+                    //CarNo = input.CarNo,
+                    Remark = "宸ヤ欢鍏ュ簱",
+
+                };
+                addOutBoundLogList.Add(outBoundLogRecord);
+
 
             }
             await _workPieceOutboundRep.InsertAsync(addOutBoundList);
+
+            await _workPieceOutboundRecordRep.InsertAsync(addOutBoundLogList);
+
             return "鍑哄簱鎴愬姛";
         }
 
@@ -667,7 +695,7 @@
             return "涓嬬嚎鎴愬姛";
         }
 
-       
+
 
 
         /// <summary>
@@ -693,6 +721,12 @@
             w.CarNo == input.CarNo
             && w.UnLineStage == PieceUnLineStage.宸蹭笅绾�
             && w.IsDeleted == false).ToListAsync();
+
+            if (db_WorkPieceOutboundList?.Count == 0)
+            {
+                throw Oops.Oh("娌℃湁鍙嚭搴撶殑鏁版嵁锛�");
+            }
+
 
             var queryOP80NewCodeList = db_WorkPieceOutboundList.Select(x => x.OP80NewCode).ToList();
 
@@ -867,6 +901,50 @@
         }
 
 
+
+        /// <summary>
+        /// 鍑哄簱缁熻
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost("getOutBoundWorkPieceInfoCountList")]
+        [DisableOpLog]
+        public async Task<List<OutBoundWorkPieceInfoCountOutput>> GetOutBoundWorkPieceInfoCountList([FromBody] OutBoundWorkPieceInfoCountInput input)
+        {
+            /*
+         //娴嬭瘯
+         List<OutBoundWorkPieceInfoCountOutput> outBoundWorkPieceInfoCountOutputs = new List<OutBoundWorkPieceInfoCountOutput>();
+         outBoundWorkPieceInfoCountOutputs.Add(new OutBoundWorkPieceInfoCountOutput()
+         {
+             Count = 10,
+             WorkPieceOutboundUserName = "AAA"
+         });
+         outBoundWorkPieceInfoCountOutputs.Add(new OutBoundWorkPieceInfoCountOutput()
+         {
+             Count = 99,
+             WorkPieceOutboundUserName = "BBb"
+         });
+         return outBoundWorkPieceInfoCountOutputs;
+         //*/
+
+
+            //DateTimeOffset now = DateTimeOffset.Now; // 鑾峰彇褰撳墠鏃堕棿锛屽寘鎷椂鍖哄亸绉婚噺
+            DateTimeOffset now = input.Date; // 鑾峰彇褰撳墠鏃堕棿锛屽寘鎷椂鍖哄亸绉婚噺
+            DateTimeOffset startOfDay = new DateTimeOffset(now.Year, now.Month, now.Day, 0, 0, 0, now.Offset); // 褰撳ぉ寮�濮嬫椂闂�
+            DateTimeOffset endOfDay = new DateTimeOffset(now.Year, now.Month, now.Day, 23, 59, 59, now.Offset); // 褰撳ぉ缁撴潫鏃堕棿
+            List<WorkPieceOutbound> db_itemModelList = await _workPieceOutboundRep.Where(w => w.CreatedTime >= startOfDay
+            && w.CreatedTime <= endOfDay && w.IsDeleted == false).ToListAsync();
+            //姹囨�诲垎缁�
+            var groupList = db_itemModelList.GroupBy(g => g.WorkPieceOutboundUserName).Select(s => new OutBoundWorkPieceInfoCountOutput()
+            {
+                WorkPieceOutboundUserName = s.Key,
+                Count = s.ToList().Count
+            }).ToList();
+            return groupList;
+            //*/
+        }
+
+
         #endregion
 
     }

--
Gitblit v1.9.3