GCS SERVER 服务端数据走向

Paste_Image.png

以DayliBusiness类 SaveThrowInBill()为例

Contract服务层


namespace CMST.SteerMarket.Server.Contract.DayliBusiness
{
    [ServiceContract]
    public interface IDailyBusiness
    {
        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string SaveThrowInBill(ThrowInEntity tie, string userId, int mode);

        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string GetThrowInEntityByID(string throwInId);

        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string GetBillOfLading(string BillOfLadingID, string SaleID, string SaleCustoemr, int model);
    }
}

Service契约层

namespace CMST.SteerMarket.Server.Service.DailyBusiness
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
    public class DailyBusiness : IDailyBusiness
    {
        DailyBusinessBLL MyDailyBusinessBLL = new DailyBusinessBLL();

        public string GetThrowInEntityByID(string throwInId)
        {
            return JsonConvert.SerializeObject(MyDailyBusinessBLL.GetThrowInEntityByID(throwInId));
        }

        public string SaveThrowInBill(ThrowInEntity tie, string userId, int mode)
        {
            return JsonConvert.SerializeObject(MyDailyBusinessBLL.SaveThrowInBill(tie, userId, mode));
        }

BLL 业务逻辑层

namespace CMST.SteerMarket.Server.BLL.DailyBusiness
{
    public class DailyBusinessBLL
    {
        DailyBusinessDAL MyDailyBusinessDAL = new DailyBusinessDAL();

        public FeedbackInfomation SaveThrowInBill(ThrowInEntity tie, string userId, int mode)
        {

            FeedbackInfomation fi = new FeedbackInfomation();
            try
            {
                switch (mode)
                {
                    case 0:
                        tie = SaveThrowInBillInAdd(tie, userId);
                        // fi.Result = tie;
                        fi.ErrorStatus = STATUS_ADAPTER.SAVE_SUCCESS;
                        fi.FeedbackMessage = Tips.SAVE_SUCCESS;
                        break;
                    case 1:
                        tie = SaveThrowInBillInEdit(tie, userId);
                        // fi.Result = tie;
                        fi.ErrorStatus = STATUS_ADAPTER.SAVE_SUCCESS;
                        fi.FeedbackMessage = Tips.SAVE_SUCCESS;
                        break;
                    case 2:
                        tie = SaveThrowInBillChecked(tie, userId);
                        //fi.Result = tie;
                        fi.ErrorStatus = STATUS_ADAPTER.CHECK_SUCCESS;
                        fi.FeedbackMessage = Tips.CHECK_SUCCESS;
                        break;
                    case 3:
                        tie = SaveThrowInBillCancelCheck(tie, userId);
                        //  fi.Result = tie;
                        fi.ErrorStatus = STATUS_ADAPTER.CANCEL_CHECK_SUCCESS;
                        fi.FeedbackMessage = Tips.CANCEL_CHECK_SUCCESS;
                        break;
                }
                fi.Result = tie;
                return fi;
            }
            catch (Exception ex)
            {
                fi.FeedbackMessage = ex.Message.ToString();
                fi.ErrorStatus = STATUS_ADAPTER.SAVE_FAILED;
                return fi;
            }
        }
 private ThrowInEntity SaveThrowInBillInAdd(ThrowInEntity tie, string userId)
        {
            try
            {
                BaseBLL MyBaseBLL = new BaseBLL();
                if (tie.ThrowInID == null || tie.ThrowInID == "")
                {
                    TransactionOptions to = new TransactionOptions();
                    to.IsolationLevel = System.Transactions.IsolationLevel.RepeatableRead;
                    to.Timeout = new TimeSpan(0, 0, 60);
                    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, to))
                    {
                        tie.Maker = userId;
                        tie.MakeTime = DateTime.Now;
                        tie.Reviser = userId;
                        tie.RevisionTime = tie.MakeTime;
                        tie.Status = Status.BillStatus["待审核"];
                        tie = MyDailyBusinessDAL.InsertThrowInEntity(tie);
                        LogEntity le = MyBaseBLL.GenerateLog("日常业务", "投放单", "新增", DateTime.Now, userId, "");
                        le = MyBaseBLL.SaveLog(le);
                        LogDetailEntity lde = MyBaseBLL.GenerateLogDetail(le.LogID, "SAL_ThrowIn", tie.ThrowInID, "");
                        MyBaseBLL.SaveLogDetail(lde);
                        for (int i = 0; i < tie.Tides.Count; i++)
                        {
                            if (tie.Tides[i].IfDel != true)
                            {
                                tie.Tides[i].ThrowInID = tie.ThrowInID;
                                SetDataInWhenAddOrEditThrowInDetail(tie.Tides[i]);
                                tie.Tides[i] = MyDailyBusinessDAL.InsertThrowInDetailEntity(tie.Tides[i]);
                                LogDetailEntity ldei = MyBaseBLL.GenerateLogDetail(le.LogID, "SAL_ThrowInDetail", tie.Tides[i].ThrowInDetailID, "");
                                MyBaseBLL.SaveLogDetail(ldei);
                            }
                        }
                        if (tie.Dcs != null)
                        {
                            for (int i = 0; i < tie.Dcs.Count; i++)
                            {
                                if (tie.Dcs[i].IfUse != false)
                                {
                                    tie.Dcs[i].ThrowInID = tie.ThrowInID;
                                    tie.Dcs[i] = MyDailyBusinessDAL.InsertDirectionalCustomerEntity(tie.Dcs[i]);
                                    LogDetailEntity ldei = MyBaseBLL.GenerateLogDetail(le.LogID, "SAL_DirectionalCustomer", tie.Dcs[i].DirectionalCustomerID, "");
                                    MyBaseBLL.SaveLogDetail(ldei);
                                }
                            }
                        }
                        tie.Dcs = tie.Dcs.Where(m => m.IfUse == true).ToList<DirectionalCustomerEntity>();
                        tie.Tides = tie.Tides.Where(m => m.IfDel != true).ToList<ThrowInDetailEntity>();
                        tie = GetThrowInBillPersonAndStatus(tie);
                        scope.Complete();
                    }
                }
                else
                {
                    tie = SaveThrowInBillInEdit(tie, userId);
                }
                return tie;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

DAL 持久层

  public ThrowInDetailEntity InsertThrowInDetailEntity(ThrowInDetailEntity tide)
        {
            tide.ThrowInDetailID = (new BaseDAL()).GenerateTableID("STD");
            StringBuilder sb = new StringBuilder(" insert into dbo.SAL_ThrowInDetail ( STD_ID, STI_ID, CP_ID, STD_SinglePrice, STD_MinPrice, STD_MeasureMode, STD_CutLength, STD_PackingNum, STD_SingleW, STD_Num, STD_UnitN, STD_Weight, STD_UnitW, STD_Volume, STD_UnitV, STD_ChargeSign, STD_Remark, STD_CurN, STD_CurW, STD_CurV, STD_FroN, STD_FroW, STD_FroV, STD_PFroN, STD_PFroW, STD_PFroV, STD_Description, STD_IfDel, STD_UpdateTime, STD_BatNo ) values ( ");
            sb.AppendFormat(" '{0}',", tide.ThrowInDetailID);
            sb.AppendFormat(" '{0}',", tide.ThrowInID);
            sb.AppendFormat(" '{0}',", tide.ProductID);
            sb.AppendFormat(" '{0}',", tide.SinglePrice);
            sb.AppendFormat(" '{0}',", tide.MinPrice);
            sb.AppendFormat(" '{0}',", tide.MeasureMode);
            sb.AppendFormat(" '{0}',", tide.CutLength);
            sb.AppendFormat(" '{0}',", tide.PackingNum);
            sb.AppendFormat(" '{0}',", tide.SingleWeight);
            sb.AppendFormat(" '{0}',", tide.Num);
            sb.AppendFormat(" '{0}',", tide.UnitNum);
            sb.AppendFormat(" '{0}',", tide.Weight);
            sb.AppendFormat(" '{0}',", tide.UnitWeight);
            sb.AppendFormat(" '{0}',", tide.Volume);
            sb.AppendFormat(" '{0}',", tide.UnitVolume);
            sb.AppendFormat(" '{0}',", tide.ChargeSign);
            sb.AppendFormat(" '{0}',", tide.Remark);
            sb.AppendFormat(" '{0}',", tide.CurNum);
            sb.AppendFormat(" '{0}',", tide.CurWeight);
            sb.AppendFormat(" '{0}',", tide.CurVolume);
            sb.AppendFormat(" '{0}',", tide.FrozenNum);
            sb.AppendFormat(" '{0}',", tide.FrozenWeight);
            sb.AppendFormat(" '{0}',", tide.FrozenVolume);
            sb.AppendFormat(" '{0}',", tide.PersonFrozenNum);
            sb.AppendFormat(" '{0}',", tide.PersonFrozenWeight);
            sb.AppendFormat(" '{0}',", tide.PersonFrozenVolume);
            sb.AppendFormat(" '{0}',", tide.NumDescription);
            sb.AppendFormat(" '{0}',", tide.IfDel);
            tide.UpdateTime = DateTime.Now;
            tide.TempTime = tide.UpdateTime;
            sb.AppendFormat(" '{0}',", tide.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss"));
            sb.AppendFormat(" '{0}' )", tide.BatNo);

            SqlDataHelper.ExecSqlWithTips(sb.ToString(), Tips.THROWINDETAIL_INSERT_FAILED);
            return tide;
        }
···
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,837评论 18 139
  • 原文地址:http://my.oschina.net/aaron74/blog/282304?fromerr=SL...
    Lucky_Micky阅读 5,622评论 3 17
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,820评论 25 708
  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,739评论 18 399
  • Java分层概念(转) 原文地址(也不属于原文吧,这也是别人转载的不知道原作者是谁,如有侵权,请联系,以删除):h...
    小小世界R阅读 1,651评论 0 0