diff --git a/SGGL/BLL/API/HJGL/APIPackagingManageService.cs b/SGGL/BLL/API/HJGL/APIPackagingManageService.cs index ee61a943..95f4e477 100644 --- a/SGGL/BLL/API/HJGL/APIPackagingManageService.cs +++ b/SGGL/BLL/API/HJGL/APIPackagingManageService.cs @@ -110,8 +110,27 @@ namespace BLL { var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId); if (table != null) - { - table.PipelineComponentId = PipelineComponentIds; + { + if (string.IsNullOrEmpty(table.PipelineComponentId)) + { + table.PipelineComponentId = PipelineComponentIds; + } + else + { + HashSet set = new HashSet(); + string[] oldIds = table.PipelineComponentId.Split(','); + foreach (var id in oldIds) + { + set.Add(id); + } + string[] newIds = PipelineComponentIds.Split(','); + foreach (var id in newIds) + { + set.Add(id); + } + table.PipelineComponentId = string.Join(",", set); + + } } BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table); diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs index 4c719325..d411049a 100644 --- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs +++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs @@ -114,8 +114,8 @@ namespace BLL if (stock != null) { stock.StockNum -= material.MatchNum; - } - } + } + } var results = requiredMaterials; return results; @@ -177,7 +177,8 @@ namespace BLL var requiredMaterials = (from x in db.Tw_InOutPlanDetail_Relation join master in db.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode - join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId + join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId + join t in db.HJGL_WeldTask on master.WeldTaskId equals t.WeldTaskId where x.InOutPlanMasterId == outPlanMasterId select new Tw_PipeMatMatchOutput { @@ -191,9 +192,10 @@ namespace BLL MaterialUnit = y.MaterialUnit, MaterialDef = y.MaterialDef, NeedNum = x.Number, + PipeLineSortIndex=t.PipeLineSortIndex } ).ToList(); - var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId); + var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId); results = GetMatMatchOutput(requiredMaterials.OrderBy(x=>x.PipelineId).ThenBy(x=>x.MaterialCode).ToList(), masterModle.WarehouseCode, masterModle.ProjectId); return results; } diff --git a/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs b/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs index a9ada9c2..485ef651 100644 --- a/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs +++ b/SGGL/BLL/CLGL/TwInOutplandetailRelationService.cs @@ -4,6 +4,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; @@ -82,9 +83,10 @@ namespace BLL public static Model.Tw_InOutPlanDetail_Relation GetByPipelineId(string pipelineId,string WarehouseCode) { + int typeInt = (int)TwConst.TypeInt.散件出库; var q= from x in Funs.DB.Tw_InOutPlanDetail_Relation join y in Funs.DB .Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id - where x.PipelineId == pipelineId && y.WarehouseCode == WarehouseCode + where x.PipelineId == pipelineId && y.WarehouseCode == WarehouseCode && y.TypeInt!= typeInt select x; return q.FirstOrDefault(); } diff --git a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs index f08c9d5a..115f2f1b 100644 --- a/SGGL/BLL/CLGL/TwInOutplanmasterService.cs +++ b/SGGL/BLL/CLGL/TwInOutplanmasterService.cs @@ -87,7 +87,9 @@ namespace BLL AuditDate2 = x.AuditDate2, WarehouseMan = x.WarehouseMan, WarehouseDate = x.WarehouseDate, - WarehouseManName= warehouseperson.PersonName + WarehouseManName= warehouseperson.PersonName, + PipeLineSortIndex=y.PipeLineSortIndex + } ; @@ -145,7 +147,8 @@ namespace BLL AuditDate2 = x.AuditDate2, WarehouseMan = x.WarehouseMan, WarehouseDate = x.WarehouseDate, - WarehouseManName= x.WarehouseManName + WarehouseManName= x.WarehouseManName, + PipeLineSortIndex = x.PipeLineSortIndex, }).ToList(); } @@ -281,6 +284,15 @@ namespace BLL return responeData; } } + var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的材料编码 + if (typeString.Contains("采购入库") && typeString.Contains("退料入库")) + { + responeData.code = 0; + responeData.message = errorWarehouseCode + "每次只能导入一种类型!"; + return responeData; + } + + var materialCodeList = temeplateDtoIns.Select(x => x.MaterialCode).Distinct().ToList(); //获取导入文件的材料编码 var IsExitMaterialCode= from x in Funs.DB.HJGL_MaterialCodeLib @@ -296,7 +308,7 @@ namespace BLL return responeData; } } - string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId)); + string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId), temeplateDtoIns.FirstOrDefault().TypeString); foreach (var item in temeplateDtoIns) { item.CusBillCode = cusbilcode; @@ -320,7 +332,7 @@ namespace BLL foreach (var CusBillCode in CusBillCodeList) { var CusBillCodeDtoIns = temeplateDtoIns.Where(x => x.CusBillCode == CusBillCode).ToList(); - + var FirstCusBillCodeDtoIns = temeplateDtoIns.FirstOrDefault(x => x.CusBillCode == CusBillCode); var mapper = ObjectMapperManager.DefaultInstance.GetMapper, List>(); var mapperDetail = @@ -332,7 +344,21 @@ namespace BLL twInOutPlanMaster.Id = SQLHelper.GetNewID(); twInOutPlanMaster.InOutType= (int)TwConst.InOutType.入库; twInOutPlanMaster.State = (int)TwConst.State.待审核; - twInOutPlanMaster.TypeInt= (int)TwConst.TypeInt.采购入库; + + if ("采购入库".Equals(FirstCusBillCodeDtoIns.TypeString)) + { + twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.采购入库; + + } + else if ("退料入库".Equals(FirstCusBillCodeDtoIns.TypeString)) + { + twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.退料入库; + } + else + { + twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.其他入库; + } + twInOutPlanMaster.Category= (int)TwConst.Category.全部; twInOutPlanMaster.ProjectId = projectid; twInOutPlanMaster.CreateMan = creatUserId; @@ -514,7 +540,11 @@ namespace BLL planMasterModel.InOutType= (int)TwConst.InOutType.出库; break; case TwConst.TypeInt.退料入库: - planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(outMaster.WeldTaskCode, TwConst.TypeInt.退料入库, (BLL.TwConst.Category)planMasterModel.Category); + string pre = ""; + pre += DateTime.Now.ToString("yyyyMMdd"); + pre += UnitService.GetUnitCodeByUnitId(outMaster.ReqUnitId); + pre += "-"+ UnitWorkService.getUnitWorkByUnitWorkId(outMaster.UnitWorkId)?.UnitWorkCode; + planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(pre , TwConst.TypeInt.退料入库, (BLL.TwConst.Category)planMasterModel.Category); planMasterModel.TypeInt = (int)TwConst.TypeInt.退料入库; planMasterModel.InOutType = (int)TwConst.InOutType.入库; ; @@ -556,11 +586,11 @@ namespace BLL case TwConst.TypeInt.退料入库: if (category == TwConst.Category.管段) { - cusBillCode = taskCode + "-GI-P01-RE01"; + cusBillCode = taskCode + "-GI-P01-RE01-GR01"; } else if (category == TwConst.Category.管件) { - cusBillCode = taskCode + "-GI-PF01-RE01"; + cusBillCode = taskCode + "-GI-PF01-RE01-GR01"; } break; @@ -569,20 +599,34 @@ namespace BLL } - public static string GetDataInCusBillCode(string projectid, string unitcode) + public static string GetDataInCusBillCode(string projectid, string unitcode,string typeString) { - - //生成规则是20240919-unitcode-AP-GR01 - string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-"+unitcode + "-AP-GR"; - var queryAll = new Tw_InOutMasterOutput() + if (typeString == TwConst.TypeInt.退料入库.ToString()) { - ProjectId = projectid, - CusBillCode=cusBillCode, - }; - var queryAllresult = GetModle(queryAll).Count(); - cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0'); - return cusBillCode; - + //生成规则是20240919-unitcode-AP-GR01 + string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-" + unitcode + "-AP-GR"; + var queryAll = new Tw_InOutMasterOutput() + { + ProjectId = projectid, + CusBillCode = cusBillCode, + }; + var queryAllresult = GetModle(queryAll).Count(); + cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0'); + return cusBillCode; + } + else + { + //生成规则是20240919-unitcode-AP-GR01 + string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-" + unitcode + "-AP-GR"; + var queryAll = new Tw_InOutMasterOutput() + { + ProjectId = projectid, + CusBillCode = cusBillCode, + }; + var queryAllresult = GetModle(queryAll).Count(); + cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0'); + return cusBillCode; + } } /// diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx index 19ee4bf6..3fc1bf06 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx @@ -101,7 +101,7 @@ >(JsonConvert.SerializeObject(model)); - string pipeid= model2.First().Value; - - var relationModle=TwInoutplandetailRelationService.GetByPipelineId(pipeid,WarehouseCode); - if (relationModle!= null) + var model = Grid3.Rows[i].DataItem; + var model2 = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(model)); + string pipeid = model2.First().Value; + + var relationModle = TwInoutplandetailRelationService.GetByPipelineId(pipeid, WarehouseCode); + if (relationModle != null) { Grid3.Rows[i].RowCssClass = "yellow"; } diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx index 0bf00fb3..b7f94daa 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx @@ -61,7 +61,7 @@ @@ -141,7 +141,10 @@ DataField="Size" SortField="Size" FieldType="Double" HeaderTextAlign="Center" TextAlign="Left" Width="70px"> - + [ExcelColumnIndex("C")] public string PlanNum { get; set; } + /// + /// 类型 + /// + [ExcelColumnIndex("D")] public string TypeString { get; set; } + } } \ No newline at end of file diff --git a/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs b/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs index aa6c0d8f..72534643 100644 --- a/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs +++ b/SGGL/Model/CLGL/Tw_PipeMatMatchOutput.cs @@ -25,6 +25,8 @@ namespace Model public decimal? MatchNum { get; set; } public decimal? MatchRate { get; set; } public string MatchRateString { get; set; } + public int? PipeLineSortIndex { get; set; } + } public class Tw_PipeMatchOutput {