提交代码
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.ZHGL.ServerCheck
|
||||
@@ -369,7 +372,7 @@ namespace FineUIPro.Web.ZHGL.ServerCheck
|
||||
/// <param name="e"></param>
|
||||
protected void btnGet_Click(object sender, EventArgs e)
|
||||
{
|
||||
var returnValue = CNCECHSSEWebService.getCheck_CheckRectify();
|
||||
var returnValue = getCheck_CheckRectifyListToSUB();
|
||||
if (returnValue.code == 1)
|
||||
{
|
||||
ShowNotify(returnValue.message, MessageBoxIcon.Success);
|
||||
@@ -379,5 +382,144 @@ namespace FineUIPro.Web.ZHGL.ServerCheck
|
||||
Alert.ShowInTop(returnValue.message, MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
|
||||
#region 获取
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.ResponeData getCheck_CheckRectifyListToSUB()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
string unitId = CommonService.GetThisUnitId();
|
||||
string baseurl = SysConstSetService.CNCECPath + "/api/HSSEData/getCheckRectify?unitId=" + unitId;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
|
||||
responeData.message = obj["message"].ToString();
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
JArray getData = JArray.Parse(obj["data"].ToString());
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
foreach (var item in getData)
|
||||
{
|
||||
string getCheckRectifyId = item["CheckRectifyId"].ToString();
|
||||
if (!ids.Contains(getCheckRectifyId))
|
||||
{
|
||||
var newRectify = db.Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == getCheckRectifyId);
|
||||
if (newRectify == null)
|
||||
{
|
||||
ids.Add(getCheckRectifyId);
|
||||
Model.Check_CheckRectify newCheckRectify = new Model.Check_CheckRectify
|
||||
{
|
||||
CheckRectifyId = getCheckRectifyId,
|
||||
CheckRectifyCode = item["CheckRectifyCode"].ToString(),
|
||||
ProjectId = item["ProjectId"].ToString(),
|
||||
UnitId = unitId,
|
||||
CheckDate = Funs.GetNewDateTime(item["CheckDate"].ToString()),
|
||||
IssueMan = item["IssueMan"].ToString(),
|
||||
IssueDate = Funs.GetNewDateTime(item["IssueDate"].ToString()),
|
||||
HandleState = item["HandleState"].ToString()
|
||||
};
|
||||
db.Check_CheckRectify.InsertOnSubmit(newCheckRectify);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
newRectify.CheckRectifyCode = item["CheckRectifyCode"].ToString();
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
//获取对应主表主键的明细集合
|
||||
string getTable5ItemId = item["Table5ItemId"].ToString();
|
||||
var oldItem5 = db.Check_CheckInfo_Table5Item.FirstOrDefault(x => x.ID == getTable5ItemId);
|
||||
if (oldItem5 == null)
|
||||
{
|
||||
|
||||
Model.Check_CheckInfo_Table5Item newCheckRectifyItem = new Model.Check_CheckInfo_Table5Item
|
||||
{
|
||||
ID = getTable5ItemId,
|
||||
SortIndex = Funs.GetNewInt(item["SortIndex"].ToString()),
|
||||
WorkType = item["WorkType"].ToString(),
|
||||
DangerPoint = item["DangerPoint"].ToString(),
|
||||
RiskExists = item["RiskExists"].ToString(),
|
||||
IsProject = Convert.ToBoolean(item["IsProject"].ToString()),
|
||||
CheckMan = item["CheckMan"].ToString(),
|
||||
SubjectUnitMan = item["SubjectUnitMan"].ToString(),
|
||||
};
|
||||
db.Check_CheckInfo_Table5Item.InsertOnSubmit(newCheckRectifyItem);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
BLL.CommonService.DeleteAttachFileById(getTable5ItemId);//删除附件
|
||||
////上传附件
|
||||
string getAttachFileId = item["AttachFileId"].ToString();
|
||||
if (!string.IsNullOrEmpty(getAttachFileId))
|
||||
{
|
||||
JArray byteList = item["FileContext"] as JArray;
|
||||
List<byte[]> resultList = new List<byte[]>();
|
||||
foreach (JToken token in byteList)
|
||||
{
|
||||
byte[] byteArray = Convert.FromBase64String(token.ToString());
|
||||
resultList.Add(byteArray);
|
||||
}
|
||||
|
||||
//List<byte[]> fileContext = new List<byte[]>();
|
||||
//fileContext.Add(Convert.FromBase64String(item["FileContext"].ToString()));
|
||||
BLL.FileInsertService.InsertAttachFile(getAttachFileId, getTable5ItemId, item["AttachSource"].ToString(), item["AttachUrl"].ToString(), resultList);
|
||||
}
|
||||
|
||||
string getCheckRectifyItemId = item["CheckRectifyItemId"].ToString();
|
||||
var oldItem = db.Check_CheckRectifyItem.FirstOrDefault(e => e.CheckRectifyItemId == getCheckRectifyItemId);
|
||||
if (oldItem == null)
|
||||
{
|
||||
Model.Check_CheckRectifyItem newCheckRectifyItem = new Model.Check_CheckRectifyItem
|
||||
{
|
||||
CheckRectifyItemId = getCheckRectifyItemId,
|
||||
CheckRectifyId = getCheckRectifyId,
|
||||
Table5ItemId = getTable5ItemId,
|
||||
ConfirmMan = item["ConfirmMan"].ToString(),
|
||||
ConfirmDate = Funs.GetNewDateTime(item["ConfirmDate"].ToString()),
|
||||
OrderEndDate = Funs.GetNewDateTime(item["OrderEndDate"].ToString()),
|
||||
OrderEndPerson = item["OrderEndPerson"].ToString(),
|
||||
RealEndDate = Funs.GetNewDateTime(item["RealEndDate"].ToString()),
|
||||
};
|
||||
|
||||
db.Check_CheckRectifyItem.InsertOnSubmit(newCheckRectifyItem);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
responeData.message = "获取成功:整改明细记录" + getData.Count().ToString() + "条";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "获取失败:" + ex.Message;
|
||||
ErrLogInfo.WriteLog("安全监督检查通知单获取!", ex);
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user