From c455612b03e6ecac994884dde5b5f4bc4909c181 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 11 三月 2025 17:12:52 +0800
Subject: [PATCH] 1
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs | 66 ++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 1 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..eb0d255 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));
+ if (inboundOrders.FirstOrDefault(x => x.OrderStatus != InboundStatusEnum.鏈紑濮�.ObjToInt()) != null)
+ throw new Exception($"鍏ュ簱鍗曞瓨鍦ㄧ粍鐩樺叆搴撲俊鎭�");
+ foreach (var inboundOrder in inboundOrders)
+ {
+ var inboundOrderDetails = BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == inboundOrder.OrderNo).Details;
+ if (inboundOrderDetails != null || inboundOrderDetails.Count > 0)
+ {
+ if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) != null)
+ throw new Exception($"鍏ュ簱鍗曘�恵inboundOrder.OrderNo}銆戝瓨鍦ㄧ粍鐩樺叆搴撲俊鎭�");
+ }
+ }
+ content = base.DeleteData(keys);
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
/// <summary>
/// 楠岃瘉鍗曟嵁娣诲姞DTO瀵硅薄
/// </summary>
--
Gitblit v1.9.3