Administrator
2024-06-18 225cb66b7d1f86a56edad2eac37e9aff57106031
编写下发入库单接口
2个文件已添加
2个文件已删除
1个文件已修改
152 ■■■■ 已修改文件
Wms/Model/InterFaceModel/AsnModels.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllTransServer/NoticeServe.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllTransServer/NoticeServer.cs 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.IBLL/IBllTransServer/INoticeServe.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
Wms/WMS.BLL/BllTransServer/NoticeServe.cs
File was deleted
Wms/WMS.BLL/BllTransServer/NoticeServer.cs
New file
@@ -0,0 +1,112 @@
using 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;
            }
        }
    }
}
Wms/WMS.IBLL/IBllTransServer/INoticeServe.cs
File was deleted
Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs
New file
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WMS.IBLL.IBllTransServer
{
    public interface INoticeServer
    {
        public ErpModel CreateAsn(AsnInfo model);
    }
}