|
|
@@ -54,7 +54,7 @@ namespace JLHHJSvr.Helper
|
|
|
/// <param name="mxlist"></param>
|
|
|
public List<u_softbed_mx> GetSoftBedMxList(int billid,string fields = null)
|
|
|
{
|
|
|
- fields = fields ?? @"softbed_id,printid,formulaid,pzid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
|
|
|
+ fields = fields ?? @"softbed_id,printid,formulaid,pzid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,if_no_config,cutting_length,cutting_width,cutting_qty,
|
|
|
useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,pzname,formulaname,parts_type,pzmxid,pznamemx";
|
|
|
var mxlist = new List<u_softbed_mx>();
|
|
|
|
|
|
@@ -69,6 +69,7 @@ namespace JLHHJSvr.Helper
|
|
|
,u_softbed_mx.unit
|
|
|
,u_softbed_mx.has_type
|
|
|
,u_softbed_mx.allow_edit
|
|
|
+ ,u_softbed_mx.if_no_config
|
|
|
,u_softbed_mx.cutting_length
|
|
|
,u_softbed_mx.cutting_width
|
|
|
,u_softbed_mx.cutting_qty
|
|
|
@@ -323,8 +324,8 @@ namespace JLHHJSvr.Helper
|
|
|
template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,money_type,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
|
|
|
dept_cost,foreign_cost,total_mtrl_cost,total_hr_cost,total_cost,version";
|
|
|
|
|
|
- var mx_fields = @"softbed_id,printid,pzid,formulaid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
|
|
|
- useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,parts_type,pzname";
|
|
|
+ var mx_fields = @"softbed_id,printid,pzid,formulaid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,if_no_config,cutting_length,cutting_width,cutting_qty,
|
|
|
+ useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,parts_type,pzname,pzmxid";
|
|
|
|
|
|
if(softbed.softbed_id == 0)
|
|
|
{
|
|
|
@@ -426,7 +427,7 @@ namespace JLHHJSvr.Helper
|
|
|
}
|
|
|
foreach (var mx in softbed.mxList)
|
|
|
{
|
|
|
- if (mx.has_type == 8) continue;
|
|
|
+ if (mx.has_type == 8 || mx.if_no_config == 1) continue;
|
|
|
if(!bomSet.TryGetValue(mx.has_type, out var bomList))
|
|
|
{
|
|
|
throw new LJCommonException($"保存失败,原因:{configureList[mx.has_type].contfigtypename}没有设置物料清单");
|
|
|
@@ -539,7 +540,7 @@ namespace JLHHJSvr.Helper
|
|
|
/// <returns></returns>
|
|
|
private List<u_configure_code> GetSoftBedConfigureCode(List<u_softbed_mx> mxList,byte has_type)
|
|
|
{
|
|
|
- var tempMxList = mxList.Where(t => t.has_type == has_type);
|
|
|
+ var tempMxList = mxList.Where(t => t.has_type == has_type && t.if_no_config == 0);
|
|
|
|
|
|
var codeMap = new Dictionary<string, List<u_configure_codemx>> ();
|
|
|
var codeMxMap = new Dictionary<Tuple<string,string>, List<u_softbed_mx>>();
|
|
|
@@ -901,8 +902,8 @@ namespace JLHHJSvr.Helper
|
|
|
formula.CalculateAll();
|
|
|
|
|
|
// 转换后的文本公式
|
|
|
- mx.use_formula_str = formula.GetFormulaItem("【实际用量】").formula_transform;
|
|
|
- mx.price_formula_str = formula.GetFormulaItem("【成本单价】").formula_transform;
|
|
|
+ mx.use_formula_str = formula.GetFormulaItem("【用料量】").formula_transform ?? string.Empty;
|
|
|
+ mx.price_formula_str = formula.GetFormulaItem("【材料单价】").formula_transform ?? string.Empty;
|
|
|
|
|
|
// 成本单价
|
|
|
mx.cost_price = formula.GetFormulaItem("【成本单价】").value;
|
|
|
@@ -1009,13 +1010,30 @@ namespace JLHHJSvr.Helper
|
|
|
formula.AddFormulaItem("【实际用量】", "【用料量】*(1 + 【损耗率】)");
|
|
|
formula.AddFormulaItem("【成本金额】", "【实际用量】 * 【成本单价】");
|
|
|
|
|
|
+ // 用料量
|
|
|
+ if(string.IsNullOrEmpty(mx.use_formula))
|
|
|
+ {
|
|
|
+ formula.AddFormulaItem("【用料量】", mx.useqty);
|
|
|
+ } else
|
|
|
+ {
|
|
|
+ formula.AddFormulaItem("【用料量】", mx.use_formula);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 材料单价
|
|
|
+ if (string.IsNullOrEmpty(mx.price_formula))
|
|
|
+ {
|
|
|
+ formula.AddFormulaItem("【材料单价】", mx.price);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ formula.AddFormulaItem("【材料单价】", mx.price_formula);
|
|
|
+ }
|
|
|
+
|
|
|
// 常量变量
|
|
|
formula.AddFormulaItem("【下料长】", mx.cutting_length);
|
|
|
formula.AddFormulaItem("【下料宽】", mx.cutting_width);
|
|
|
formula.AddFormulaItem("【下料数量】", mx.cutting_qty);
|
|
|
- formula.AddFormulaItem("【用料量】", mx.useqty);
|
|
|
formula.AddFormulaItem("【损耗率】", mx.loss_rate);
|
|
|
- formula.AddFormulaItem("【材料单价】", mx.price);
|
|
|
|
|
|
if(mx.formulaid > 0)
|
|
|
{
|
|
|
@@ -1162,10 +1180,17 @@ namespace JLHHJSvr.Helper
|
|
|
|
|
|
if (typeMxList.Count <= 0) continue;
|
|
|
|
|
|
- ValidateSoftBedTemplateMxListV2(item.Value, typeMxList);
|
|
|
+ var configMxList = typeMxList
|
|
|
+ .Where(t => t.if_no_config != 1)
|
|
|
+ .OrderBy(t => t.printid)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ if (configMxList.Count <= 0) continue;
|
|
|
+
|
|
|
+ ValidateSoftBedTemplateMxListV2(item.Value, configMxList);
|
|
|
|
|
|
int typeId = EnsureSoftBedTemplateTypeV2(item.Value);
|
|
|
- var codeMxGroups = typeMxList
|
|
|
+ var codeMxGroups = configMxList
|
|
|
.GroupBy(t => new
|
|
|
{
|
|
|
PzName = (t.pzname ?? string.Empty).Trim(),
|
|
|
@@ -1529,7 +1554,7 @@ namespace JLHHJSvr.Helper
|
|
|
{
|
|
|
if (softbed.softbed_id <= 0 || softbed.mxList == null || softbed.mxList.Count <= 0) return;
|
|
|
|
|
|
- foreach (var mx in softbed.mxList.Where(t => t.has_type == 1 || t.has_type == 2 || t.has_type == 4))
|
|
|
+ foreach (var mx in softbed.mxList.Where(t => (t.has_type == 1 || t.has_type == 2 || t.has_type == 4) && t.if_no_config != 1))
|
|
|
{
|
|
|
cmd.CommandText = @"UPDATE u_softbed_mx
|
|
|
SET pzid = @pzid,
|