From aa63e0401cea4e367c9d9fd620d996a688c0a01f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 21 五月 2025 15:18:51 +0800
Subject: [PATCH] 添加PDA人工入库功能
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs | 68 +++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 2 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs"
index b38e66e..e15310b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs"
@@ -1,4 +1,5 @@
锘縰sing AutoMapper;
+using Microsoft.IdentityModel.Tokens;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -72,13 +73,28 @@
if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
#endregion
+ List<string> LocationCodes = orderAddDTO.Details
+ .Where(x => !string.IsNullOrEmpty(x.LocationCode))
+ .Select(x => x.LocationCode).ToList();
+
Dt_InboundOrder inboundOrder = _mapper.Map<Dt_InboundOrder>(orderAddDTO);
+ //inboundOrder.OrderNo = DateTime.Now.ToString("yyMMddHHmmss");
inboundOrder.OrderStatus = InboundStatusEnum.鏈紑濮�.ObjToInt();
- bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+ Db.Ado.BeginTran();
+ if (LocationCodes.Any())
+ {
+ content = _basicService.LocationInfoService.UpdateStatus(LocationCodes, LocationStatusEnum.PalletLock.ObjToInt());
+ if (!content.Status)
+ throw new Exception(content.Message);
+ }
+
+ BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+ Db.Ado.CommitTran();
content = WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
+ Db.Ado.RollbackTran();
content = WebResponseContent.Instance.Error(ex.Message);
}
finally
@@ -88,6 +104,54 @@
return content;
}
+ public override WebResponseContent UpdateData(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ if (saveModel.DetailData == null || saveModel.DetailData.Count == 0) throw new Exception($"鍏ュ簱鍗曟槑缁嗕笉鑳戒负绌�");
+ List<InboundOrderDetailAddDTO> inboundOrderDetail = saveModel.DetailData.DicToIEnumerable<InboundOrderDetailAddDTO>();
+ //if (inboundOrderDetail.FirstOrDefault(x => x.OrderDetailStatus > 0) != null) throw new Exception($"璁㈠崟宸插紑濮嬬粍鐩樺叆搴�");
+ //var inboundOrderDetails = _inboundOrderDetailService.Db.Queryable<Dt_InboundOrderDetail>().Where(x => saveModel.DelKeys.Contains(x.Id)).ToList();
+ //if (inboundOrderDetails.Count > 0)
+ //{
+ // if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) != null)
+ // throw new Exception($"瀛樺湪宸茬粍鐩樺伐鍗曪紝宸插厛瑙g洏");
+ //}
+ content = base.UpdateData(saveModel);
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+
+ public override WebResponseContent DeleteData(object[] keys)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ //var inboundOrders = BaseDal.QueryData(x => keys.Contains(x.Id));
+ var inboundOrders = BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).Where(x => keys.Contains(x.Id)).ToList();
+ if (inboundOrders.Count < 1) throw new Exception("鏈壘鍒板叆搴撳崟");
+ List<Dt_InboundOrderDetail> orderDetails = new List<Dt_InboundOrderDetail>();
+ foreach (var item in inboundOrders)
+ {
+ if (item.Details.Where(x => x.ReceiptQuantity != x.OverInQuantity).Any())
+ throw new Exception("瀛樺湪鏈叆搴撳畬鎴愭墭鐩�");
+ orderDetails.AddRange(item.Details);
+ item.Details = null;
+ }
+ BaseDal.DeleteAndMoveIntoHty(inboundOrders, OperateType.浜哄伐鍒犻櫎);
+ content.Status = _inboundOrderDetailService.Repository.DeleteAndMoveIntoHty(orderDetails, OperateType.浜哄伐鍒犻櫎);
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
/// <summary>
/// 楠岃瘉鍗曟嵁娣诲姞DTO瀵硅薄
/// </summary>
@@ -113,7 +177,7 @@
return (false, "鏈夌墿鏂欎俊鎭湭褰曞叆锛岃褰曞叆鐗╂枡淇℃伅", inboundOrderAddDTO);
}
- if (BaseDal.QueryFirst(x => x.UpperOrderNo == inboundOrderAddDTO.UpperOrderNo && !string.IsNullOrEmpty(x.UpperOrderNo)) != null)
+ if (BaseDal.QueryFirst(x => x.OrderNo == inboundOrderAddDTO.orderNo && !string.IsNullOrEmpty(x.OrderNo)) != null)
{
return (false, "鍗曟嵁宸插瓨鍦�", inboundOrderAddDTO);
}
--
Gitblit v1.9.3