|
@@ -61,6 +61,8 @@ namespace JLHHJSvr.Excutor
|
|
|
|
|
|
var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
|
|
var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
|
|
|
|
|
|
|
|
+ var helperBednet = HelperBase.GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
|
|
|
|
+
|
|
//try
|
|
//try
|
|
//{
|
|
//{
|
|
// helper.CalCulateFormula(request.mattress, request.mattressMx);
|
|
// helper.CalCulateFormula(request.mattress, request.mattressMx);
|
|
@@ -88,7 +90,7 @@ namespace JLHHJSvr.Excutor
|
|
// {
|
|
// {
|
|
// helper.CopyMattressInterface(request.mattress.copy_id.Value, request.mattress.mattressid);
|
|
// helper.CopyMattressInterface(request.mattress.copy_id.Value, request.mattress.mattressid);
|
|
// }
|
|
// }
|
|
-
|
|
|
|
|
|
+
|
|
// cmd.Transaction.Commit();
|
|
// cmd.Transaction.Commit();
|
|
|
|
|
|
// rslt.mattressid = request.mattress.mattressid;
|
|
// rslt.mattressid = request.mattress.mattressid;
|
|
@@ -131,8 +133,10 @@ namespace JLHHJSvr.Excutor
|
|
|
|
|
|
if (request.subspecs != null && request.subspecs.Count > 0)
|
|
if (request.subspecs != null && request.subspecs.Count > 0)
|
|
{
|
|
{
|
|
|
|
+ // 排序:宽、长,从小到大
|
|
|
|
+ var _subspecs = request.subspecs.OrderBy(o => o.mattress_width).ThenBy(o => o.mattress_length).ToList();
|
|
// 副规格
|
|
// 副规格
|
|
- foreach (var submx in request.subspecs)
|
|
|
|
|
|
+ foreach (var submx in _subspecs)
|
|
{
|
|
{
|
|
var _mattress = ObjectHelper.DeepCopy(request.mattress);
|
|
var _mattress = ObjectHelper.DeepCopy(request.mattress);
|
|
_mattress.parentid = request.mattress.mattressid;
|
|
_mattress.parentid = request.mattress.mattressid;
|
|
@@ -145,12 +149,107 @@ namespace JLHHJSvr.Excutor
|
|
var _mattressMx = new List<u_mattress_mx_mtrl>();
|
|
var _mattressMx = new List<u_mattress_mx_mtrl>();
|
|
if (request.mattressMx != null && request.mattressMx.Any())
|
|
if (request.mattressMx != null && request.mattressMx.Any())
|
|
{
|
|
{
|
|
- foreach (var item in request.mattressMx)
|
|
|
|
|
|
+ foreach (var itemMx in request.mattressMx)
|
|
{
|
|
{
|
|
|
|
+ var item = ObjectHelper.DeepCopy(itemMx);
|
|
item.mattressid = _mattress.mattressid;
|
|
item.mattressid = _mattress.mattressid;
|
|
item.mattressmxid = 0;
|
|
item.mattressmxid = 0;
|
|
item.message = "";
|
|
item.message = "";
|
|
|
|
|
|
|
|
+ #region 副规格床网自动匹配/新增逻辑
|
|
|
|
+ if (item.formulatype == 99 && item.mtrlid > 0)
|
|
|
|
+ {
|
|
|
|
+ var oBednet = new u_bednet();
|
|
|
|
+ var _bednet = helperBednet.GetBedNet(item.mtrlid.Value);
|
|
|
|
+ var _bednetMx = helperBednet.GetBedNetMxList(item.mtrlid.Value);
|
|
|
|
+ var _bednetSpring = helperBednet.GetBedNetSpringList(item.mtrlid.Value);
|
|
|
|
+
|
|
|
|
+ _bednet.mattress_width = submx.mattress_width - (request.mattress.mattress_width - _bednet.mattress_width);
|
|
|
|
+ _bednet.mattress_length = submx.mattress_length - (request.mattress.mattress_length - _bednet.mattress_length);
|
|
|
|
+
|
|
|
|
+ if (_bednetMx.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ cmd.CommandText = @"SELECT TOP 1 u_bednet.bednetid
|
|
|
|
+ ,u_bednet_type.typename
|
|
|
|
+ ,bednetcode
|
|
|
|
+ ,mattress_width
|
|
|
|
+ ,mattress_length
|
|
|
|
+ ,mattress_height
|
|
|
|
+ ,nottax_factory_cost
|
|
|
|
+ FROM u_bednetmx
|
|
|
|
+ INNER JOIN u_bednet on u_bednet.bednetid = u_bednetmx.bednetid
|
|
|
|
+ INNER JOIN u_bednet_type on u_bednet_type.bednettypeid = u_bednet.bednettypeid
|
|
|
|
+ WHERE u_bednet.bednettypeid = @bednettypeid
|
|
|
|
+ AND u_bednet.mattress_width = @mattress_width
|
|
|
|
+ AND u_bednet.mattress_length = @mattress_length
|
|
|
|
+ AND u_bednetmx.bednet_height = @bednet_height
|
|
|
|
+ AND u_bednetmx.springid = @springid
|
|
|
|
+ AND u_bednetmx.spring_qty_width = @spring_qty_width
|
|
|
|
+ AND u_bednetmx.spring_qty_length = @spring_qty_length
|
|
|
|
+ AND u_bednetmx.if_side_iron = @if_side_iron
|
|
|
|
+ AND u_bednetmx.side_iron_qty = @side_iron_qty
|
|
|
|
+ AND u_bednetmx.fabrics2_mtrlid = @fabrics2_mtrlid
|
|
|
|
+ AND u_bednetmx.fabrics1_mtrlid = @fabrics1_mtrlid
|
|
|
|
+ ";
|
|
|
|
+ cmd.Parameters.Clear();
|
|
|
|
+ cmd.Parameters.AddWithValue("@bednettypeid", _bednet.bednettypeid);
|
|
|
|
+ cmd.Parameters.AddWithValue("@mattress_width", _bednet.mattress_width);
|
|
|
|
+ cmd.Parameters.AddWithValue("@mattress_length", _bednet.mattress_length);
|
|
|
|
+ cmd.Parameters.AddWithValue("@bednet_height", _bednetMx[0].bednet_height);
|
|
|
|
+ cmd.Parameters.AddWithValue("@springid", _bednetMx[0].springid);
|
|
|
|
+ cmd.Parameters.AddWithValue("@spring_qty_width", submx.spring_qty_width);
|
|
|
|
+ cmd.Parameters.AddWithValue("@spring_qty_length", submx.spring_qty_length);
|
|
|
|
+ cmd.Parameters.AddWithValue("@if_side_iron", _bednetMx[0].if_side_iron);
|
|
|
|
+ cmd.Parameters.AddWithValue("@side_iron_qty", _bednetMx[0].side_iron_qty);
|
|
|
|
+ cmd.Parameters.AddWithValue("@fabrics2_mtrlid", _bednetMx[0].fabrics2_mtrlid);
|
|
|
|
+ cmd.Parameters.AddWithValue("@fabrics1_mtrlid", _bednetMx[0].fabrics1_mtrlid);
|
|
|
|
+ using (var reader = cmd.ExecuteReader())
|
|
|
|
+ {
|
|
|
|
+ if (reader.Read())
|
|
|
|
+ {
|
|
|
|
+ oBednet = new u_bednet() {
|
|
|
|
+ bednetid = Convert.ToInt32(reader["bednetid"]),
|
|
|
|
+ typename = Convert.ToString(reader["typename"]),
|
|
|
|
+ bednetcode = Convert.ToString(reader["bednetcode"]),
|
|
|
|
+ mattress_width = Convert.ToInt32(reader["mattress_width"]),
|
|
|
|
+ mattress_length = Convert.ToInt32(reader["mattress_length"]),
|
|
|
|
+ mattress_height = Convert.ToInt32(reader["mattress_height"]),
|
|
|
|
+ nottax_factory_cost = Convert.ToDecimal(reader["nottax_factory_cost"])
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 匹配失败,自动新建
|
|
|
|
+ if (oBednet.bednetid == null)
|
|
|
|
+ {
|
|
|
|
+ oBednet = _bednet;
|
|
|
|
+ _bednetMx[0].spring_qty_width = submx.spring_qty_width;
|
|
|
|
+ _bednetMx[0].spring_qty_length = submx.spring_qty_length;
|
|
|
|
+
|
|
|
|
+ oBednet.bednetid = 0;
|
|
|
|
+
|
|
|
|
+ helperBednet.SaveBedNet(oBednet, _bednetMx, _bednetSpring);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var _mtrlname = oBednet.typename +
|
|
|
|
+ " " +
|
|
|
|
+ oBednet.bednetcode +
|
|
|
|
+ " " +
|
|
|
|
+ oBednet.mattress_width +
|
|
|
|
+ "*" +
|
|
|
|
+ oBednet.mattress_length +
|
|
|
|
+ "*" +
|
|
|
|
+ oBednet.mattress_height;
|
|
|
|
+
|
|
|
|
+ item.mtrlid = oBednet.bednetid;
|
|
|
|
+ item.mtrlname = _mtrlname;
|
|
|
|
+ item.price = oBednet.nottax_factory_cost;
|
|
|
|
+ item.qty = 1;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
_mattressMx.Add(item);
|
|
_mattressMx.Add(item);
|
|
}
|
|
}
|
|
}
|
|
}
|