diff --git a/HJGL_DS/BLL/API/APIBaseServices.cs b/HJGL_DS/BLL/API/APIBaseServices.cs index 0e2214f..10cbb17 100644 --- a/HJGL_DS/BLL/API/APIBaseServices.cs +++ b/HJGL_DS/BLL/API/APIBaseServices.cs @@ -222,6 +222,70 @@ namespace BLL.API return respone; } + public static Model.ResponeData weldMethodList() + { + Model.ResponeData respone = new ResponeData(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var q = BLL.HJGL_WeldingMethodService.GetWeldMethodNameList(); + List res = new List(); + foreach (var p in q) + { + WeldMethodItem item = new WeldMethodItem(); + item.WME_ID = p.WME_ID; + item.WME_Name = p.WME_Name; + res.Add(item); + } + + respone.data = res; + } + return respone; + } + + public static Model.ResponeData weldSilkList() + { + Model.ResponeData respone = new ResponeData(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var q = from x in db.View_WeldInfoDropDownLists + where x.WeldTypeName.Contains("焊丝") + select x; + List res = new List(); + foreach (var p in q) + { + WeldInfoItem item = new WeldInfoItem(); + item.WeldId = p.WeldId; + item.WeldName = p.WeldName; + res.Add(item); + } + + respone.data = res; + } + return respone; + } + + public static Model.ResponeData weldMatList() + { + Model.ResponeData respone = new ResponeData(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var q = from x in db.View_WeldInfoDropDownLists + where x.WeldTypeName.Contains("焊条") + select x; + List res = new List(); + foreach (var p in q) + { + WeldInfoItem item = new WeldInfoItem(); + item.WeldId = p.WeldId; + item.WeldName = p.WeldName; + res.Add(item); + } + + respone.data = res; + } + return respone; + } + public static Model.ResponeData getWeldInfo(string weldId) { Model.ResponeData respone = new ResponeData(); diff --git a/HJGL_DS/BLL/API/APIWeldServices.cs b/HJGL_DS/BLL/API/APIWeldServices.cs index bd2f877..b45f1de 100644 --- a/HJGL_DS/BLL/API/APIWeldServices.cs +++ b/HJGL_DS/BLL/API/APIWeldServices.cs @@ -312,6 +312,104 @@ namespace BLL.API return respone; } + public static Model.ResponeData getUsingPlanTempByUserId(string userId) + { + Model.ResponeData respone = new ResponeData(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Weld_UsingPlan_Temp usingPlan = (from x in db.Weld_UsingPlan_Temp where x.InPutMan == userId select x).FirstOrDefault(); + + UsingPlanItem planItem = new UsingPlanItem(); + planItem.UsingPlanId = usingPlan.UsingPlanTempId; + planItem.WeldId = usingPlan.WeldId; + planItem.ProjectId = usingPlan.ProjectId; + planItem.UsePosition = usingPlan.UsePosition; + planItem.Amount = usingPlan.Amount; + planItem.UsingManOne = usingPlan.UsingManOne; + planItem.UsingManTwo = usingPlan.UsingManTwo; + if (usingPlan.InPutDate != null) + { + planItem.InPutDate = string.Format("{0:yyyy-MM-dd}", usingPlan.InPutDate); + } + if (usingPlan.CancelDate != null) + { + planItem.CancelDate = string.Format("{0:yyyy-MM-dd}", usingPlan.CancelDate); + } + planItem.IsCancel = usingPlan.IsCancel; + planItem.FinishMan = usingPlan.FinishMan; + planItem.OrderTime = usingPlan.OrderTime; + if (usingPlan.OrderDate != null) + { + planItem.OrderDate = string.Format("{0:yyyy-MM-dd}", usingPlan.OrderDate); + } + planItem.CancelResult = usingPlan.CancelResult; + planItem.IsSubmit = usingPlan.IsSubmit; + planItem.UsingUnit = usingPlan.UsingUnit; + planItem.IsNeedConfirm = usingPlan.IsNeedConfirm; + planItem.InPutMan = usingPlan.InPutMan; + planItem.IsSteelStru = usingPlan.IsSteelStru; + planItem.TeamGroupId = usingPlan.TeamGroupId; + planItem.STE_ID = usingPlan.STE_ID; + planItem.IsFinish = usingPlan.IsFinish; + planItem.STE_Name = usingPlan.STE_Name; + planItem.UnitStoreId = BLL.UnitStoreService.GetUnitStoreNameById(usingPlan.UnitStoreId); + + if (!string.IsNullOrEmpty(planItem.ProjectId)) + { + var project = db.Base_Project.Where(x => x.ProjectId == planItem.ProjectId).FirstOrDefault(); + if (project != null) + { + planItem.ProjectName = project.ProjectName; + planItem.ProjectCode = project.ProjectCode; + } + } + if (!string.IsNullOrEmpty(planItem.WeldId)) + { + var weldInfo = db.Weld_WeldInfo.Where(x => x.WeldId == planItem.WeldId).FirstOrDefault(); + if (weldInfo != null) + { + planItem.WeldName = weldInfo.WeldName; + planItem.WeldSpec = weldInfo.WeldSpec; + planItem.WeldCode = weldInfo.WeldCode; + } + if (weldInfo != null && !string.IsNullOrEmpty(weldInfo.WeldTypeId)) + { + var weldType = db.Weld_WeldType.Where(x => x.WeldTypeId == weldInfo.WeldTypeId).FirstOrDefault(); + + if (weldType != null) + { + + } + } + } + + if (!string.IsNullOrEmpty(planItem.UsingManOne)) + { + planItem.UsingManOneName = db.HJGL_BS_Welder.Where(x => x.WED_ID == planItem.UsingManOne).Select(x => x.WED_Name).FirstOrDefault(); + } + if (!string.IsNullOrEmpty(planItem.UsingManTwo)) + { + planItem.UsingManTwoName = db.HJGL_BS_Welder.Where(x => x.WED_ID == planItem.UsingManTwo).Select(x => x.WED_Name).FirstOrDefault(); + } + if (!string.IsNullOrEmpty(planItem.UsingUnit)) + { + planItem.UsingUnitName = db.Base_Unit.Where(x => x.UnitId == planItem.UsingUnit).Select(x => x.UnitName).FirstOrDefault(); + } + if (!string.IsNullOrEmpty(planItem.InPutMan)) + { + planItem.InPutManName = db.Sys_User.Where(x => x.UserId == planItem.InPutMan).Select(x => x.UserName).FirstOrDefault(); + } + if (!string.IsNullOrEmpty(planItem.TeamGroupId)) + { + planItem.TeamGroupName = db.Base_TeamGroup.Where(x => x.TeamGroupId == planItem.TeamGroupId).Select(x => x.TeamGroupName).FirstOrDefault(); + } + + + respone.data = planItem; + } + return respone; + } + public static Model.ResponeData welderQueIsPass(string welderId, string steelType, bool isSteelStru) { Model.ResponeData respone = new ResponeData(); @@ -523,11 +621,12 @@ namespace BLL.API where x.ProjectId == projectId select new { + WED_ID = y.WED_ID, WED_Code = y.WED_Code, WED_Name = y.WED_Name, }; - responeData.data = res.Skip(page * pageSize).Take(pageSize); + responeData.data = res.Skip(page * pageSize).Take(pageSize).ToList(); } } catch (Exception ex) @@ -540,5 +639,45 @@ namespace BLL.API } #endregion + #region 根据项目id获取可选择的焊工信息列表 + /// + /// 根据项目id获取可选择的焊工信息列表 + /// + /// 人员ID + /// 交换类型 + /// + public static Model.ResponeData getProjectWelderSelectList(string projectId, string str, int page, int pageSize) + { + var responeData = new Model.ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var res = db.HJGL_BS_Welder + .Where(w => w.IsOAM == true) // 对应 AND IsOAM=1 + .Where(w => !db.Project_Welder + .Any(pw => pw.ProjectId == projectId && pw.WED_ID == w.WED_ID)) // 对应 NOT IN 子查询 + .Select(w => new + { + WED_ID = w.WED_ID, + WED_Code = w.WED_Code, + WED_Name = w.WED_Name + "(" + w.WED_Code + ")", + }); + if (!string.IsNullOrEmpty(str)) + { + res = res.Where(w => w.WED_Code.Contains(str) || w.WED_Name.Contains(str)); + } + responeData.data = res.Skip(page * pageSize).Take(pageSize).ToList(); + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + ErrLogInfo.WriteLog(ex, "根据项目id获取可选择的焊工信息列表", "WeldController.getProjectWelderSelectList"); + } + return responeData; + } + #endregion } } diff --git a/HJGL_DS/BLL/HJGL/WeldingManage/HJGL_PW_JointInfoService.cs b/HJGL_DS/BLL/HJGL/WeldingManage/HJGL_PW_JointInfoService.cs index 757ff32..8770e1f 100644 --- a/HJGL_DS/BLL/HJGL/WeldingManage/HJGL_PW_JointInfoService.cs +++ b/HJGL_DS/BLL/HJGL/WeldingManage/HJGL_PW_JointInfoService.cs @@ -1376,5 +1376,145 @@ namespace BLL } return name; } + + /// + /// 根据焊口Id获取焊口信息 + /// + /// + /// + public static Model.HJGL_SpRpWeldReportItem GetJointItemByJotID(string jot_id) + { + Model.HJGL_SpRpWeldReportItem newWeldReportItem = new Model.HJGL_SpRpWeldReportItem(); + Model.SGGLDB db = Funs.DB; + var jotInfo = db.HJGL_PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jot_id); + var jotView = db.HJGL_View_JointInfo.FirstOrDefault(e => e.JOT_ID == jot_id); + newWeldReportItem.JOT_ID = jotInfo.JOT_ID; + newWeldReportItem.JOT_JointNo = jotInfo.JOT_JointNo; + newWeldReportItem.ProjectId = jotInfo.ProjectId; + var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(jotInfo.ISO_ID); + if (isoInfo != null) + { + newWeldReportItem.ISO_IsoNo = isoInfo.ISO_IsoNo; + newWeldReportItem.ISO_Id = isoInfo.ISO_ID; + + } + if (jotInfo.WLO_Code == "F") + { + newWeldReportItem.WLO_CodeName = "现场安装"; + newWeldReportItem.WLO_CodeID = "F"; + } + else + { + newWeldReportItem.WLO_CodeName = "预制"; + newWeldReportItem.WLO_CodeID = "S"; + } + + newWeldReportItem.JOT_JointAttribute = jotInfo.JOT_JointAttribute; + string steName = string.Empty; + if (jotView.STE_Name1 != null && jotView.STE_Name2 != null && jotView.STE_Name1 != jotView.STE_Name2) + { + steName = jotView.STE_Name1 + "/" + jotView.STE_Name2; + } + else if (jotView.STE_Name1 != null) + { + steName = jotView.STE_Name1; + } + else if (jotView.STE_Name2 != null) + { + steName = jotView.STE_Name2; + } + newWeldReportItem.STE_Code = steName; + var joty = BLL.HJGL_WeldService.GetJointTypeByID(jotInfo.JOTY_ID); + newWeldReportItem.JOTY_Group = joty.JOTY_Group; + + if (jotInfo.JOT_JointAttribute == "固定") + { + if (joty != null && (joty.JOTY_Group == "2" || joty.JOTY_Group == "3")) + { + newWeldReportItem.JOT_Location = "5F"; + } + else if (joty != null && joty.JOTY_Group == "1") + { + newWeldReportItem.JOT_Location = "2G"; + } + else + { + newWeldReportItem.JOT_Location = "5G"; + } + } + else + { + if (joty != null && (joty.JOTY_Group == "2" || joty.JOTY_Group == "3")) + { + newWeldReportItem.JOT_Location = "1F"; + } + else + { + newWeldReportItem.JOT_Location = "1G"; + } + } + newWeldReportItem.JOT_Size = jotInfo.JOT_Size; + newWeldReportItem.JOT_DoneDin = jotInfo.JOT_Size; + newWeldReportItem.JOT_Dia = jotInfo.JOT_Dia; + newWeldReportItem.JOT_Sch = jotInfo.JOT_Sch; + if (!string.IsNullOrEmpty(jotInfo.JOT_CellWelder)) //盖面焊工 + { + var cellWelder = BLL.HJGL_PersonManageService.GetWelderByWenId(jotInfo.JOT_CellWelder); + if (cellWelder != null) + { + newWeldReportItem.JOT_CellWelderID = cellWelder.WED_ID; + newWeldReportItem.JOT_CellWelderCode = cellWelder.WED_Name + "(" + cellWelder.WED_Code + ")"; + } + } + if (!string.IsNullOrEmpty(jotInfo.JOT_FloorWelder)) //打底焊工 + { + var floorWelder = BLL.HJGL_PersonManageService.GetWelderByWenId(jotInfo.JOT_FloorWelder); + if (floorWelder != null) + { + newWeldReportItem.JOT_FloorWelderID = floorWelder.WED_ID; + newWeldReportItem.JOT_FloorWelderCode = floorWelder.WED_Name + "(" + floorWelder.WED_Code + ")"; + } + } + if (!string.IsNullOrEmpty(jotInfo.WME_ID)) + { + var weldingMethod = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(jotInfo.WME_ID); + if (weldingMethod != null) + { + newWeldReportItem.WME_ID = weldingMethod.WME_ID; + newWeldReportItem.WME_Name = weldingMethod.WME_Name; + } + } + if (!string.IsNullOrEmpty(jotInfo.JOT_WeldMat)) + { + //var weldMat = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(jotInfo.JOT_WeldMat); + //if (weldMat != null) + //{ + // newWeldReportItem.JOT_WeldMat = weldMat.WMT_ID; + // newWeldReportItem.WeldMatCode = weldMat.WMT_MatCode; + //} + var weldMat = (from x in Funs.DB.View_WeldInfoDropDownLists where x.WeldId == jotInfo.JOT_WeldMat select x).FirstOrDefault(); + if (weldMat != null) + { + newWeldReportItem.JOT_WeldMat = weldMat.WeldId; + newWeldReportItem.WeldMatCode = weldMat.WeldName; + } + } + if (!string.IsNullOrEmpty(jotInfo.JOT_WeldSilk)) + { + //var weldSilk = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(jotInfo.JOT_WeldSilk); + //if (weldSilk != null) + //{ + // newWeldReportItem.JOT_WeldSilk = weldSilk.WMT_ID; + // newWeldReportItem.WeldSilkCode = weldSilk.WMT_MatCode; + //} + var weldSilk = Funs.DB.View_WeldInfoDropDownLists.FirstOrDefault(x => x.WeldId == jotInfo.JOT_WeldSilk); + if (weldSilk != null) + { + newWeldReportItem.JOT_WeldSilk = weldSilk.WeldId; + newWeldReportItem.WeldSilkCode = weldSilk.WeldName; + } + } + return newWeldReportItem; + } } } diff --git a/HJGL_DS/Model/APIItem/WeldMethodItem.cs b/HJGL_DS/Model/APIItem/WeldMethodItem.cs new file mode 100644 index 0000000..59df335 --- /dev/null +++ b/HJGL_DS/Model/APIItem/WeldMethodItem.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class WeldMethodItem + { + public string WME_ID { get; set; } + + /** + * id + */ + + + public string WME_Name { get; set; } + + /** + * 名称 + */ + } +} diff --git a/HJGL_DS/Model/HJGL/HJGL_SpRpWeldReportItem.cs b/HJGL_DS/Model/HJGL/HJGL_SpRpWeldReportItem.cs index 440189a..74f3fc1 100644 --- a/HJGL_DS/Model/HJGL/HJGL_SpRpWeldReportItem.cs +++ b/HJGL_DS/Model/HJGL/HJGL_SpRpWeldReportItem.cs @@ -27,6 +27,14 @@ namespace Model set; } /// + /// 项目id + /// + public string ProjectId + { + get; + set; + } + /// /// 索引 /// public int SortIndex diff --git a/HJGL_DS/Model/Model.csproj b/HJGL_DS/Model/Model.csproj index 30cda61..ff75728 100644 --- a/HJGL_DS/Model/Model.csproj +++ b/HJGL_DS/Model/Model.csproj @@ -72,6 +72,7 @@ + diff --git a/HJGL_DS/WebAPI/Controllers/BaseController.cs b/HJGL_DS/WebAPI/Controllers/BaseController.cs index 219ae31..558f254 100644 --- a/HJGL_DS/WebAPI/Controllers/BaseController.cs +++ b/HJGL_DS/WebAPI/Controllers/BaseController.cs @@ -201,6 +201,57 @@ namespace WebAPI.Controllers return respone; } + [HttpGet] + public Model.ResponeData weldMethodList() + { + Model.ResponeData respone = new ResponeData(); + try + { + + return APIBaseServices.weldMethodList(); + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } + + [HttpGet] + public Model.ResponeData weldSilkList() + { + Model.ResponeData respone = new ResponeData(); + try + { + + return APIBaseServices.weldSilkList(); + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } + + [HttpGet] + public Model.ResponeData weldMatList() + { + Model.ResponeData respone = new ResponeData(); + try + { + + return APIBaseServices.weldMatList(); + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } + [HttpGet] public Model.ResponeData getVersion() { diff --git a/HJGL_DS/WebAPI/Controllers/JointInfoController.cs b/HJGL_DS/WebAPI/Controllers/JointInfoController.cs index b9ca994..ca02e3a 100644 --- a/HJGL_DS/WebAPI/Controllers/JointInfoController.cs +++ b/HJGL_DS/WebAPI/Controllers/JointInfoController.cs @@ -431,5 +431,31 @@ namespace WebAPI.Controllers return isok; } #endregion + + #region 根据焊口ID获取焊口信息 + /// + /// 根据焊口ID获取焊口信息 + /// + /// + /// + [HttpGet] + public Model.ResponeData getJointInfoById(string jotId) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = HJGL_PW_JointInfoService.GetJointItemByJotID(jotId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + } } \ No newline at end of file diff --git a/HJGL_DS/WebAPI/Controllers/WeldController.cs b/HJGL_DS/WebAPI/Controllers/WeldController.cs index 8e54900..6378b64 100644 --- a/HJGL_DS/WebAPI/Controllers/WeldController.cs +++ b/HJGL_DS/WebAPI/Controllers/WeldController.cs @@ -60,6 +60,22 @@ namespace WebAPI.Controllers return respone; } [HttpGet] + public Model.ResponeData getUsingPlanTempByUserId(string userId) + { + Model.ResponeData respone = new ResponeData(); + try + { + + return APIWeldServices.getUsingPlanTempByUserId(userId); + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } + [HttpGet] public Model.ResponeData welderQueIsPass(string welderId, string steelType, bool isSteelStru) { Model.ResponeData respone = new ResponeData(); @@ -168,6 +184,32 @@ namespace WebAPI.Controllers } } } + #region 添加到临时表,以供下次登录时加载当前登录人保存的记录数据 + BLL.UsingPlanTempService.DeleteUsingPlanTempByUserId(usingPlan.InPutMan); + Model.Weld_UsingPlan_Temp newTemp = new Model.Weld_UsingPlan_Temp(); + newTemp.UsingPlanTempId = BLL.SQLHelper.GetNewID(typeof(Model.Weld_UsingPlan_Temp)); + newTemp.UnitStoreId = usingPlan.UnitStoreId; + newTemp.WeldId = usingPlan.WeldId; + newTemp.ProjectId = usingPlan.ProjectId; + newTemp.UsePosition = usingPlan.UsePosition; + newTemp.UsingUnit = usingPlan.UsingUnit; + newTemp.STE_ID = usingPlan.STE_ID; + newTemp.STE_Name = usingPlan.STE_Name; + newTemp.Amount = usingPlan.Amount; + newTemp.UsingManOne = usingPlan.UsingManOne; + newTemp.InPutDate = DateTime.Now; + newTemp.OrderDate = DateTime.Now; + newTemp.OrderTime = usingPlan.OrderTime; + newTemp.TeamGroupId = usingPlan.TeamGroupId; + newTemp.CancelDate = BLL.Funs.GetNewDateTime(usingPlan.CancelDate); + newTemp.IsCancel = usingPlan.IsCancel; + newTemp.CancelResult = usingPlan.CancelResult; + newTemp.IsSubmit = usingPlan.IsSubmit; + newTemp.InPutMan = usingPlan.InPutMan; + newTemp.Type = "1"; + newTemp.IsSteelStru = usingPlan.IsSteelStru; + BLL.UsingPlanTempService.AddUsingPlan(newTemp); + #endregion return APIWeldServices.addUsingPlan(usingPlan); } catch (Exception e) @@ -229,5 +271,54 @@ namespace WebAPI.Controllers } return respone; } + + [HttpGet] + public Model.ResponeData getProjectWelderSelectList(string projectId, string str, int page, int pageSize) + { + Model.ResponeData respone = new ResponeData(); + try + { + + return APIWeldServices.getProjectWelderSelectList(projectId, str, page, pageSize); + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } + + [HttpGet] + public Model.ResponeData saveProjectWelderSelectList(string projectId, string wed_ids) + { + Model.ResponeData respone = new ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(BLL.Funs.ConnString)) + { + string[] ids = wed_ids.Split(','); + List list = new List(); + foreach (string id in ids) + { + Model.Project_Welder newProjectWelder = new Model.Project_Welder(); + newProjectWelder.WED_ID = id; + newProjectWelder.ProjectId = projectId; + newProjectWelder.IsSelected = true; + newProjectWelder.IsApprove = true; + newProjectWelder.ProjectWelderId = BLL.SQLHelper.GetNewID(typeof(Model.Project_Welder)); + list.Add(newProjectWelder); + } + db.Project_Welder.InsertAllOnSubmit(list); + db.SubmitChanges(); + } + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } } } \ No newline at end of file