Explorar o código

1、保存床垫清单生成半成品逻辑完善
2、修复床垫清单生成金蝶清单报错问题

chen_yjin hai 1 mes
pai
achega
e35a834b42

+ 2 - 0
JLHHJSvr/Com/Model/u_mattress_interface_qd.cs

@@ -33,6 +33,8 @@ namespace JLHHJSvr.Com.Model
         public string erp_mtrlmode { get; set; }
         public string erp_unit { get; set; }
         public string erp_mtrlengname { get; set; }
+        public int? billtype { get; set; }
+        public int? formulaid { get; set; }
         #endregion
     }
 }

+ 3 - 2
JLHHJSvr/Excutor/CreatMtrlPfExcutor.cs

@@ -35,7 +35,7 @@ namespace JLHHJSvr.Excutor
                 con.Open();
 
                 var mattress = new u_mattress();
-                if (DbSqlHelper.SelectOne(cmd, "u_mattress", "mattressid = @mattressid", new Dictionary<string, object>() { { "mattressid", request.mattressid } }, mattress, "erp_mtrlid") != 1)
+                if (DbSqlHelper.SelectOne(cmd, "u_mattress", "mattressid = @mattressid", new Dictionary<string, object>() { { "mattressid", request.mattressid } }, mattress, "erp_mtrlid,erp_mtrlcode, erp_mtrlname, erp_mtrlmode, erp_mtrltypeid, erp_mtrltype, erp_mtrlunit, erp_mtrlengname") != 1)
                 {
                     rslt.ErrMsg = "床垫报价单匹配失败";
                     return;
@@ -143,7 +143,8 @@ namespace JLHHJSvr.Excutor
                         printid = mx.printid,
                         azcode = ls_azcode,
                         promode = mx.ss_rate.ToString(),
-                        SonLoss = mx.sh_rate
+                        SonLoss = mx.sh_rate,
+                        SonDECLosS = 0,
                     };
                     l1Req.prdPfs.Add(prdpf);
                     i++;

+ 5 - 2
JLHHJSvr/Excutor/RefreshMattressInterfaceQdExcutor.cs

@@ -60,10 +60,11 @@ namespace JLHHJSvr.Excutor
 	                            ,u_mattress_interface_qd.wrkgrpid 
 	                            ,u_mattress_interface_qd.ss_rate 
 	                            ,u_mattress_interface_qd.ls_rate 
-	                            ,u_mattress_interface_qd.sh_rate 
+	                            ,u_mattress_interface_qd.sh_rate
+	                            ,ISNULL(u_mattress_interface_qd.formulaid, 0) AS formulaid
                             FROM u_mattress_interface_qd
                             LEFT JOIN u_mtrl_price ON u_mtrl_price.mtrlid = u_mattress_interface_qd.mtrlid";
-                var outputFields = "mattressid,printid,itemname,bj_pzname,bj_pzname_mx,bj_pzname_mx_mx,mtrlid,erp_mtrlid,useqty,dscrp,mtrlname,actual_useqty,qd_actual_size,qd_pfgroupqty,wrkgrpid,ss_rate,ls_rate,sh_rate";
+                var outputFields = "mattressid,printid,itemname,bj_pzname,bj_pzname_mx,bj_pzname_mx_mx,mtrlid,erp_mtrlid,useqty,dscrp,mtrlname,actual_useqty,qd_actual_size,qd_pfgroupqty,wrkgrpid,ss_rate,ls_rate,sh_rate,formulaid";
                 DbSqlHelper.SelectJoin(cmd, selectStr, "mattressid = @mattressid", new Dictionary<string, object>() { { "@mattressid", request.mattressid } }, "printid", outputFields, 0, 0, copy_list);
 
                 var interfaceHelper = HelperBase.GetHelper<InterfaceHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
@@ -105,6 +106,8 @@ namespace JLHHJSvr.Excutor
                     }
                 }
 
+                interfaceHelper.MattressInterfaceFindERPPrdPf(qdList);
+
                 rslt.mxList = qdList;
             }
         }

+ 0 - 39
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -63,45 +63,6 @@ namespace JLHHJSvr.Excutor
 
                     var helperBednet = HelperBase.GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
 
-                    //try
-                    //{
-                    //    helper.CalCulateFormula(request.mattress, request.mattressMx);
-                    //}
-                    //catch (Exception e)
-                    //{
-                    //    rslt.message = e.Message;
-                    //}
-
-                    //var mxmessageList = request.mattressMx.Where(item => !string.IsNullOrEmpty(item.message)).ToList();
-                    //if (mxmessageList.Any())
-                    //{
-                    //    rslt.mxmessage = new List<string>();
-                    //    foreach (var mx in mxmessageList)
-                    //    {
-                    //        rslt.mxmessage.Add(mx.message);
-                    //    }
-                    //}
-
-                    //try
-                    //{
-                    //    helper.SaveMattress(request.mattress, request.mattressMx);
-
-                    //    if(request.mattress.copy_id != null && request.mattress.copy_id > 0)
-                    //    {
-                    //        helper.CopyMattressInterface(request.mattress.copy_id.Value, request.mattress.mattressid);
-                    //    }
-
-                    //    cmd.Transaction.Commit();
-
-                    //    rslt.mattressid = request.mattress.mattressid;
-                    //    rslt.mattresscode = request.mattress.mattresscode;
-                    //}
-                    //catch (Exception e)
-                    //{
-                    //    cmd.Transaction.Rollback();
-                    //    rslt.ErrMsg = e.Message;
-                    //}
-
                     try
                     {
                         rslt.mxmessage = new List<string>();

+ 3 - 2
JLHHJSvr/Helper/ERPHelper.cs

@@ -134,6 +134,7 @@ namespace JLHHJSvr.Helper
 
             var l1Req = new JObject()
             {
+                ["token"] = GlobalVar.ERP_TOKEN,
                 ["mtrls"] = new JArray
                 {
                     new JObject()
@@ -147,10 +148,10 @@ namespace JLHHJSvr.Helper
                         ["mtrlengname"] = mtrl.erp_mtrlengname
                     }
                 },
-                ["updateFields"] = "mtrlcode,mtrlname,mtrlmode,mtrltypeid,mtrltype,unit,mtrlengname"
+                ["updateFields"] = "mtrlname,mtrlmode,mtrltypeid,mtrltype,unit,mtrlengname"
             };
 
-            var l1Rslt = DoExecute("SavePrdPf", JObject.FromObject(l1Req));
+            var l1Rslt = DoExecute("SaveMtrldef", JObject.FromObject(l1Req));
             errMsg = $"{l1Rslt.GetValue("ErrMsg")}";
             if (string.IsNullOrEmpty(errMsg))
             {

+ 9 - 7
JLHHJSvr/Helper/InterfaceHelper.cs

@@ -179,6 +179,7 @@ namespace JLHHJSvr.Helper
 	                            ,u_mattress_interface_qd.ss_rate 
 	                            ,u_mattress_interface_qd.ls_rate 
 	                            ,u_mattress_interface_qd.sh_rate 
+	                            ,u_mattress_interface_qd.formulaid 
                             FROM u_mattress_interface_qd
                             LEFT JOIN u_mtrl_price ON u_mtrl_price.mtrlid = u_mattress_interface_qd.mtrlid";
             var outputFields = "mattressid,printid,itemname,bj_pzname,bj_pzname_mx,bj_pzname_mx_mx,mtrlid,erp_mtrlid,useqty,dscrp,mtrlname,actual_useqty,qd_actual_size,qd_pfgroupqty,wrkgrpid,ss_rate,ls_rate,sh_rate";
@@ -1056,7 +1057,7 @@ namespace JLHHJSvr.Helper
         /// </summary>
         /// <param name="qdList"></param>
         /// <param name="interfaceList"></param>
-        public void MattressInterfaceFindERPPrdPf(List<u_mattress_interface_qd> qdList,List<u_mattress_interface> interfaceList)
+        public void MattressInterfaceFindERPPrdPf(List<u_mattress_interface_qd> qdList,List<u_mattress_interface> interfaceList = null)
         {
             var mtrlidList = new List<int>();
             foreach (var mx in qdList)
@@ -1181,7 +1182,7 @@ namespace JLHHJSvr.Helper
         /// <param name="inputtype"></param>
         /// <param name="names"></param>
         /// <returns></returns>
-        public u_mattress_interface_qd InserMattressInterfacePrdPf(string itemname, string bj_pzname, string namemx, int mtrlid, decimal useqty)
+        public u_mattress_interface_qd InserMattressInterfacePrdPf(string itemname, string bj_pzname, string namemx, int mtrlid, decimal useqty, int formulaid = 0)
         {
             var mattress_interface_qd = new u_mattress_interface_qd()
             {
@@ -1189,7 +1190,8 @@ namespace JLHHJSvr.Helper
                 bj_pzname = bj_pzname,
                 bj_pzname_mx = namemx,
                 mtrlid = mtrlid,
-                useqty = useqty
+                useqty = useqty,
+                formulaid = formulaid
             };
 
             return mattress_interface_qd;
@@ -1271,19 +1273,19 @@ namespace JLHHJSvr.Helper
                     {
                         if (mx.formulakind == 0 || mx.formulakind == 1 || mx.formulakind == 2 || mx.formulakind == 3)
                         {
-                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "布料", mx.mtrlid.Value, mx.useqty.Value));
+                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "布料", mx.mtrlid.Value, mx.useqty.Value, mx.formulaid.Value));
                         }
                         if (mx.formulakind == 40 || mx.formulakind == 41 || mx.formulakind == 42 || mx.formulakind == 43)
                         {
-                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "喷胶棉", mx.mtrlid.Value, mx.useqty.Value));
+                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "喷胶棉", mx.mtrlid.Value, mx.useqty.Value, mx.formulaid.Value));
                         }
                         if (mx.formulakind == 50 || mx.formulakind == 51 || mx.formulakind == 52 || mx.formulakind == 53)
                         {
-                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "裥面海绵", mx.mtrlid.Value, mx.useqty.Value));
+                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "裥面海绵", mx.mtrlid.Value, mx.useqty.Value, mx.formulaid.Value));
                         }
                         if (mx.formulakind == 60 || mx.formulakind == 61 || mx.formulakind == 62 || mx.formulakind == 63)
                         {
-                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "无纺布", mx.mtrlid.Value, mx.useqty.Value));
+                            qdList.Add(InserMattressInterfacePrdPf(chastrArrDict[item.Key][0], chastrArrDict[item.Key][1], "无纺布", mx.mtrlid.Value, mx.useqty.Value, mx.formulaid.Value));
                         }
                     }
                 }

+ 12 - 2
JLHHJSvr/Helper/MattressHelper.cs

@@ -1423,6 +1423,7 @@ namespace JLHHJSvr.Helper
 	                                ,actual_useqty
 	                                ,qd_actual_size
 	                                ,qd_pfgroupqty
+                                    ,formulaid
 	                                )
                                 SELECT @mattressid
 	                                ,printid
@@ -1437,6 +1438,7 @@ namespace JLHHJSvr.Helper
 	                                ,actual_useqty
 	                                ,qd_actual_size
 	                                ,qd_pfgroupqty
+                                    ,formulaid
                                 FROM u_mattress_interface_qd
                                 WHERE mattressid = @copy_id";
             cmd.Parameters.Clear();
@@ -1581,7 +1583,7 @@ namespace JLHHJSvr.Helper
             foreach (var mx in qdlist)
             {
                 mx.mattressid = mattressid;
-                DbSqlHelper.Insert(cmd, mx, "mattressid,printid,itemname,bj_pzname,bj_pzname_mx,bj_pzname_mx_mx,mtrlid,erp_mtrlid,wrkgrpid,useqty,dscrp,actual_useqty,qd_actual_size,qd_pfgroupqty,ss_rate,ls_rate,sh_rate");
+                DbSqlHelper.Insert(cmd, mx, "mattressid,printid,itemname,bj_pzname,bj_pzname_mx,bj_pzname_mx_mx,mtrlid,erp_mtrlid,wrkgrpid,useqty,dscrp,actual_useqty,qd_actual_size,qd_pfgroupqty,ss_rate,ls_rate,sh_rate,formulaid");
             }
 
 
@@ -1638,13 +1640,14 @@ namespace JLHHJSvr.Helper
 	                            ,u_mattress_interface_qd.ss_rate
 	                            ,u_mattress_interface_qd.ls_rate
 	                            ,u_mattress_interface_qd.sh_rate
+	                            ,u_mattress_interface_qd.formulaid
                             FROM u_mattress_interface_qd
                                     ";
             var whereList = new List<string>();
             whereList.Add("mattressid = @mattressid");
             var param = new Dictionary<string, object>();
             param.Add("@mattressid", mattressid);
-            var outFields = "mattressid, printid, itemname, bj_pzname, bj_pzname_mx, bj_pzname_mx_mx, mtrlid, erp_mtrlid, useqty, dscrp, actual_useqty, qd_actual_size, qd_pfgroupqty, wrkgrpid, ss_rate, ls_rate, sh_rate";
+            var outFields = "mattressid, printid, itemname, bj_pzname, bj_pzname_mx, bj_pzname_mx_mx, mtrlid, erp_mtrlid, useqty, dscrp, actual_useqty, qd_actual_size, qd_pfgroupqty, wrkgrpid, ss_rate, ls_rate, sh_rate, formulaid";
             DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "printid", outFields, 0, 0, qdList);
 
 
@@ -1663,18 +1666,23 @@ namespace JLHHJSvr.Helper
                         {
                             case "裥面":
                                 chastrType.Add(mx.bj_pzname_mx_mx, 901);
+                                mx.billtype = 901;
                                 break;
                             case "裥底":
                                 chastrType.Add(mx.bj_pzname_mx_mx, 902);
+                                mx.billtype = 902;
                                 break;
                             case "大侧":
                                 chastrType.Add(mx.bj_pzname_mx_mx, 903);
+                                mx.billtype = 903;
                                 break;
                             case "小侧":
                                 chastrType.Add(mx.bj_pzname_mx_mx, 904);
+                                mx.billtype = 904;
                                 break;
                             case "V侧":
                                 chastrType.Add(mx.bj_pzname_mx_mx, 905);
+                                mx.billtype = 905;
                                 break;
                         }
                     }
@@ -1735,6 +1743,7 @@ namespace JLHHJSvr.Helper
                         {
                             mtrlid = qdmx.mtrlid.Value,
                             erp_mtrlid = qdmx.erp_mtrlid,
+                            formulaid = qdmx.formulaid
                         };
                         bcpMxList.Add(bcpmx);
                     }
@@ -1798,6 +1807,7 @@ namespace JLHHJSvr.Helper
                                 mtrlid = arr[0].erp_mtrlid.Value;
                             }
                             qdmx.erp_mtrlid = mtrlid;
+                            qdmx.formulaid = arr[0].formulaid;
                         }
 
                         bcpMattress.mxlist = bcpMxList;