GCS SERVER 服務(wù)端數(shù)據(jù)走向

Paste_Image.png

以DayliBusiness類 SaveThrowInBill()為例

Contract服務(wù)層


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 業(yè)務(wù)邏輯層

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("日常業(yè)務(wù)", "投放單", "新增", 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;
        }
···
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末踱承,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 211,123評(píng)論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件懈糯,死亡現(xiàn)場(chǎng)離奇詭異赊颠,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)鸭轮,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,031評(píng)論 2 384
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)橄霉,“玉大人窃爷,你說(shuō)我怎么就攤上這事⌒辗洌” “怎么了按厘?”我有些...
    開封第一講書人閱讀 156,723評(píng)論 0 345
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)钱慢。 經(jīng)常有香客問我逮京,道長(zhǎng),這世上最難降的妖魔是什么束莫? 我笑而不...
    開封第一講書人閱讀 56,357評(píng)論 1 283
  • 正文 為了忘掉前任懒棉,我火速辦了婚禮,結(jié)果婚禮上览绿,老公的妹妹穿的比我還像新娘策严。我一直安慰自己,他們只是感情好饿敲,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,412評(píng)論 5 384
  • 文/花漫 我一把揭開白布妻导。 她就那樣靜靜地躺著,像睡著了一般怀各。 火紅的嫁衣襯著肌膚如雪倔韭。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,760評(píng)論 1 289
  • 那天瓢对,我揣著相機(jī)與錄音狐肢,去河邊找鬼。 笑死沥曹,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的碟联。 我是一名探鬼主播妓美,決...
    沈念sama閱讀 38,904評(píng)論 3 405
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼鲤孵!你這毒婦竟也來(lái)了壶栋?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,672評(píng)論 0 266
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤普监,失蹤者是張志新(化名)和其女友劉穎贵试,沒想到半個(gè)月后琉兜,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,118評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡毙玻,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,456評(píng)論 2 325
  • 正文 我和宋清朗相戀三年豌蟋,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片桑滩。...
    茶點(diǎn)故事閱讀 38,599評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡梧疲,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出运准,到底是詐尸還是另有隱情幌氮,我是刑警寧澤,帶...
    沈念sama閱讀 34,264評(píng)論 4 328
  • 正文 年R本政府宣布胁澳,位于F島的核電站该互,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏韭畸。R本人自食惡果不足惜宇智,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,857評(píng)論 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望陆盘。 院中可真熱鬧普筹,春花似錦、人聲如沸隘马。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,731評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)酸员。三九已至蜒车,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間幔嗦,已是汗流浹背酿愧。 一陣腳步聲響...
    開封第一講書人閱讀 31,956評(píng)論 1 264
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留邀泉,地道東北人嬉挡。 一個(gè)月前我還...
    沈念sama閱讀 46,286評(píng)論 2 360
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像汇恤,于是被迫代替她去往敵國(guó)和親庞钢。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,465評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理因谎,服務(wù)發(fā)現(xiàn)基括,斷路器,智...
    卡卡羅2017閱讀 134,628評(píng)論 18 139
  • 原文地址:http://my.oschina.net/aaron74/blog/282304?fromerr=SL...
    Lucky_Micky閱讀 5,590評(píng)論 3 17
  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 171,744評(píng)論 25 707
  • 1. Java基礎(chǔ)部分 基礎(chǔ)部分的順序:基本語(yǔ)法财岔,類相關(guān)的語(yǔ)法风皿,內(nèi)部類的語(yǔ)法河爹,繼承相關(guān)的語(yǔ)法,異常的語(yǔ)法桐款,線程的語(yǔ)...
    子非魚_t_閱讀 31,598評(píng)論 18 399
  • Java分層概念(轉(zhuǎn)) 原文地址(也不屬于原文吧咸这,這也是別人轉(zhuǎn)載的不知道原作者是誰(shuí),如有侵權(quán)鲁僚,請(qǐng)聯(lián)系炊苫,以刪除):h...
    小小世界R閱讀 1,631評(píng)論 0 0