提交代码
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using System.Net.PeerToPeer;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -49,58 +49,64 @@ namespace BLL
|
||||
if (count == 0) return null;
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.UnitId,
|
||||
x.CollCropCode,
|
||||
x.UnitName,
|
||||
x.ReportDate,
|
||||
x.WelderNum,
|
||||
x.TotalDineNum,
|
||||
x.CompleteDineNum,
|
||||
x.TotalFilmNum,
|
||||
x.OKFilmNum,
|
||||
x.State,
|
||||
x.CreateDate,
|
||||
x.CreateMan
|
||||
};
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.UnitId,
|
||||
x.CollCropCode,
|
||||
x.UnitName,
|
||||
x.ReportDate,
|
||||
x.WelderNum,
|
||||
x.TotalDineNum,
|
||||
x.CompleteDineNum,
|
||||
x.TotalFilmNum,
|
||||
x.OKFilmNum,
|
||||
x.State,
|
||||
x.CreateDate,
|
||||
x.CreateMan
|
||||
};
|
||||
}
|
||||
|
||||
#endregion 获取列表
|
||||
|
||||
public static void AddHJGLData_HJGL(HJGLData_HJGL newtable)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var table = new HJGLData_HJGL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Id = newtable.Id,
|
||||
UnitId = newtable.UnitId,
|
||||
CollCropCode = newtable.CollCropCode,
|
||||
UnitName = newtable.UnitName,
|
||||
ReportDate = newtable.ReportDate,
|
||||
WelderNum = newtable.WelderNum,
|
||||
TotalDineNum = newtable.TotalDineNum,
|
||||
CompleteDineNum = newtable.CompleteDineNum,
|
||||
TotalFilmNum = newtable.TotalFilmNum,
|
||||
OKFilmNum = newtable.OKFilmNum,
|
||||
State = newtable.State,
|
||||
CreateDate = newtable.CreateDate,
|
||||
CreateMan = newtable.CreateMan
|
||||
};
|
||||
db.HJGLData_HJGL.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
var table = new HJGLData_HJGL
|
||||
{
|
||||
Id = newtable.Id,
|
||||
UnitId = newtable.UnitId,
|
||||
CollCropCode = newtable.CollCropCode,
|
||||
UnitName = newtable.UnitName,
|
||||
ReportDate = newtable.ReportDate,
|
||||
WelderNum = newtable.WelderNum,
|
||||
TotalDineNum = newtable.TotalDineNum,
|
||||
CompleteDineNum = newtable.CompleteDineNum,
|
||||
TotalFilmNum = newtable.TotalFilmNum,
|
||||
OKFilmNum = newtable.OKFilmNum,
|
||||
State = newtable.State,
|
||||
CreateDate = newtable.CreateDate,
|
||||
CreateMan = newtable.CreateMan
|
||||
};
|
||||
db.HJGLData_HJGL.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteHJGLData_HJGLById(string Id)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
db.HJGLData_HJGL.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
db.HJGLData_HJGL.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static HJGLData_HJGL GetHJGLData_HJGLById(string Id)
|
||||
@@ -151,12 +157,17 @@ namespace BLL
|
||||
|
||||
public static HJGLData GetTodayHJGLData_HJGL()
|
||||
{
|
||||
var q = GetTodayData();
|
||||
var data = new HJGLData();
|
||||
if (CommonService.GetIsThisUnit().CollCropCode == "91410200170644116B")
|
||||
if (CommonService.GetIsThisUnit().CollCropCode== "91410200170644116B")
|
||||
{
|
||||
return GetELECLTodayHJGLData_HJGL();
|
||||
return GetELECLTodayHJGLData_HJGL();
|
||||
}
|
||||
if (CommonService.GetIsThisUnit().CollCropCode == "914200001775697881")
|
||||
{
|
||||
return GetCNCEC_16TodayHJGLData_HJGL();
|
||||
|
||||
}
|
||||
var q = GetTodayData();
|
||||
if (q != null && q.State == Const.CNCEC_State_S)
|
||||
data = StatisticalData();
|
||||
else
|
||||
@@ -174,23 +185,82 @@ namespace BLL
|
||||
string token = Const.sysglyId;
|
||||
string response = Funs.RequestPost(baseurl, token, "");
|
||||
var json = JsonConvert.DeserializeObject(response) as JObject;
|
||||
if (json != null && json["code"]?.ToString()=="1")
|
||||
{
|
||||
var str = json["data"]?.ToString();
|
||||
if (str != null) data = JsonConvert.DeserializeObject<HJGLData>(str);
|
||||
}
|
||||
return data;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取十六化建焊接数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static HJGLData GetCNCEC_16TodayHJGLData_HJGL()
|
||||
{
|
||||
var data = new HJGLData();
|
||||
string baseurl = "https://aq.cncec16.com.cn/hjglWebApi/api/CNCECServer/PostGetHJGLData";
|
||||
string token = Const.sysglyId;
|
||||
string response = Funs.RequestPost(baseurl, token, "");
|
||||
if (string.IsNullOrEmpty(response))
|
||||
{
|
||||
try
|
||||
{
|
||||
baseurl = "http://192.168.1.8/hjglwebapi/api/CNCECServer/PostGetHJGLData";
|
||||
response = Funs.RequestPost(baseurl, token, "");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APICommonService.SaveSysHttpLog("GetCNCEC_16TodayHJGLData_HJGL", baseurl, e.ToString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
var json = JsonConvert.DeserializeObject(response) as JObject;
|
||||
if (json != null && json["code"]?.ToString() == "1")
|
||||
{
|
||||
var str = json["data"]?.ToString();
|
||||
if (str != null) data = JsonConvert.DeserializeObject<HJGLData>(str);
|
||||
}
|
||||
APICommonService.SaveSysHttpLog("GetCNCEC_16TodayHJGLData_HJGL", baseurl, response);
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
public static HJGLData_HJGL GetTodayData()
|
||||
{
|
||||
var q = (from x in Funs.DB.HJGLData_HJGL
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).FirstOrDefault();
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).FirstOrDefault();
|
||||
return q;
|
||||
}
|
||||
|
||||
public static HJGLData_HJGL GetSubUnitHjglDataByDate(string Unitid, DateTime? reportdate)
|
||||
{
|
||||
var result = new Model.HJGLData_HJGL();
|
||||
if (reportdate == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var projectlist = BLL.ProjectService.GetProjectWorkList();
|
||||
var baseUnit = UnitService.GetUnitByUnitId(Unitid);
|
||||
var ProjectData = (from x in Funs.DB.Project_HJGLData_HJGL
|
||||
where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId)
|
||||
select x).ToList();
|
||||
result = new HJGLData_HJGL
|
||||
{
|
||||
UnitId = Unitid,
|
||||
CollCropCode = baseUnit.CollCropCode,
|
||||
UnitName = baseUnit.UnitName,
|
||||
ReportDate = DateTime.Now.Date,
|
||||
WelderNum = ProjectData.Sum(x => x.WelderNum),
|
||||
TotalDineNum = ProjectData.Sum(x => x.TotalDineNum),
|
||||
CompleteDineNum = ProjectData.Sum(x => x.CompleteDineNum),
|
||||
TotalFilmNum = ProjectData.Sum(x => x.TotalFilmNum),
|
||||
OKFilmNum = ProjectData.Sum(x => x.OKFilmNum),
|
||||
CreateMan = Const.sysglyId,
|
||||
CreateDate = DateTime.Now
|
||||
};
|
||||
return result;
|
||||
}
|
||||
public static void UpdateTodyData_State()
|
||||
{
|
||||
var q = GetTodayData();
|
||||
@@ -205,8 +275,8 @@ namespace BLL
|
||||
{
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.HJGLData_HJGL
|
||||
where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date
|
||||
select x).ToList();
|
||||
where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date
|
||||
select x).ToList();
|
||||
if (q != null && q.Count > 0) result = true;
|
||||
return result;
|
||||
}
|
||||
@@ -219,8 +289,8 @@ namespace BLL
|
||||
{
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.HJGLData_HJGL
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
if (q.Count > 0) result = true;
|
||||
return result;
|
||||
}
|
||||
@@ -242,8 +312,8 @@ namespace BLL
|
||||
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
|
||||
var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
|
||||
var ProjectData = (from x in Funs.DB.Project_HJGLData_HJGL
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
Project_HJGLData_HJGLService.StatisticalAllProjectData();
|
||||
Project_HJGLData_DefectService.StatisticalAllProjectData();
|
||||
|
||||
@@ -294,26 +364,29 @@ namespace BLL
|
||||
}
|
||||
|
||||
public static void UpdateHJGLData_HJGL(HJGLData_HJGL newtable)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
if (table != null)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
table.Id = newtable.Id;
|
||||
table.UnitId = newtable.UnitId;
|
||||
table.CollCropCode = newtable.CollCropCode;
|
||||
table.UnitName = newtable.UnitName;
|
||||
table.ReportDate = newtable.ReportDate;
|
||||
table.WelderNum = newtable.WelderNum;
|
||||
table.TotalDineNum = newtable.TotalDineNum;
|
||||
table.CompleteDineNum = newtable.CompleteDineNum;
|
||||
table.TotalFilmNum = newtable.TotalFilmNum;
|
||||
table.OKFilmNum = newtable.OKFilmNum;
|
||||
table.State = newtable.State;
|
||||
table.CreateMan = newtable.CreateMan;
|
||||
table.CreateDate = newtable.CreateDate;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
if (table != null)
|
||||
{
|
||||
table.Id = newtable.Id;
|
||||
table.UnitId = newtable.UnitId;
|
||||
table.CollCropCode = newtable.CollCropCode;
|
||||
table.UnitName = newtable.UnitName;
|
||||
table.ReportDate = newtable.ReportDate;
|
||||
table.WelderNum = newtable.WelderNum;
|
||||
table.TotalDineNum = newtable.TotalDineNum;
|
||||
table.CompleteDineNum = newtable.CompleteDineNum;
|
||||
table.TotalFilmNum = newtable.TotalFilmNum;
|
||||
table.OKFilmNum = newtable.OKFilmNum;
|
||||
table.State = newtable.State;
|
||||
table.CreateMan = newtable.CreateMan;
|
||||
table.CreateDate = newtable.CreateDate;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user