|
@@ -904,7 +904,7 @@ namespace JLHHJSvr.Helper
|
|
|
|
|
|
#region 计算人工费用
|
|
|
var mattersstype = new u_mattress_type() { mattresstypeid = mattress.mattresstypeid };
|
|
|
- DbSqlHelper.SelectOne(cmd, mattersstype, "hrcost_formula,biandaiqty,zhizao_amt,guanli_rate");
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattersstype, "hrcost_formula,biandaiqty,zhizao_amt,guanli_rate,typerate,dannum1_rate,dannum2_rate,dannum3_rate,dannum4_rate");
|
|
|
|
|
|
if(mattress.biandai_qty == 0 && mattress.if_m_chai == 0 && mattress.if_z_chai == 0 && mattress.if_d_chai == 0)
|
|
|
{
|
|
@@ -977,27 +977,55 @@ namespace JLHHJSvr.Helper
|
|
|
AddKeyValue("总材料成本", mattress.total_material_cost);
|
|
|
#endregion
|
|
|
|
|
|
- CalCulateCostNew(mattress, "标准");
|
|
|
- CalCulateCostNew(mattress, "大单");
|
|
|
- CalCulateCostNew(mattress, "散单");
|
|
|
|
|
|
#region 标准金额
|
|
|
- // 查找点数
|
|
|
- decimal _rate = GetWorkmanshipRate(mattress, "num_10", "标准");
|
|
|
- _rate = _rate == 0 ? 1 : _rate;
|
|
|
+ if (!isNewFormula)
|
|
|
+ {
|
|
|
+ // 旧公式
|
|
|
+ CalCulateCostNew(mattress, "标准");
|
|
|
+ // 查找点数
|
|
|
+ decimal _rate = GetWorkmanshipRate(mattress, "num_10", "标准");
|
|
|
+ _rate = _rate == 0 ? 1 : _rate;
|
|
|
|
|
|
- mattress.foreign_cost_bz = mattress.dept_cost / _rate;
|
|
|
+ mattress.foreign_cost_bz = mattress.dept_cost / _rate;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CalCulateCostNew(mattress, "标准", mattersstype);
|
|
|
+ mattress.foreign_cost_bz = mattress.dept_cost;
|
|
|
+ }
|
|
|
AddKeyValue("标准金额", mattress.foreign_cost_bz);
|
|
|
#endregion
|
|
|
|
|
|
#region 大单金额
|
|
|
- // 查找点数
|
|
|
- decimal _rate2 = GetWorkmanshipRate(mattress, "num_11", "大单");
|
|
|
- _rate2 = _rate2 == 0 ? 1 : _rate2;
|
|
|
+ if (!isNewFormula)
|
|
|
+ {
|
|
|
+ // 旧公式
|
|
|
+ CalCulateCostNew(mattress, "大单");
|
|
|
+ // 查找点数
|
|
|
+ decimal _rate2 = GetWorkmanshipRate(mattress, "num_11", "大单");
|
|
|
+ _rate2 = _rate2 == 0 ? 1 : _rate2;
|
|
|
|
|
|
- mattress.foreign_cost_dd = mattress.dept_cost / _rate2;
|
|
|
+ mattress.foreign_cost_dd = mattress.dept_cost / _rate2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CalCulateCostNew(mattress, "大单", mattersstype);
|
|
|
+ mattress.foreign_cost_bz = mattress.dept_cost;
|
|
|
+ }
|
|
|
AddKeyValue("大单金额", mattress.foreign_cost_dd);
|
|
|
#endregion
|
|
|
+
|
|
|
+ if (!isNewFormula)
|
|
|
+ {
|
|
|
+ // 旧公式
|
|
|
+ CalCulateCostNew(mattress, "散单");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CalCulateCostNew(mattress, "散单", mattersstype);
|
|
|
+ }
|
|
|
+ AddKeyValue("散单金额", mattress.foreign_cost);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 计算拼侧最大金额的侧和工厂利润率加点
|
|
@@ -1097,6 +1125,9 @@ namespace JLHHJSvr.Helper
|
|
|
// 查找点数
|
|
|
mattress.profitrate_point = GetWorkmanshipRate(mattress, field, "工艺点数");
|
|
|
AddKeyValue("工艺点数", mattress.profitrate_point);
|
|
|
+
|
|
|
+ decimal extraProcesses = GetExtraAmt(mattress, 1);
|
|
|
+ AddKeyValue("特殊工艺费用", extraProcesses);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 计算内布套特殊加点
|
|
@@ -1257,13 +1288,66 @@ namespace JLHHJSvr.Helper
|
|
|
mattress.dannum_rate = _rate == 0 ? 1 : _rate;
|
|
|
AddKeyValue("大小单", mattress.dannum_rate);
|
|
|
}
|
|
|
+ private decimal CalCulateDanNumRate(u_mattress mattress, string typename)
|
|
|
+ {
|
|
|
+ // 根据款式类型判断查询的字段
|
|
|
+ string field = "散单".Equals(typename) ? "num_9" : "标准".Equals(typename) ? "num_10" : "大单".Equals(typename) ? "num_11" : "";
|
|
|
+
|
|
|
+ // 查找点数
|
|
|
+ decimal _rate = GetWorkmanshipRate(mattress, field, typename);
|
|
|
+ return _rate;
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 计算成本
|
|
|
/// </summary>
|
|
|
/// <param name="mattress"></param>
|
|
|
/// <param name="typename"></param>
|
|
|
- private void CalCulateCostNew(u_mattress mattress, string typename)
|
|
|
+ private void CalCulateCostNew(u_mattress mattress, string typename, u_mattress_type mattressType = null)
|
|
|
{
|
|
|
+
|
|
|
+ #region 判断大小单
|
|
|
+ if (mattressType != null)
|
|
|
+ {
|
|
|
+ var dept = new u_dept() { deptid = mattress.deptid.Value };
|
|
|
+ DbSqlHelper.SelectOne(cmd, dept, "pricelistid,managerate,com_profitrate,dannum1_rate,dannum2_rate,dannum3_rate,dannum4_rate");
|
|
|
+ decimal? com_profitrate_dannum = 0;
|
|
|
+
|
|
|
+ decimal _rate = CalCulateDanNumRate(mattress, typename);
|
|
|
+ _rate = _rate == 0 ? 1 : _rate;
|
|
|
+
|
|
|
+ if (mattressType.typerate > 0)
|
|
|
+ {
|
|
|
+ switch (typename)
|
|
|
+ {
|
|
|
+ case "散单":
|
|
|
+ _rate = mattressType.dannum1_rate.Value;
|
|
|
+ com_profitrate_dannum = dept.dannum1_rate;
|
|
|
+ break;
|
|
|
+ case "标准":
|
|
|
+ _rate = mattressType.dannum2_rate.Value;
|
|
|
+ com_profitrate_dannum = dept.dannum2_rate;
|
|
|
+ break;
|
|
|
+ case "大单":
|
|
|
+ _rate = mattressType.dannum3_rate.Value;
|
|
|
+ com_profitrate_dannum = dept.dannum3_rate;
|
|
|
+ break;
|
|
|
+ case "小单":
|
|
|
+ _rate = mattressType.dannum4_rate.Value;
|
|
|
+ com_profitrate_dannum = dept.dannum4_rate;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ AddKeyValue("大小单系统", _rate);
|
|
|
+ AddKeyValue("款式系统", mattressType.typerate.Value);
|
|
|
+
|
|
|
+ #region 公式利润点
|
|
|
+ AddKeyValue("管理费用点", dept.managerate);
|
|
|
+ AddKeyValue("公司利润点", dept.com_profitrate + com_profitrate_dannum);
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 总成本-车间成本
|
|
|
CalCulateDanNum(mattress, typename);
|
|
|
mattress.total_cost = CalculateVarFormula("车间成本").DecimalValue;
|
|
@@ -1311,11 +1395,7 @@ namespace JLHHJSvr.Helper
|
|
|
{
|
|
|
if ("标准".Equals(typename)) mattress.foreign_cost_bz = mattress.dept_cost / mattress.moneyrate;
|
|
|
else if ("大单".Equals(typename)) mattress.foreign_cost_dd = mattress.dept_cost / mattress.moneyrate;
|
|
|
- else if ("散单".Equals(typename))
|
|
|
- {
|
|
|
- mattress.foreign_cost = mattress.dept_cost / mattress.moneyrate;
|
|
|
- AddKeyValue("散单金额", mattress.foreign_cost);
|
|
|
- }
|
|
|
+ else if ("散单".Equals(typename)) mattress.foreign_cost = mattress.dept_cost / mattress.moneyrate;
|
|
|
}
|
|
|
decimal _waibi = CalculateVarFormula("外币价").DecimalValue;
|
|
|
AddKeyValue("外币价", _waibi);
|