1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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.Tools;
- using LJLib.DAL.SQL;
- using LJLib.Net.SPI.Server;
- namespace JLHHJSvr.Excutor
- {
- internal sealed class GetMattressSubspecsExcutor : ExcutorBase<GetMattressSubspecsRequest, GetMattressSubspecsResponse>
- {
- protected override void ExcuteInternal(GetMattressSubspecsRequest request, object state, GetMattressSubspecsResponse rslt)
- {
- var tokendata = BllHelper.GetToken(request.token);
- if (tokendata == null)
- {
- rslt.ErrMsg = "会话已经中断,请重新登录";
- return;
- }
- if (request.mattressid == 0)
- {
- rslt.ErrMsg = "床垫id不能为0";
- return;
- }
- using (var con = new SqlConnection(GlobalVar.ConnectionString))
- using (var cmd = con.CreateCommand())
- {
- con.Open();
- using (cmd.Transaction = con.BeginTransaction())
- {
- var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
- var subspecsList = new List<u_mattress>();
- var result = new List<u_mattress_mx_subspecs>();
- var fields = "mattress_width,mattress_length,mattress_height,mattressname,mattressrelcode";
- if (request.type == 0)
- {
- fields += ",mattressid,mattresscode,parentid,erp_mtrlid,erp_mtrlcode,erp_configcodetype, erp_mtrlengname, erp_mtrlmode, erp_mtrlname, erp_mtrltype, erp_mtrltypeid, erp_mtrlunit, erp_piccode";
- }
- //获取副规格列表
- subspecsList = helper.GetMattressSubspecs(request.mattressid, fields);
- if (subspecsList.Count > 0)
- {
- rslt.bednetMxs = new List<u_mattress_mx_mtrl>();
- rslt.mtrllist = new List<u_mattress_mx_mtrl>();
- foreach (var mattrss in subspecsList)
- {
- //获取弹簧排列
- List<u_mattress_mx_mtrl> bednetmxList = helper.GetMattressSubspecsBednet(mattrss.mattressid);
- rslt.bednetMxs = rslt.bednetMxs.Concat(bednetmxList).ToList();
- //判断是否有主副规格调整物料
- List<u_mattress_mx_mtrl> mtrlList = helper.GetMattressMxSubspecsMtrl(mattrss.mattressid);
- rslt.mtrllist = rslt.mtrllist.Concat(mtrlList).ToList();
- }
- }
- rslt.mattresses = subspecsList;
- }
- }
- }
- }
- }
|