Explorar el Código

1、新增"非选配项"列,勾选跳过检测配置逻辑
2、修复软床报价公式错误问题

MY hace 12 horas
padre
commit
17a018af2f

+ 1 - 0
JLHHJSvr/Com/Model/u_softbed_mx.cs

@@ -21,6 +21,7 @@ namespace JLHHJSvr.Com.Model
         public string unit { get; set; }
         public byte has_type { get; set; }
         public byte allow_edit { get; set; }
+        public byte if_no_config { get; set; }
         public decimal cutting_length { get; set; }
         public decimal cutting_width { get; set; }
         public decimal cutting_qty { get; set; }

+ 9 - 2
JLHHJSvr/DBA/ParkDBVersion.cs

@@ -30,7 +30,7 @@ namespace JLHHJSvr.DBA
     {
         protected override string currentVersion
         {
-            get { return "1.0.260506"; }
+            get { return "1.0.260522"; }
         }
 
         protected override string dbname
@@ -469,7 +469,7 @@ BEGIN
     ON u_task_log_mx (taskid, status);
 END
 ", ""),
-    new Script("1.0.260506", @"
+new Script("1.0.260506", @"
 IF NOT EXISTS (SELECT * FROM sys_func_pwr WHERE funcid = 178)
 BEGIN
     INSERT INTO sys_func_pwr (funcid, parentid, treename, menuname, if_use)
@@ -483,6 +483,13 @@ BEGIN
     VALUES
     (179, 178, '日志跟踪', '日志跟踪', 1)
 END","")
+,
+new Script("1.0.260522", @"
+IF COL_LENGTH('u_softbed_mx','if_no_config') IS NULL
+BEGIN
+    ALTER TABLE u_softbed_mx ADD if_no_config TINYINT NOT NULL CONSTRAINT DF_u_softbed_mx_if_no_config DEFAULT(0)
+END
+","")
                 };
             }
         }

+ 37 - 12
JLHHJSvr/Helper/SoftBedHelper.cs

@@ -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,

+ 29 - 0
JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx

@@ -882,6 +882,33 @@ export const useHooks = (t?: any) => {
         );
       }
     },
+    {
+      field: "if_no_config",
+      title: "非选配项",
+      width: 88,
+      align: "center",
+      datatype: "checkbox",
+      editRender: {},
+      editColRender: (scope: any) => {
+        const { row } = scope;
+        const { _mainData } = state.LjDetailRef;
+        if (Number(row.if_no_config) == 0) {
+          row.if_no_config = 0;
+        }
+
+        const _disabled = !row.allow_edit && !_mainData.is_template;
+
+        return (
+          <el-checkbox
+            v-model={row.if_no_config}
+            true-value={1}
+            false-value={0}
+            class="vxe-edit-col-middle"
+            disabled={_disabled}
+          ></el-checkbox>
+        );
+      }
+    },
     {
       field: "pzname",
       title: "部件选配项",
@@ -2062,6 +2089,7 @@ export const useHooks = (t?: any) => {
                 mtrlmode: "",
                 unit: "",
                 allow_edit: 1,
+                if_no_config: 0,
                 cutting_length: 0,
                 cutting_width: 0,
                 cutting_qty: 0,
@@ -2090,6 +2118,7 @@ export const useHooks = (t?: any) => {
           mtrlmode: "",
           unit: "",
           allow_edit: 1,
+          if_no_config: 0,
           cutting_length: 0,
           cutting_width: 0,
           cutting_qty: 0,