|
@@ -338,98 +338,11 @@ namespace JLHHJSvr.Helper
|
|
|
}
|
|
|
public void MattressInterfaceFindERPPz(u_mattress mattress,List<u_mattress_interface> interfaceList)
|
|
|
{
|
|
|
- var resultList = new List<erp_configure_code>();
|
|
|
- var typeList = new List<erp_configure_code>();
|
|
|
- foreach (var item in interfaceList)
|
|
|
- {
|
|
|
- typeList.Add(new erp_configure_code() { typeid = mattress.erp_configcodetype, name = item.bj_pzname });
|
|
|
- }
|
|
|
-
|
|
|
- var configure_Type = new u_configure_type() { contfigtypeid = mattress.erp_configcodetype };
|
|
|
- if (DbSqlHelper.SelectOne(cmd, configure_Type, "contfigtypeid") == 1)
|
|
|
- {
|
|
|
- var names = new List<string>();
|
|
|
- foreach (var item in typeList)
|
|
|
- {
|
|
|
- if (!names.Contains(item.name))
|
|
|
- {
|
|
|
- names.Add(item.name);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 查询核价系统的配置资料定义
|
|
|
- cmd.CommandText = @"SELECT u_configure_code.pzid
|
|
|
- ,u_configure_code.pzcode
|
|
|
- ,u_configure_code.name
|
|
|
- ,u_configure_code.inputtype
|
|
|
- FROM u_configure_code
|
|
|
- WHERE u_configure_code.typeid = @configcodetype
|
|
|
- AND u_configure_code.name IN " + ListEx.getString(names) ;
|
|
|
- cmd.Parameters.Clear();
|
|
|
- cmd.Parameters.AddWithValue("@configcodetype", mattress.erp_configcodetype);
|
|
|
- using (var reader = cmd.ExecuteReader())
|
|
|
- {
|
|
|
- while (reader.Read())
|
|
|
- {
|
|
|
- var item = new erp_configure_code()
|
|
|
- {
|
|
|
- pzid = Convert.ToInt32(reader["pzid"]),
|
|
|
- pzcode = Convert.ToString(reader["pzcode"]),
|
|
|
- name = Convert.ToString(reader["name"]).Trim(),
|
|
|
- inputtype = Convert.ToInt32(reader["inputtype"])
|
|
|
- };
|
|
|
- resultList.Add(item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // 查询L1部件选配
|
|
|
- var erpHelper = HelperBase.GetHelper<ERPHelper>(null);
|
|
|
- var parameters = new JObject();
|
|
|
- parameters.Add("typeList", JToken.FromObject(typeList));
|
|
|
- resultList = erpHelper.GetERPList<erp_configure_code>("GetL1ConfigureCode", parameters);
|
|
|
- }
|
|
|
-
|
|
|
- for (var i = 0; i < interfaceList.Count; i++)
|
|
|
- {
|
|
|
- interfaceList[i].printid = i + 1;
|
|
|
-
|
|
|
- foreach (var result in resultList)
|
|
|
- {
|
|
|
- if (interfaceList[i].bj_pzname == result.name)
|
|
|
- {
|
|
|
- if (result.pzid > 0)
|
|
|
- {
|
|
|
- interfaceList[i].erp_pzid = result.pzid;
|
|
|
- interfaceList[i].erp_pzcode = result.pzcode;
|
|
|
- interfaceList[i].erp_pzname = result.name;
|
|
|
- }
|
|
|
-
|
|
|
- if (interfaceList[i].bj_inputtype != 2) interfaceList[i].bj_inputtype = result.inputtype;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ InterfaceFindERPPz(mattress.erp_configcodetype.Value, interfaceList);
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 初始化配置信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="itemname"></param>
|
|
|
- /// <param name="bj_pzname"></param>
|
|
|
- /// <param name="inputtype"></param>
|
|
|
- /// <param name="names"></param>
|
|
|
- /// <returns></returns>
|
|
|
public u_mattress_interface InserMattressInterfacePz(string itemname, string bj_pzname, byte inputtype, string[] names)
|
|
|
{
|
|
|
- var mattress_interface = new u_mattress_interface()
|
|
|
- {
|
|
|
- itemname = itemname,
|
|
|
- bj_pzname = bj_pzname,
|
|
|
- bj_inputtype = inputtype,
|
|
|
- bj_namemx = names == null ? string.Empty : SetInterfacePzName(names)
|
|
|
- };
|
|
|
-
|
|
|
- return mattress_interface;
|
|
|
+ return InserInterfacePz<u_mattress_interface>(itemname,bj_pzname,inputtype,names);
|
|
|
}
|
|
|
private string SetInterfacePzName(string[] names)
|
|
|
{
|
|
@@ -671,28 +584,7 @@ namespace JLHHJSvr.Helper
|
|
|
interfaceList.Add(InserMattressInterfacePz(chastrArr[0], name, 1, new string[] { "" }));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- //private bool ifHasXiaoceMtrl()
|
|
|
- //{
|
|
|
- // bool hasVal = false;
|
|
|
- // for (int i = 0; i < XiaoCePeizhi.GetLength(0); i++)
|
|
|
- // {
|
|
|
- // for (int j = 0; j < XiaoCePeizhi.GetLength(1); j++)
|
|
|
- // {
|
|
|
- // if (!string.IsNullOrEmpty(XiaoCePeizhi[i, j]))
|
|
|
- // {
|
|
|
- // hasVal = true;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (hasVal)
|
|
|
- // {
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return hasVal;
|
|
|
- //}
|
|
|
|
|
|
private void SetFormulaTypeZeroPzName(u_mattress_mx_mtrl mx, string key, int[] powerArr, string[] name_arr)
|
|
|
{
|
|
@@ -752,43 +644,6 @@ namespace JLHHJSvr.Helper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //var orderedKeys = new List<string>();
|
|
|
- //foreach (var kind in kindDict)
|
|
|
- //{
|
|
|
- // foreach (var cha in chastrSet)
|
|
|
- // {
|
|
|
- // orderedKeys.Add($"{cha}-{kind.Value}");
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //foreach (var key in orderedKeys)
|
|
|
- //{
|
|
|
- // var parts = key.Split('-');
|
|
|
- // var cha = parts[0];
|
|
|
- // var kindName = parts[1];
|
|
|
-
|
|
|
- // var kindId = kindDict.FirstOrDefault(x => x.Value == kindName).Key;
|
|
|
- // var items = diancengList.Where(mx =>
|
|
|
- // mx.chastr == cha &&
|
|
|
- // mx.formulakind == kindId);
|
|
|
-
|
|
|
- // foreach (var mx in items)
|
|
|
- // {
|
|
|
- // if (mx.formulakind == 999)
|
|
|
- // {
|
|
|
- // this.ProcessChuangWangPz(mx, interfaceList, mx.chastr, ++countDict[key]);
|
|
|
- // }
|
|
|
- // else if (mx.mtrlid > 0 && mx.formulakind == 1201)
|
|
|
- // {
|
|
|
- // this.ProcessDingbuLianMianPz(mx, interfaceList, mx.chastr, ++countDict[key]);
|
|
|
- // }
|
|
|
- // else if (mx.mtrlid > 0 && new int[] { 32, 12, 13, 14, 29 }.Contains(mx.formulakind.Value))
|
|
|
- // {
|
|
|
- // this.ProcessWangMianBLPz(mx, interfaceList, mx.chastr, kindDict[mx.formulakind.Value], ++countDict[key]);
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
foreach (var mx in diancengList)
|
|
|
{
|
|
|
var key = $"{mx.chastr}-{kindDict[mx.formulakind.Value]}";
|
|
@@ -1180,72 +1035,7 @@ namespace JLHHJSvr.Helper
|
|
|
/// <param name="interfaceList"></param>
|
|
|
public void MattressInterfaceFindERPPrdPf(List<u_mattress_interface_qd> qdList,List<u_mattress_interface> interfaceList = null)
|
|
|
{
|
|
|
- var mtrlidList = new List<int>();
|
|
|
- foreach (var mx in qdList)
|
|
|
- {
|
|
|
- // 带出有设置 的erp_mtrlid
|
|
|
- if ((mx.erp_mtrlid == null || mx.erp_mtrlid == 0) && mx.mtrlid != null && mx.mtrlid > 0)
|
|
|
- {
|
|
|
- var mtrldef = new u_mtrl_price() { mtrlid = mx.mtrlid };
|
|
|
- if (DbSqlHelper.SelectOne(cmd, mtrldef, "erp_mtrlid") == 1)
|
|
|
- {
|
|
|
- mx.erp_mtrlid = mtrldef.erp_mtrlid;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //
|
|
|
- if (mx.erp_mtrlid > 0)
|
|
|
- {
|
|
|
- mtrlidList.Add(mx.erp_mtrlid.Value);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (mtrlidList.Count > 0)
|
|
|
- {
|
|
|
- var erpHelper = HelperBase.GetHelper<ERPHelper>(null);
|
|
|
- //var parameters = new JObject();
|
|
|
- //parameters.Add("mtrlids", JToken.FromObject(mtrlidList));
|
|
|
- //var resultList = erpHelper.GetERPList<erp_mtrldef>("GetL1Mtrldef", parameters);
|
|
|
- var total = 0;
|
|
|
- var resultList = erpHelper.GetERPMtrldef(cmd, ref total, "", new L1Mtrldef(), 0, 0, 1, mtrlidList);
|
|
|
-
|
|
|
- if (resultList != null && resultList.Any())
|
|
|
- {
|
|
|
- foreach (var mx in qdList)
|
|
|
- {
|
|
|
- var result = resultList.FirstOrDefault(o => o.mtrlid == mx.erp_mtrlid);
|
|
|
- if (result != null)
|
|
|
- {
|
|
|
- mx.erp_mtrlcode = result.mtrlcode;
|
|
|
- mx.erp_mtrlname = result.mtrlname;
|
|
|
- mx.erp_mtrlmode = result.mtrlmode;
|
|
|
- mx.erp_unit = result.unit;
|
|
|
- mx.erp_mtrlengname = result.zxmtrlmode;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //更新 二级明细项目 需要产品配置列表,此部分由前端完成
|
|
|
- if (interfaceList != null && interfaceList.Any())
|
|
|
- {
|
|
|
- // 使用 GroupBy 去重并选择第一个元素
|
|
|
- var distinctList = interfaceList
|
|
|
- .GroupBy(mb => mb.bj_pzname)
|
|
|
- .Select(g => g.First())
|
|
|
- .ToList();
|
|
|
- Dictionary<string, u_mattress_interface> interfaceDict = distinctList.ToDictionary(mb => mb.bj_pzname, mb => mb);
|
|
|
- foreach (var mx in qdList)
|
|
|
- {
|
|
|
- if (interfaceDict.TryGetValue(mx.bj_pzname, out var mb))
|
|
|
- {
|
|
|
- mx.bj_pzname_mx_mx = mb.bj_namemx;
|
|
|
-
|
|
|
- if (mx.ss_rate == 0) mx.ss_rate = mb.ss_rate;
|
|
|
- if (mx.ls_rate == 0) mx.ls_rate = mb.ls_rate;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ InterfaceFindERPPrdPf(qdList,interfaceList);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 导入产品清单
|
|
@@ -1770,8 +1560,363 @@ namespace JLHHJSvr.Helper
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+ #region 床网清单
|
|
|
+ /// <summary>
|
|
|
+ /// 床垫接口-保存
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattress"></param>
|
|
|
+ /// <param name="mxlist"></param>
|
|
|
+ /// <param name="qdlist"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void SaveBedNetInterface(u_bednet bednet, List<u_bednet_interface> mxlist, List<u_bednet_interface_qd> qdlist)
|
|
|
+ {
|
|
|
+ if (bednet.bednetid <= 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("错误的床网id");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bednet.erp_mtrltypeid == null || bednet.erp_mtrltypeid <= 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("请选择物料类别!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bednet.erp_configcodetype == null || bednet.erp_configcodetype <= 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("请选择配置类型!");
|
|
|
+ }
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, bednet, "erp_mtrlid,erp_mtrltypeid,erp_mtrlcode,erp_mtrlname,erp_mtrlmode,erp_mtrltype,erp_mtrlunit,erp_mtrlengname,erp_configcodetype,old_mtrlname");
|
|
|
+
|
|
|
+ // 保存接口数据
|
|
|
+ var bednetHelper = GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = context.tokendata });
|
|
|
+ bednetHelper.SaveBedNetInterface(bednet.bednetid.Value, mxlist, qdlist);
|
|
|
+ }
|
|
|
+ public List<u_bednet_interface> GetBedNetInterfaceList(int bednetid)
|
|
|
+ {
|
|
|
+ var interfaceList = new List<u_bednet_interface>();
|
|
|
+ var selectStr = @"SELECT bednetid
|
|
|
+ ,printid
|
|
|
+ ,itemname
|
|
|
+ ,bj_pzname
|
|
|
+ ,bj_namemx
|
|
|
+ ,actual_size
|
|
|
+ ,erp_pzid
|
|
|
+ ,Space(200) AS erp_pzcode
|
|
|
+ ,Space(200) AS erp_pzname
|
|
|
+ ,bj_inputtype AS erp_inputtype
|
|
|
+ FROM u_bednet_interface";
|
|
|
+ DbSqlHelper.SelectJoin(cmd, selectStr, "bednetid = @bednetid", new Dictionary<string, object>() { { "@bednetid", bednetid } }, "printid", "bednetid,printid,itemname,bj_pzname,bj_namemx,actual_size,erp_pzid,ss_rate,ls_rate,bj_inputtype", 0, 0, interfaceList);
|
|
|
+
|
|
|
+ if (interfaceList.Count <= 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ interfaceList = RefreshBedNetInterfaceList(bednetid);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BedNetInterfaceFindERPPz(bednetid,interfaceList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return interfaceList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<u_bednet_interface> RefreshBedNetInterfaceList(int bednetid)
|
|
|
+ {
|
|
|
+ var interfaceList = new List<u_bednet_interface>();
|
|
|
+
|
|
|
+ // 导入配置
|
|
|
+ ImportBedNetInterfaceList(bednetid, interfaceList);
|
|
|
+
|
|
|
+ BedNetInterfaceFindERPPz(bednetid, interfaceList);
|
|
|
+ return interfaceList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<u_bednet_interface> RefreshBedNetInterfaceList(int bednetid,int configcodetype)
|
|
|
+ {
|
|
|
+ var interfaceList = new List<u_bednet_interface>();
|
|
|
+
|
|
|
+ // 导入配置
|
|
|
+ ImportBedNetInterfaceList(bednetid, interfaceList);
|
|
|
+ InterfaceFindERPPz(configcodetype, interfaceList);
|
|
|
+ return interfaceList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ImportBedNetInterfaceList(int bednetid, List<u_bednet_interface> interfaceList)
|
|
|
+ {
|
|
|
+ if (bednetid <= 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床网id有误");
|
|
|
+ }
|
|
|
+
|
|
|
+ var bednetHelper = GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = context.tokendata });
|
|
|
+ //var bednet = bednetHelper.GetBedNet(bednetid);
|
|
|
+ var qdlist = bednetHelper.GetBedNetQingDan(bednetid);
|
|
|
+
|
|
|
+ foreach(var qd in qdlist)
|
|
|
+ {
|
|
|
+ interfaceList.Add(InserBedNetInterfacePz("床网",qd.pzname,2,new string[] { qd.pznamemx }));
|
|
|
+ }
|
|
|
+ // 床网名称
|
|
|
+ // 床网类型 NOTES: 床网类型 袋装网需要区分x区
|
|
|
+ // 床网规格
|
|
|
+ // 床网排序
|
|
|
+ // 床网高度
|
|
|
+ // 弹簧线径/高度/口径/中心直径/圈数
|
|
|
+ // 多区弹簧1/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧1排列数(长)
|
|
|
+ // 多区弹簧2/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧2排列数(长)
|
|
|
+ // 多区弹簧3/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧3排列数(长)
|
|
|
+ // 多区弹簧4/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧4排列数(长)
|
|
|
+ // 多区弹簧5/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧5排列数(长)
|
|
|
+ // 边铁条数
|
|
|
+ // 底面无纺布
|
|
|
+ // 入袋无纺布
|
|
|
+ // 上垫层物料
|
|
|
+ // 下垫层物料
|
|
|
+ // 四周加硬排数
|
|
|
+ // 四周加硬线径/高度/口径/中心直径/圈数
|
|
|
+ // 海绵包边物料
|
|
|
+ // 海绵包边物料厚度
|
|
|
+ // 填充海绵物料
|
|
|
+ // 填充包边物料厚度
|
|
|
+ // 封边物料
|
|
|
+ // 封边高度
|
|
|
+ // 胶条
|
|
|
+ // 包角
|
|
|
+ // 海绵打孔
|
|
|
+ // 加弹叉数量
|
|
|
+ // 15分布条
|
|
|
+ // 蛇线线径
|
|
|
+ // 四周口袋弹簧排数
|
|
|
+ // 四周口袋线径/高度/口径/中心直径/圈数
|
|
|
+ // 床网说明
|
|
|
+ // 包装方式
|
|
|
+ // 包装数量
|
|
|
+ // 包装材料
|
|
|
+ // 多区弹簧6/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧7/线径/口径/中心直径/圈数
|
|
|
+ // 多区弹簧6排列数(长)
|
|
|
+ // 多区弹簧7排列数(长)
|
|
|
+ }
|
|
|
+
|
|
|
+ public void BedNetInterfaceFindERPPz(int bednetid, List<u_bednet_interface> interfaceList)
|
|
|
+ {
|
|
|
+ var bednet = new u_bednet() { bednetid = bednetid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, bednet, "erp_configcodetype");
|
|
|
+ InterfaceFindERPPz(bednet.erp_configcodetype.Value, interfaceList);
|
|
|
+ }
|
|
|
+ public u_bednet_interface InserBedNetInterfacePz(string itemname, string bj_pzname, byte inputtype, string[] names)
|
|
|
+ {
|
|
|
+ return InserInterfacePz<u_bednet_interface>(itemname, bj_pzname, inputtype, names);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 刷新床网产品配置清单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="bednetid"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<u_bednet_interface_qd> RefreshBedNetInterfaceQdList(int bednetid)
|
|
|
+ {
|
|
|
+ var qdList = new List<u_bednet_interface_qd>();
|
|
|
+ ImportBedNetInterfaceQdList(bednetid, qdList);
|
|
|
+ InterfaceFindERPPrdPf<u_bednet_interface_qd, u_bednet_interface>(qdList);
|
|
|
+ return qdList;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 导入产品清单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="bednetid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void ImportBedNetInterfaceQdList(int bednetid, List<u_bednet_interface_qd> qdList)
|
|
|
+ {
|
|
|
+ if (bednetid <= 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床网id有误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 通用方法
|
|
|
/// <summary>
|
|
|
+ /// wf_fine_erp_prdpf
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="qdList"></param>
|
|
|
+ /// <param name="interfaceList"></param>
|
|
|
+ public void InterfaceFindERPPrdPf<T, S>(List<T> qdList, List<S> interfaceList = null) where T : BaseInterfaceQd where S : BaseInterface
|
|
|
+ {
|
|
|
+ var mtrlidList = new List<int>();
|
|
|
+ foreach (var mx in qdList)
|
|
|
+ {
|
|
|
+ // 带出有设置 的erp_mtrlid
|
|
|
+ if (mx.erp_mtrlid == 0 && mx.mtrlid != null && mx.mtrlid > 0)
|
|
|
+ {
|
|
|
+ var mtrldef = new u_mtrl_price() { mtrlid = mx.mtrlid };
|
|
|
+ if (DbSqlHelper.SelectOne(cmd, mtrldef, "erp_mtrlid") == 1)
|
|
|
+ {
|
|
|
+ mx.erp_mtrlid = mtrldef.erp_mtrlid;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mx.erp_mtrlid > 0)
|
|
|
+ {
|
|
|
+ mtrlidList.Add(mx.erp_mtrlid.Value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mtrlidList.Count > 0)
|
|
|
+ {
|
|
|
+ var erpHelper = HelperBase.GetHelper<ERPHelper>(null);
|
|
|
+ var total = 0;
|
|
|
+ var resultList = erpHelper.GetERPMtrldef(cmd, ref total, "", new L1Mtrldef(), 0, 0, 1, mtrlidList);
|
|
|
+
|
|
|
+ if (resultList != null && resultList.Any())
|
|
|
+ {
|
|
|
+ foreach (var mx in qdList)
|
|
|
+ {
|
|
|
+ var result = resultList.FirstOrDefault(o => o.mtrlid == mx.erp_mtrlid);
|
|
|
+ if (result != null)
|
|
|
+ {
|
|
|
+ mx.erp_mtrlcode = result.mtrlcode;
|
|
|
+ mx.erp_mtrlname = result.mtrlname;
|
|
|
+ mx.erp_mtrlmode = result.mtrlmode;
|
|
|
+ mx.erp_unit = result.unit;
|
|
|
+ mx.erp_mtrlengname = result.zxmtrlmode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新 二级明细项目 需要产品配置列表,此部分由前端完成
|
|
|
+ if (interfaceList != null && interfaceList.Any())
|
|
|
+ {
|
|
|
+ // 使用 GroupBy 去重并选择第一个元素
|
|
|
+ var distinctList = interfaceList
|
|
|
+ .GroupBy(mb => mb.bj_pzname)
|
|
|
+ .Select(g => g.First())
|
|
|
+ .ToList();
|
|
|
+ Dictionary<string, S> interfaceDict = distinctList.ToDictionary(mb => mb.bj_pzname, mb => mb);
|
|
|
+ foreach (var mx in qdList)
|
|
|
+ {
|
|
|
+ if (interfaceDict.TryGetValue(mx.bj_pzname, out var mb))
|
|
|
+ {
|
|
|
+ mx.bj_pzname_mx_mx = mb.bj_namemx;
|
|
|
+
|
|
|
+ if (mx is u_mattress_interface_qd mattressMx && mb is u_mattress_interface mattressMx2)
|
|
|
+ {
|
|
|
+ if (mattressMx.ss_rate == 0) mattressMx.ss_rate = mattressMx2.ss_rate;
|
|
|
+ if (mattressMx.ls_rate == 0) mattressMx.ls_rate = mattressMx2.ls_rate;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化配置信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="itemname"></param>
|
|
|
+ /// <param name="bj_pzname"></param>
|
|
|
+ /// <param name="inputtype"></param>
|
|
|
+ /// <param name="names"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public T InserInterfacePz<T>(string itemname, string bj_pzname, byte inputtype, string[] names) where T : BaseInterface, new()
|
|
|
+ {
|
|
|
+ var mattress_interface = new T()
|
|
|
+ {
|
|
|
+ itemname = itemname,
|
|
|
+ bj_pzname = bj_pzname,
|
|
|
+ bj_inputtype = inputtype,
|
|
|
+ bj_namemx = names == null ? string.Empty : SetInterfacePzName(names)
|
|
|
+ };
|
|
|
+
|
|
|
+ return mattress_interface;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 查询清单的配置
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="configcodetype"></param>
|
|
|
+ /// <param name="interfaceList"></param>
|
|
|
+ public void InterfaceFindERPPz<T>(int configcodetype, List<T> interfaceList) where T : BaseInterface
|
|
|
+ {
|
|
|
+ var resultList = new List<erp_configure_code>();
|
|
|
+ var typeList = new List<erp_configure_code>();
|
|
|
+ foreach (var item in interfaceList)
|
|
|
+ {
|
|
|
+ typeList.Add(new erp_configure_code() { typeid = configcodetype, name = item.bj_pzname });
|
|
|
+ }
|
|
|
+
|
|
|
+ var configure_Type = new u_configure_type() { contfigtypeid = configcodetype };
|
|
|
+ if (DbSqlHelper.SelectOne(cmd, configure_Type, "contfigtypeid") == 1)
|
|
|
+ {
|
|
|
+ var names = new List<string>();
|
|
|
+ foreach (var item in typeList)
|
|
|
+ {
|
|
|
+ if (!names.Contains(item.name))
|
|
|
+ {
|
|
|
+ names.Add(item.name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询核价系统的配置资料定义
|
|
|
+ cmd.CommandText = @"SELECT u_configure_code.pzid
|
|
|
+ ,u_configure_code.pzcode
|
|
|
+ ,u_configure_code.name
|
|
|
+ ,u_configure_code.inputtype
|
|
|
+ FROM u_configure_code
|
|
|
+ WHERE u_configure_code.typeid = @configcodetype
|
|
|
+ AND u_configure_code.name IN " + ListEx.getString(names);
|
|
|
+ cmd.Parameters.Clear();
|
|
|
+ cmd.Parameters.AddWithValue("@configcodetype", configcodetype);
|
|
|
+ using (var reader = cmd.ExecuteReader())
|
|
|
+ {
|
|
|
+ while (reader.Read())
|
|
|
+ {
|
|
|
+ var item = new erp_configure_code()
|
|
|
+ {
|
|
|
+ pzid = Convert.ToInt32(reader["pzid"]),
|
|
|
+ pzcode = Convert.ToString(reader["pzcode"]),
|
|
|
+ name = Convert.ToString(reader["name"]).Trim(),
|
|
|
+ inputtype = Convert.ToInt32(reader["inputtype"])
|
|
|
+ };
|
|
|
+ resultList.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 查询L1部件选配
|
|
|
+ var erpHelper = GetHelper<ERPHelper>(null);
|
|
|
+ var parameters = new JObject();
|
|
|
+ parameters.Add("typeList", JToken.FromObject(typeList));
|
|
|
+ resultList = erpHelper.GetERPList<erp_configure_code>("GetL1ConfigureCode", parameters);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (var i = 0; i < interfaceList.Count; i++)
|
|
|
+ {
|
|
|
+ interfaceList[i].printid = i + 1;
|
|
|
+
|
|
|
+ foreach (var result in resultList)
|
|
|
+ {
|
|
|
+ if (interfaceList[i].bj_pzname == result.name)
|
|
|
+ {
|
|
|
+ if (result.pzid > 0)
|
|
|
+ {
|
|
|
+ interfaceList[i].erp_pzid = result.pzid;
|
|
|
+ interfaceList[i].erp_pzcode = result.pzcode;
|
|
|
+ interfaceList[i].erp_pzname = result.name;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (interfaceList[i].bj_inputtype != 2) interfaceList[i].bj_inputtype = result.inputtype;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
/// 用于 字符串 + 字符串格式
|
|
|
/// </summary>
|
|
|
/// <param name="currentString"></param>
|