Browse Source

1、新增床垫清单产品配置,产品清单增行自动匹配配置
2、新增床垫清单产品清单新工组自动匹配功能
3、修复主规格覆盖副规格配置报错问题

MY 2 ngày trước cách đây
mục cha
commit
fc33de0038

+ 11 - 3
JLHHJSvr/Com/GetERPConfigureList.cs

@@ -18,13 +18,21 @@ namespace JLHHJSvr.Com
         /// </summary>
         public string token { get; set; }
         /// <summary>
-        /// 单据id
+        /// 0 - 配置增行 1 - 清单增行
         /// </summary>
-        public int? typeid { get; set; }
+        public byte? isPz { get; set; }
+        /// <summary>
+        /// 配置类型
+        /// </summary>
+        public int? configcodetype { get; set; }
+        public List<u_mattress_interface> interfaceList { get; set; }
+        public List<u_mattress_interface_qd> qdList { get; set; }
+        
     }
 
     public sealed class GetERPConfigureListResponse : LJResponse
     {
-        public List<erp_configure_code> configureList { get; set; }
+        public List<u_mattress_interface> interfaceList { get; set; }
+        public List<u_mattress_interface_qd> qdList { get; set; }
     }
 }

+ 1 - 0
JLHHJSvr/Excutor/CoverMattressInterfaceExcutor.cs

@@ -158,6 +158,7 @@ namespace JLHHJSvr.Excutor
                                         DbSqlHelper.Update(cmd, mx, "bj_inputtype,bj_namemx");
                                     } else
                                     {
+                                        mx.mattressid = mattress.mattressid;
                                         DbSqlHelper.Insert(cmd, mx, "mattressid,printid,itemname,bj_pzname,bj_namemx,actual_size,sb_craft,actual_size_sb,erp_pzid,bj_inputtype,ss_rate,ls_rate");
                                     }
                                 }

+ 15 - 19
JLHHJSvr/Excutor/GetERPConfigureListExcutor.cs

@@ -29,27 +29,23 @@ namespace JLHHJSvr.Excutor
             {
                 con.Open();
 
-                throw new NotImplementedException("不能直连ERP数据库,下面需要改写");
-                //var configureList = new List<erp_configure_code>();
+                var interfaceHelper = HelperBase.GetHelper<InterfaceHelper>(cmd);
+                interfaceHelper.context = new HelperBase.Context() { tokendata = tokendata };
 
-                //var param = new Dictionary<string, object>();
-                //var whereList = new List<string>();
-                //var selectStr = @"SELECT u_configure_code.pzid,
-	               //                     u_configure_code.pzcode,
-	               //                     u_configure_code.name,
-	               //                     u_configure_code.inputtype
-                //                FROM u_configure_code";
-                //var outputFields = "pzid,pzcode,name,inputtype";
+                var mattress = new u_mattress() { erp_configcodetype = request.configcodetype };
 
-                //if (request.typeid != null && request.typeid > 0)
-                //{
-                //    whereList.Add("typeid = @typeid");
-                //    param.Add("@typeid", request.typeid);
-                //}
-                //DbSqlHelper.SelectJoin(erp_cmd, selectStr, ListEx.GetWhereStr(whereList), param, "typeid", outputFields, 0, 0, configureList);
-
-                //rslt.configureList = configureList;
-                
+                // 匹配增行配置和增行清单
+                if(request.isPz == 0)
+                {
+                    // 增行配置
+                    interfaceHelper.MattressInterfaceFindERPPz(mattress, request.interfaceList);
+                    rslt.interfaceList = request.interfaceList;
+                } else
+                {
+                    // 增行清单
+                    interfaceHelper.MattressInterfaceFindERPPrdPf(request.qdList);
+                    rslt.qdList = request.qdList;
+                }
             }
         }
     }

+ 3 - 0
JLHHJSvr/Excutor/GetResetWiptypeExcutor.cs

@@ -34,11 +34,14 @@ namespace JLHHJSvr.Excutor
                 {
                     var _bcpcompare = new u_bcpcompare() { pzname = qdmx.bj_pzname };
                     var _wip_type = "";
+                    var _wrkgrpcode2 = "";
                     if (DbSqlHelper.SelectOne(cmd, _bcpcompare, "wip_type, wrkgrpcode2") == 1)
                     {
                         _wip_type = _bcpcompare.wip_type;
+                        _wrkgrpcode2 = _bcpcompare.wrkgrpcode2;
                     }
                     qdmx.wip_type = _wip_type;
+                    qdmx.wrkgrpcode2 = _wrkgrpcode2;
                 }
 
 

+ 2 - 0
JLHHJSvr/Excutor/ReCalculateERPCostExcutor.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Data.SqlClient;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using JLHHJSvr.BLL;
@@ -88,6 +89,7 @@ namespace JLHHJSvr.Excutor
                             catch (Exception ex)
                             {
                                 //cmd.Transaction.Rollback();
+                                Trace.Write($"ReCalculatteERPCost : {ex.ToString()}");
                                 logerr_sb.Append($"床垫唯一码:{mattress_temp.mattresscode}重算失败,错误:{ex.Message}\r\n");
                             }
                         }

+ 20 - 4
JLHWEB/src/api/interface/index.ts

@@ -1020,15 +1020,31 @@ export namespace GenericApi {
   }
   export interface ReqGetERPConfigureList {
     /**
-     * @description 配置id
+     * @description 0 - 配置增行 1 - 清单增行
      */
-    typeid?: number;
+    isPz: number;
+    /**
+     * @description 配置类型
+     */
+    configcodetype: number;
+    /**
+     * @description 配置列表
+     */
+    interfaceList?: any[];
+    /**
+     * @description 清单列表
+     */
+    qdList?: any[];
   }
   export interface ResGetERPConfigureList {
     /**
-     * @description 返回的结果
+     * @description 返回配置列表
      */
-    configureList: any[];
+    interfaceList: any[];
+    /**
+     * @description 返回清单列表
+     */
+    qdList: any[];
   }
   export interface ReqGetERPWrkGrpList {
     /**

+ 68 - 28
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -90,7 +90,7 @@ import { useI18n } from "vue-i18n";
 import { useRoute, useRouter } from "vue-router";
 import { useHooks } from "./hooks/index";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
-import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2 } from "@/api/modules/common";
+import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2, GetERPConfigureList } from "@/api/modules/common";
 import { SaveMattressInterface, GetResetWiptype, UpdateL1Basicinfo } from "@/api/modules/quote";
 import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
 import mittBus from "@/utils/mittBus";
@@ -348,22 +348,28 @@ const FuncInsertRowPz = (refName: string, type: number) => {
       itemnameEnum: itEnum,
       bjPznameEnum: pzEnum
     }).then((data: any) => {
-      $table.insertAt(data, insertParam).then(async ({ row }) => {
-        // $table.reloadData(visibleData);
-
-        const $table1 = dynamicRef(refName).element;
-
-        if ($table1) {
-          let visibleData1 = $table1.getTableData().visibleData;
-
-          visibleData1.map((o, idx) => {
-            o.printid = idx + 1;
-            return o;
-          });
+      GetERPConfigureList({
+        isPz: 0,
+        configcodetype: LjDetailRef.value?._mainData.erp_configcodetype,
+        interfaceList: [data]
+      }).then(res => {
+        if (res.interfaceList && res.interfaceList.length > 0) {
+          $table.insertAt(res.interfaceList, insertParam).then(async ({ row }) => {
+            const $table1 = dynamicRef(refName).element;
+
+            if ($table1) {
+              let visibleData1 = $table1.getTableData().visibleData;
+
+              visibleData1.map((o, idx) => {
+                o.printid = idx + 1;
+                return o;
+              });
 
-          await $table1.reloadData(visibleData1);
-          resetMergeCells(() => {
-            dynamicRef(refName).scrollTo(row, "bj_namemx");
+              await $table1.reloadData(visibleData1);
+              resetMergeCells(() => {
+                dynamicRef(refName).scrollTo(row, "bj_namemx");
+              });
+            }
           });
         }
       });
@@ -484,19 +490,53 @@ const FuncInsertRow = (refName: string, type: number) => {
       bjPznameEnum: pzEnum
     }).then((data: any) => {
       // wf_fine_erp_pz()
-      $table.insertAt(data, insertParam).then(({ row }) => {
-        // $table.reloadData(visibleData);
-        _ref.scrollTo(row, "bj_namemx");
+      GetERPConfigureList({
+        isPz: 1,
+        configcodetype: LjDetailRef.value?._mainData.erp_configcodetype,
+        qdList: [data]
+      }).then(res => {
+        if (res.qdList && res.qdList.length > 0) {
+          const interfaceMap = {};
+          mattressYWList.value.forEach((mb: any) => {
+            interfaceMap[mb.bj_pzname] = mb;
+          });
 
-        if (type == 1) {
-          const $table1 = dynamicRef(refName).element;
+          // 遍历 qdList 并使用哈希表来查找和赋值
+          res.qdList.forEach(mx => {
+            const mb = interfaceMap[mx.bj_pzname];
+            if (mb) {
+              mx.bj_pzname_mx_mx = mb.bj_namemx;
 
-          if ($table1) {
-            let visibleData1 = $table1.getTableData().visibleData;
+              if (mx.ss_rate === 0) {
+                mx.ss_rate = mb.ss_rate;
+              }
 
-            $table1.reloadData(visibleData1);
-            resetMergeCellsQd();
-          }
+              if (mx.ls_rate === 0) {
+                mx.ls_rate = mb.ls_rate;
+              }
+            }
+          });
+
+          $table.insertAt(res.qdList, insertParam).then(async ({ row }) => {
+            // $table.reloadData(visibleData);
+            _ref.scrollTo(row, "bj_namemx");
+
+            if (type == 1) {
+              const $table1 = dynamicRef(refName).element;
+
+              if ($table1) {
+                let visibleData1 = $table1.getTableData().visibleData;
+
+                await $table1.reloadData(visibleData1);
+
+                // resetMergeCellsQd(() => {
+                //   dynamicRef(refName).scrollTo(row, "bj_namemx");
+                // });
+              }
+            }
+          });
+
+          resetMergeCellsQd();
         }
       });
     });
@@ -870,7 +910,7 @@ const orderDefaultAction = [
   // }),
   // ],
   buttonDefault({
-    label: "重置半成品归属列数据",
+    label: "重置半成品及新工组归属列数据",
     limited: () => {
       return !orderStatus.value;
     },
@@ -886,7 +926,7 @@ const orderDefaultAction = [
 
           if (_itm) {
             o.wip_type = _itm.wip_type;
-            !o.wrkgrpcode2 && (o.wrkgrpcode2 = _itm.o.wrkgrpcode2);
+            !o.wrkgrpcode2 && (o.wrkgrpcode2 = _itm.wrkgrpcode2);
           }
           return o;
         });

+ 3 - 3
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -1384,13 +1384,13 @@ export const useHooks = (t?: any) => {
       editColRender: (scope: any) => {
         // console.log("formulakind editColRender scope :>> ", scope);
         return (
-          <el-select v-model={scope.row.wrkgrpid2} filterable clearable onChange={val => rModelSetWrkgrp2(val, scope.row)}>
+          <el-select v-model={scope.row.wrkgrpcode2} filterable clearable onChange={val => rModelSetWrkgrp2(val, scope.row)}>
             {{
               default: () => {
                 let rs = [];
                 if (state.workgrpEnum2.length) {
                   state.workgrpEnum2.map((t: any) => {
-                    rs.push(<el-option label={`${t.code} - ${t.label}`} value={t.value} />);
+                    rs.push(<el-option label={`${t.code} - ${t.label}`} value={t.code} />);
                   });
                 }
                 return rs;
@@ -1401,7 +1401,7 @@ export const useHooks = (t?: any) => {
         );
       },
       render: scope => {
-        let item = state.workgrpEnum2.find(t => t.value == scope.row.wrkgrpid2);
+        let item = state.workgrpEnum2.find(t => t.code == scope.row.wrkgrpcode2);
         if (item) {
           return item.code + " - " + item.label;
         } else {