|
@@ -1672,9 +1672,13 @@ namespace JLHHJSvr.Helper
|
|
|
cmpemp = context.tokendata.username,
|
|
|
nottax_dept_cost = mattress.nottax_dept_cost,
|
|
|
dept_cost = mattress.dept_cost,
|
|
|
- foreign_cost = mattress.foreign_cost
|
|
|
+ foreign_cost = mattress.foreign_cost,
|
|
|
+ dannum_cost1 = mattress.dannum_cost1,
|
|
|
+ dannum_cost2 = mattress.dannum_cost2,
|
|
|
+ dannum_cost3 = mattress.dannum_cost3,
|
|
|
+ dannum_cost4 = mattress.dannum_cost4
|
|
|
};
|
|
|
- var fieldsHs = "bednetid_mattressid, typeid, cmpdate, cmpemp, nottax_dept_cost, dept_cost, foreign_cost";
|
|
|
+ var fieldsHs = "bednetid_mattressid, typeid, cmpdate, cmpemp, nottax_dept_cost, dept_cost, foreign_cost, dannum_cost1, dannum_cost2, dannum_cost3, dannum_cost4";
|
|
|
DbSqlHelper.Insert(cmd, "u_his_price", null, hisprice, fieldsHs);
|
|
|
}
|
|
|
public u_mattress GetMattress(int mattressid)
|
|
@@ -2176,6 +2180,157 @@ namespace JLHHJSvr.Helper
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void MattressCalculateCost(u_mattress mattress, List<u_mattress_mx_mtrl> mattressMx, List<u_mattress_mx_extra> extraProcesses, List<u_mattress_mx_extra> extraCosts)
|
|
|
+ {
|
|
|
+ // 没有输入默认按标准计算
|
|
|
+ if (mattress.dannum_type == null || mattress.dannum_type == 0) mattress.dannum_type = 2;
|
|
|
+ // 作为记录不含税出厂价、部门含税价的各个大小单价格的载体
|
|
|
+ var _mattressMain = ObjectHelper.DeepCopy(mattress);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ List<u_mattress> sumMattress = new List<u_mattress>();
|
|
|
+ for (var i = 1; i < 5; i++)
|
|
|
+ {
|
|
|
+ var _mattress = ObjectHelper.DeepCopy(mattress);
|
|
|
+ if (mattress.dannum_type.Value != i)
|
|
|
+ {
|
|
|
+ _mattress.dannum_type = i;
|
|
|
+ CalCulateFormula(_mattress, mattressMx, true, true, extraProcesses, extraCosts);
|
|
|
+
|
|
|
+ var nottax_factory_cost = Replacements.Where(o => o.label == "【不含税出厂价】").ToList();
|
|
|
+ var dept_cost = Replacements.Where(o => o.label == "【部门含税价】").ToList();
|
|
|
+ if (nottax_factory_cost.Count > 0)
|
|
|
+ {
|
|
|
+ decimal nottax_value = Convert.ToDecimal(nottax_factory_cost[0].value);
|
|
|
+ decimal dept_costValue = Convert.ToDecimal(dept_cost[0].value);
|
|
|
+
|
|
|
+ if (i == 1)
|
|
|
+ {
|
|
|
+
|
|
|
+ _mattress.dijia_cost1 = nottax_value;
|
|
|
+ }
|
|
|
+ else if (i == 2)
|
|
|
+ {
|
|
|
+ _mattress.dijia_cost2 = nottax_value;
|
|
|
+ }
|
|
|
+ else if (i == 3)
|
|
|
+ {
|
|
|
+ _mattress.dijia_cost3 = nottax_value;
|
|
|
+ }
|
|
|
+ else if (i == 4)
|
|
|
+ {
|
|
|
+ _mattress.dijia_cost4 = nottax_value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dept_cost.Count > 0)
|
|
|
+ {
|
|
|
+ decimal dept_costValue = Convert.ToDecimal(dept_cost[0].value);
|
|
|
+ if (i == 1)
|
|
|
+ {
|
|
|
+ _mattress.dannum_cost1 = dept_costValue;
|
|
|
+ }
|
|
|
+ else if (i == 2)
|
|
|
+ {
|
|
|
+ _mattress.dannum_cost2 = dept_costValue;
|
|
|
+ }
|
|
|
+ else if (i == 3)
|
|
|
+ {
|
|
|
+ _mattress.dannum_cost3 = dept_costValue;
|
|
|
+ }
|
|
|
+ else if (i == 4)
|
|
|
+ {
|
|
|
+ _mattress.dannum_cost4 = dept_costValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sumMattress.Add(_mattress);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CalCulateFormula(mattress, mattressMx, true, true, extraProcesses, extraCosts);
|
|
|
+ for (var i = 1; i < 5; i++)
|
|
|
+ {
|
|
|
+ if (mattress.dannum_type.Value == i)
|
|
|
+ {
|
|
|
+ var nottax_factory_cost = Replacements.Where(o => o.label == "【不含税出厂价】").ToList();
|
|
|
+ var dept_cost = Replacements.Where(o => o.label == "【部门含税价】").ToList();
|
|
|
+ if (nottax_factory_cost.Count > 0)
|
|
|
+ {
|
|
|
+ decimal nottax_value = Convert.ToDecimal(nottax_factory_cost[0].value);
|
|
|
+ decimal dept_costValue = Convert.ToDecimal(dept_cost[0].value);
|
|
|
+
|
|
|
+ if (i == 1)
|
|
|
+ {
|
|
|
+ mattress.dijia_cost1 = nottax_value;
|
|
|
+ }
|
|
|
+ else if (i == 2)
|
|
|
+ {
|
|
|
+ mattress.dijia_cost2 = nottax_value;
|
|
|
+ }
|
|
|
+ else if (i == 3)
|
|
|
+ {
|
|
|
+ mattress.dijia_cost3 = nottax_value;
|
|
|
+ }
|
|
|
+ else if (i == 4)
|
|
|
+ {
|
|
|
+ mattress.dijia_cost4 = nottax_value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dept_cost.Count > 0)
|
|
|
+ {
|
|
|
+ decimal dept_costValue = Convert.ToDecimal(dept_cost[0].value);
|
|
|
+ if (i == 1)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost1 = dept_costValue;
|
|
|
+ }
|
|
|
+ else if (i == 2)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost2 = dept_costValue;
|
|
|
+ }
|
|
|
+ else if (i == 3)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost3 = dept_costValue;
|
|
|
+ }
|
|
|
+ else if (i == 4)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost4 = dept_costValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var matchMattress = sumMattress.Where(o => o.dannum_type == i).ToList();
|
|
|
+ if (matchMattress.Count > 0)
|
|
|
+ {
|
|
|
+ if (i == 1)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost1 = matchMattress[0].dannum_cost1;
|
|
|
+ mattress.dijia_cost1 = matchMattress[0].dijia_cost1;
|
|
|
+ }
|
|
|
+ else if (i == 2)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost2 = matchMattress[0].dannum_cost2;
|
|
|
+ mattress.dijia_cost2 = matchMattress[0].dijia_cost2;
|
|
|
+ }
|
|
|
+ else if (i == 3)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost3 = matchMattress[0].dannum_cost3;
|
|
|
+ mattress.dijia_cost3 = matchMattress[0].dijia_cost3;
|
|
|
+ }
|
|
|
+ else if (i == 4)
|
|
|
+ {
|
|
|
+ mattress.dannum_cost4 = matchMattress[0].dannum_cost4;
|
|
|
+ mattress.dijia_cost4 = matchMattress[0].dijia_cost4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ throw new LJCommonException(e.Message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#region 床垫接口相关方法
|
|
|
/// <summary>
|
|
|
/// 业务审核
|