From 225cb66b7d1f86a56edad2eac37e9aff57106031 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 18 六月 2024 16:50:52 +0800
Subject: [PATCH] 编写下发入库单接口
---
/dev/null | 10 ---
Wms/WMS.BLL/BllTransServer/NoticeServer.cs | 112 +++++++++++++++++++++++++++++++++++++
Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs | 11 +++
Wms/Model/InterFaceModel/AsnModels.cs | 9 +++
4 files changed, 132 insertions(+), 10 deletions(-)
diff --git a/Wms/Model/InterFaceModel/AsnModels.cs b/Wms/Model/InterFaceModel/AsnModels.cs
index d74e239..85a41a9 100644
--- a/Wms/Model/InterFaceModel/AsnModels.cs
+++ b/Wms/Model/InterFaceModel/AsnModels.cs
@@ -44,6 +44,10 @@
/// </summary>
public string SkuNo { get; set; }
/// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string SkuName { get; set; }
+ /// <summary>
/// 鎵规鍙�
/// </summary>
public string LotNo { get; set; }
@@ -62,6 +66,11 @@
/// 渚涜揣鎵规
/// </summary>
public string SupplierLot { get; set; }
+
+ /// <summary>
+ /// 涓婃父绯荤粺鏄庣粏鍙�
+ /// </summary>
+ public string OrderDetailCode { get; set; }
}
/// <summary>
diff --git a/Wms/WMS.BLL/BllTransServer/NoticeServe.cs b/Wms/WMS.BLL/BllTransServer/NoticeServe.cs
deleted file mode 100644
index 781e677..0000000
--- a/Wms/WMS.BLL/BllTransServer/NoticeServe.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace WMS.BLL.BllTransServer
-{
- class NoticeServe
- {
- }
-}
diff --git a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
new file mode 100644
index 0000000..28ead5b
--- /dev/null
+++ b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
@@ -0,0 +1,112 @@
+锘縰sing Model.InterFaceModel;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using WMS.DAL;
+using WMS.Entity.BllAsnEntity;
+using WMS.Entity.Context;
+using WMS.IBLL.IBllTransServer;
+
+namespace WMS.BLL.BllTransServer
+{
+ public class NoticeServer : DbHelper<BllArrivalNotice>, INoticeServer
+ {
+ private static readonly SqlSugarScope Db = DataContext.Db;
+ public NoticeServer() : base(Db)
+ {
+ }
+
+ public ErpModel CreateAsn(AsnInfo model)
+ {
+ try
+ {
+ var resultModel = new ErpModel() { Success = -1, Message = "" };
+ if (string.IsNullOrEmpty(model.OrderCode))
+ {
+ resultModel.Message = "涓婃父绯荤粺鍗曞彿涓嶅彲涓虹┖!";
+ return resultModel;
+ }
+ if (model.AsnDetails.Count <= 0)
+ {
+ resultModel.Message = "鍏ュ簱鍗曟槑缁嗕笉鍙负绌�!";
+ return resultModel;
+ }
+
+ // 鍏ュ簱鎬昏〃淇℃伅
+ string asnNo = new Common().GetMaxNo("ASN");
+ var asnModel = new BllArrivalNotice()
+ {
+ ASNNo = asnNo,
+ Status = "0",//绛夊緟鎵ц
+ Type = "0",//鍘熸枡鍏ュ簱
+ Origin = string.IsNullOrEmpty(model.Origin) ? "MES" : model.Origin,
+ CustomerNo = model.Customer,
+ CustomerName = "",
+ OrderCode = model.OrderCode,
+ };
+
+ // 鍏ュ簱鏄庣粏琛ㄤ俊鎭�
+ List<BllArrivalNoticeDetail> detailModels = new List<BllArrivalNoticeDetail>();
+ foreach (AsnDetail asnDetailModel in model.AsnDetails)
+ {
+ if (string.IsNullOrEmpty(asnDetailModel.SkuNo))
+ {
+ resultModel.Message = "鐗╂枡缂栫爜涓嶅彲涓虹┖!";
+ return resultModel;
+ }
+ if (string.IsNullOrEmpty(asnDetailModel.SkuName))
+ {
+ resultModel.Message = "鐗╂枡鍚嶇О涓嶅彲涓虹┖!";
+ return resultModel;
+ }
+ if (asnDetailModel.Qty <= 0)
+ {
+ resultModel.Message = "鏁伴噺搴斿ぇ浜�0!";
+ return resultModel;
+ }
+ if (string.IsNullOrEmpty(asnDetailModel.LotNo))
+ {
+ resultModel.Message = "鎵规鍙蜂笉鍙负绌�!";
+ return resultModel;
+ }
+ var detailModel = new BllArrivalNoticeDetail()
+ {
+ ASNNo = asnNo,
+ OrderDetailCode = asnDetailModel.OrderDetailCode,
+ SkuNo = asnDetailModel.SkuNo,
+ SkuName = asnDetailModel.SkuName,
+ LotNo = asnDetailModel.LotNo,
+ LotText = "",
+ Qty = (decimal)asnDetailModel.Qty,
+ FactQty = 0,
+ CompleteQty = 0,
+ SupplierLot = asnDetailModel.SupplierLot,
+ Status = "0",
+ IsSampling = "0",
+ InspectStatus = "0",
+ CreateUser = 0
+ };
+ detailModels.Add(detailModel);
+ }
+
+ Db.BeginTran();
+ // 鎻掑叆鍏ュ簱鍗曟�昏〃
+ Db.Insertable(asnModel).ExecuteCommand();
+
+ // 鎻掑叆鍏ュ簱鍗曟槑缁嗚〃
+ Db.Insertable(detailModels).ExecuteCommand();
+ Db.CommitTran();
+
+ resultModel.Success = 0;
+ resultModel.Message = "鎴愬姛";
+ return resultModel;
+ }
+ catch (Exception ex)
+ {
+ Db.RollbackTran();
+ throw ex;
+ }
+ }
+ }
+}
diff --git a/Wms/WMS.IBLL/IBllTransServer/INoticeServe.cs b/Wms/WMS.IBLL/IBllTransServer/INoticeServe.cs
deleted file mode 100644
index 1966bca..0000000
--- a/Wms/WMS.IBLL/IBllTransServer/INoticeServe.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace WMS.IBLL.IBllTransServer
-{
- class INoticeServe
- {
- }
-}
diff --git a/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs b/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs
new file mode 100644
index 0000000..c7a25fd
--- /dev/null
+++ b/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs
@@ -0,0 +1,11 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WMS.IBLL.IBllTransServer
+{
+ public interface INoticeServer
+ {
+ public ErpModel CreateAsn(AsnInfo model);
+ }
+}
--
Gitblit v1.8.0