Explorar o código

1、新增部件选配项值BOM清单相关接口
2、优化核价部件选配资料界面UI

iggy hai 1 día
pai
achega
0ff3973069

+ 29 - 0
JLHHJSvr/Com/DeleteConfigureBomList.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class DeleteConfigureBomListRequest : ILJRequest<DeleteConfigureBomListResponse>
+    {
+        public override string GetApiName()
+        {
+            return "DeleteConfigureBomList";
+        }
+        /// <summary>
+        /// 登录token
+        /// </summary>
+        public string token { get; set; }
+        /// <summary>
+        /// 类型id
+        /// </summary>
+        public List<u_configure_codemxbom> list { get; set; }
+    }
+
+    public sealed class DeleteConfigureBomListResponse : LJResponse
+    {
+    }
+}

+ 29 - 0
JLHHJSvr/Com/SaveConfigureBomList.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    /// <summary>
+    /// 保存车辆信息
+    /// </summary>
+    public sealed class SaveConfigureBomListRequest : ILJRequest<SaveConfigureBomListResponse>
+    {
+        public override string GetApiName()
+        {
+            return "SaveConfigureBomList";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 部件选配项明细BOM
+        /// </summary>
+        public List<u_configure_codemxbom> bomList { get; set; }
+    }
+
+    public sealed class SaveConfigureBomListResponse : LJResponse
+    {
+    }
+}

+ 57 - 0
JLHHJSvr/Excutor/DeleteConfigureBomListExcutor.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Data.SqlClient;
+using System.Linq;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class DeleteConfigureBomListExcutor : ExcutorBase<DeleteConfigureBomListRequest, DeleteConfigureBomListResponse>
+    {
+        protected override void ExcuteInternal(DeleteConfigureBomListRequest request, object state, DeleteConfigureBomListResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要删除的记录";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach (var configure in request.list)
+                        {
+                            if (DbSqlHelper.Delete(cmd, configure) == 0)
+                            {
+                                throw new LJCommonException($"部件选配项值BOM资料不存在");
+                            }
+                        }
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction?.Rollback();
+                        rslt.ErrMsg = e.Message;
+                    }
+                }
+            }
+        }
+    }
+}

+ 109 - 0
JLHHJSvr/Excutor/SaveConfigureBomListExcutor.cs

@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class SaveConfigureBomListExcutor : ExcutorBase<SaveConfigureBomListRequest, SaveConfigureBomListResponse>
+    {
+        protected override void ExcuteInternal(SaveConfigureBomListRequest request, object state, SaveConfigureBomListResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            if (request.bomList == null || request.bomList.Count <= 0)
+            {
+                rslt.ErrMsg = "未提交部件选配项值清单";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var dtNow = DateTime.Now;
+
+                var sb = new StringBuilder();
+                var saveList = new List<u_configure_codemxbom>();
+                foreach(var bom in request.bomList)
+                {
+                    AutoInit.AutoInitS(cmd, bom);
+
+                    if(bom.pzid <= 0)
+                    {
+                        sb.AppendLine($"物料:{bom.mtrlname}配置项ID错误");
+                    }
+
+                    if(bom.printid <= 0)
+                    {
+                        sb.AppendLine($"物料:{bom.mtrlname}配置值ID错误");
+                    }
+
+                    if(sb.Length > 0)
+                    {
+                        rslt.ErrMsg = sb.ToString();
+                        return;
+                    }
+
+                    saveList.Add(bom);
+                }
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        var fields = @"mtrlid,sonscale,sonscale_formula,mng_cost_rate,profit_rate,realqty,cost,cost_emp,cost_date,sonloss,sonloss_formula,sondecloss,sondecloss_formula,deptid_scll,price,price_formula,default_length,default_width,default_qty";
+                        foreach (var item in saveList)
+                        {
+                            if(item.pid <= 0)
+                            {
+                                fields += ",pzid,printid,pid";
+                                int _pid = 0;
+                                cmd.CommandText = @"SELECT MAX(printid) AS printid FROM u_configure_codemxbom WHERE pzid = @pzid AND printid = @printid";
+                                cmd.Parameters.Clear();
+                                cmd.Parameters.AddWithValue("@pzid", item.pzid);
+                                cmd.Parameters.AddWithValue("@printid", item.printid);
+                                using (var reader = cmd.ExecuteReader())
+                                {
+                                    if (reader.Read())
+                                    {
+                                        _pid = Convert.ToInt32(reader["printid"]);
+                                    }
+                                }
+                                item.pid = _pid + 1;
+
+                                DbSqlHelper.Insert(cmd, "u_configure_codemxbom", null, item, fields);
+                            } else
+                            {
+                                //修改
+                                DbSqlHelper.Update(cmd, "u_configure_codemxbom", null, item, "pzid,printid,pid", fields);
+                            }
+                        }
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction?.Rollback();
+                        rslt.ErrMsg = e.ToString();
+                    }
+                }
+            }
+        }
+    }
+}

+ 2 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -188,6 +188,8 @@ namespace JLHHJSvr
                 excutorManager.AddMap("DeleteConfigureCode", typeof(DeleteConfigureCodeRequest), new DeleteConfigureCodeExcutor());// 删除部件选配项
                 excutorManager.AddMap("SaveConfigureCodeMx", typeof(SaveConfigureCodeMxRequest), new SaveConfigureCodeMxExcutor());// 保存部件选配项值
                 excutorManager.AddMap("DeleteConfigureCodeMx", typeof(DeleteConfigureCodeMxRequest), new DeleteConfigureCodeMxExcutor());// 删除部件选配项值
+                excutorManager.AddMap("DeleteConfigureBomList", typeof(DeleteConfigureBomListRequest), new DeleteConfigureBomListExcutor());// 删除部件选配项值
+                excutorManager.AddMap("SaveConfigureBomList", typeof(SaveConfigureBomListRequest), new SaveConfigureBomListExcutor());// 删除部件选配项值
                 excutorManager.AddMap("GetMattressImportDW2", typeof(GetMattressImportDW2Request), new GetMattressImportDW2Excutor());// 下拉选择床垫类别
                 excutorManager.AddMap("SaveMattress", typeof(SaveMattressRequest), new SaveMattressExcutor());// 保存床垫报价
                 excutorManager.AddMap("SaveMattressAuditing", typeof(SaveMattressAuditingRequest), new SaveMattressAuditingExcutor());// 床垫报价:业务下单/取消

+ 4 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -103,6 +103,7 @@
     <Compile Include="Com\CopyMtrlDef.cs" />
     <Compile Include="Com\CoverMattressInterface.cs" />
     <Compile Include="Com\CreatPrdPf.cs" />
+    <Compile Include="Com\DeleteConfigureBomList.cs" />
     <Compile Include="Com\DeleteMattressExtraType.cs" />
     <Compile Include="Com\DeleteMattressExtra.cs" />
     <Compile Include="Com\DeleteSoftBedQuote.cs" />
@@ -140,6 +141,7 @@
     <Compile Include="Com\RefreshBedNetInterface.cs" />
     <Compile Include="Com\RefreshBedNetInterfaceQd.cs" />
     <Compile Include="Com\SaveBedNetInterface.cs" />
+    <Compile Include="Com\SaveConfigureBomList.cs" />
     <Compile Include="Com\SaveMattressExtraType.cs" />
     <Compile Include="Com\SaveMattressExtra.cs" />
     <Compile Include="Com\SaveSoftBedQuote.cs" />
@@ -328,6 +330,7 @@
     <Compile Include="Excutor\CopyMtrlDefExcutor.cs" />
     <Compile Include="Excutor\CoverMattressInterfaceExcutor.cs" />
     <Compile Include="Excutor\CreatPrdPfExcutor.cs" />
+    <Compile Include="Excutor\DeleteConfigureBomListExcutor.cs" />
     <Compile Include="Excutor\DeleteMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\DeleteMattressExtraExcutor.cs" />
     <Compile Include="Excutor\DeleteSoftBedQuoteExcutor.cs" />
@@ -345,6 +348,7 @@
     <Compile Include="Excutor\RefreshBedNetInterfaceExcutor.cs" />
     <Compile Include="Excutor\RefreshBedNetInterfaceQdExcutor.cs" />
     <Compile Include="Excutor\SaveBedNetInterfaceExcutor.cs" />
+    <Compile Include="Excutor\SaveConfigureBomListExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraExcutor.cs" />
     <Compile Include="Excutor\SaveSoftBedQuoteExcutor.cs" />

+ 64 - 29
JLHWEB/src/views/baseinfo/configure/index.vue

@@ -52,30 +52,60 @@
       </div>
       <template #right>
         <div class="main-box flx-col">
-          <LjVxeTable
-            ref="VxeTableRightRef"
-            row-key="pzid"
-            :columns="columns_right"
-            :request-api="getCodeMxData"
-            :data-callback="callback_right"
-            :dwname="dwname_right"
-            :table-props="tableProps"
-            :table-events="tableEvents_right"
-            :init-param="initParams_right"
-            :auto-load-layout="false"
-            pagination
-          >
-            <!-- 表格 header 按钮 -->
-            <template #tableHeader>
-              <el-button-group>
-                <el-button @click="handleOpenNewRightTable">{{ $t("common.add") }}</el-button>
-                <el-button @click="fDelete(2)">{{ $t("common.delText") }}</el-button>
-                <el-button @click="fCopy">{{ $t("common.copy") }}</el-button>
-                <el-button @click="fPaste(0)">{{ $t("common.supplyPaste") }}</el-button>
-                <el-button @click="fPaste(1)">{{ $t("common.coverPaste") }}</el-button>
-              </el-button-group>
+          <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting_bom" direction="vertical" :dwname="dwname_bom">
+            <LjVxeTable
+              ref="VxeTableRightRef"
+              row-key="pzid"
+              :columns="columns_right"
+              :request-api="getCodeMxData"
+              :data-callback="callback_right"
+              :dwname="dwname_right"
+              :table-props="tableProps"
+              :table-events="tableEvents_right"
+              :init-param="initParams_right"
+              :auto-load-layout="false"
+              pagination
+            >
+              <!-- 表格 header 按钮 -->
+              <template #tableHeader>
+                <el-button-group>
+                  <el-button @click="handleOpenNewRightTable">{{ $t("common.add") }}</el-button>
+                  <el-button @click="fDelete(2)">{{ $t("common.delText") }}</el-button>
+                  <el-button @click="fCopy">{{ $t("common.copy") }}</el-button>
+                  <el-button @click="fPaste(0)">{{ $t("common.supplyPaste") }}</el-button>
+                  <el-button @click="fPaste(1)">{{ $t("common.coverPaste") }}</el-button>
+                </el-button-group>
+              </template>
+            </LjVxeTable>
+            <template #right>
+              <div class="main-box flx-col">
+                <LjVxeTable
+                  ref="VxeTableRightRef"
+                  row-key="pzid"
+                  :columns="columns_right"
+                  :request-api="getCodeMxData"
+                  :data-callback="callback_right"
+                  :dwname="dwname_right"
+                  :table-props="tableProps"
+                  :table-events="tableEvents_right"
+                  :init-param="initParams_right"
+                  :auto-load-layout="false"
+                  pagination
+                >
+                  <!-- 表格 header 按钮 -->
+                  <template #tableHeader>
+                    <el-button-group>
+                      <el-button @click="handleOpenNewRightTable">{{ $t("common.add") }}</el-button>
+                      <el-button @click="fDelete(2)">{{ $t("common.delText") }}</el-button>
+                      <el-button @click="fCopy">{{ $t("common.copy") }}</el-button>
+                      <el-button @click="fPaste(0)">{{ $t("common.supplyPaste") }}</el-button>
+                      <el-button @click="fPaste(1)">{{ $t("common.coverPaste") }}</el-button>
+                    </el-button-group>
+                  </template>
+                </LjVxeTable>
+              </div>
             </template>
-          </LjVxeTable>
+          </LjFoldLayout>
         </div>
       </template>
     </LjFoldLayout>
@@ -89,11 +119,6 @@
     }"
     :style="{ padding: 0 }"
   >
-    <!-- <template #header>
-        <div class="flx-1">
-          <span class="text-h5-b">物料: {{ mtrlname }}</span>
-        </div>
-      </template> -->
     <div class="flx-1 h-full">
       <LjHeaderMenu :data="mainData" :action="orderStatus ? orderEditAction : orderDefaultAction" />
       <Detail class="flx-1" :data="mainData" :status="orderStatus" :enum="enumMap" :type="detailType" />
@@ -111,11 +136,14 @@ import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
 import { useI18n } from "vue-i18n";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
 import { cloneDeep } from "lodash-es";
+import { template } from "xe-utils";
 
 const dwname = "web_configure_code";
+const dwname_bom = "web_configure_code_bom";
 const dwname_left = "web_configure_typelist";
 const dwname_mid = "web_configure_codelist";
 const dwname_right = "web_configure_codemxlist";
+const dwname_bottom = "web_configure_bomlist";
 
 const mainData = ref({});
 const initParams_mid = ref({ typeid: 0 as Number });
@@ -133,8 +161,15 @@ const tableProps = {
 const layoutSetting = {
   dwname: dwname,
   left: {
-    width: 30
+    width: 18
   },
+  right: {
+    width: 35
+  }
+};
+
+const layoutSetting_bom = {
+  dwname: dwname_bom,
   right: {
     width: 30
   }