|
@@ -0,0 +1,95 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Data.SqlClient;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using DirectService.Tools;
|
|
|
+using JLHHJSvr.BLL;
|
|
|
+using JLHHJSvr.Com;
|
|
|
+using JLHHJSvr.Com.Model;
|
|
|
+using JLHHJSvr.Helper;
|
|
|
+using JLHHJSvr.LJException;
|
|
|
+using JLHHJSvr.LJFramework.Tools;
|
|
|
+using JLHHJSvr.Tools;
|
|
|
+using LJLib.DAL.SQL;
|
|
|
+using LJLib.Net.SPI.Server;
|
|
|
+
|
|
|
+namespace JLHHJSvr.Excutor
|
|
|
+{
|
|
|
+ internal sealed class GetComputeBednetExcutor : ExcutorBase<GetComputeBednetRequest, GetComputeBednetResponse>
|
|
|
+ {
|
|
|
+ Dictionary<string, object> replacements = new Dictionary<string, object>();
|
|
|
+
|
|
|
+ protected override void ExcuteInternal(GetComputeBednetRequest request, object state, GetComputeBednetResponse rslt)
|
|
|
+ {
|
|
|
+ var tokendata = BllHelper.GetToken(request.token);
|
|
|
+ if (tokendata == null)
|
|
|
+ {
|
|
|
+ rslt.ErrMsg = "会话已经中断,请重新登录";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (request.bednet == null)
|
|
|
+ {
|
|
|
+ rslt.ErrMsg = "缺少主表信息";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (request.bednet.bednettypeid <= 0)
|
|
|
+ {
|
|
|
+ rslt.ErrMsg = "请选择床网类型";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (request.bednetMx == null || !request.bednetMx.Any())
|
|
|
+ {
|
|
|
+ rslt.ErrMsg = "缺少报价明细";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 检查是否填写床网高度
|
|
|
+
|
|
|
+ foreach (var mx in request.bednetMx)
|
|
|
+ {
|
|
|
+ if (mx.bednet_height == null || mx.bednet_height <= 0)
|
|
|
+ {
|
|
|
+ rslt.ErrMsg = "请填写床网高";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ request.bednet.mattress_height = mx.bednet_height;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ using (var con = new SqlConnection(GlobalVar.ConnectionString))
|
|
|
+ using (var cmd = con.CreateCommand())
|
|
|
+ {
|
|
|
+ con.Open();
|
|
|
+
|
|
|
+ // 初始化属性
|
|
|
+ AutoInit.AutoInitS(cmd, request.bednet);
|
|
|
+
|
|
|
+ foreach(var mx in request.bednetMx)
|
|
|
+ {
|
|
|
+ AutoInit.AutoInitS(cmd, mx);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var mx in request.spring)
|
|
|
+ {
|
|
|
+ AutoInit.AutoInitS(cmd, mx);
|
|
|
+ }
|
|
|
+
|
|
|
+ var helper = HelperBase.GetHelper<BedNetHelper>(cmd,new HelperBase.Context() { tokendata = tokendata});
|
|
|
+
|
|
|
+ helper.CalCulateFormula(request.bednet, request.bednetMx, request.spring);
|
|
|
+ var replacements = helper.Replacements;
|
|
|
+ rslt.replace = new List<Replacement>();
|
|
|
+
|
|
|
+ // 访问和遍历列表
|
|
|
+ foreach (var item in helper.Replacements)
|
|
|
+ {
|
|
|
+ rslt.replace.Add(new Replacement { label = item.Key, value = item.Value });
|
|
|
+ }
|
|
|
+
|
|
|
+ rslt.bednet = request.bednet;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|