物资添加照片
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
using BLL;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Web.Http;
|
||||
using static WebAPI.Controllers.HSSE.ImageRecognitionController;
|
||||
|
||||
@@ -173,5 +175,43 @@ namespace WebAPI.Controllers
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存物资文件
|
||||
[HttpPost]
|
||||
public Model.ResponeData UploadMaterialsFile(Model.Cl_file file)
|
||||
{
|
||||
Model.ResponeData responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
int count = db.Cl_file.Count();
|
||||
Model.Cl_file new_file = new Model.Cl_file();
|
||||
new_file.FID = Guid.NewGuid().ToString();
|
||||
new_file.Ffl = file.Ffl;
|
||||
new_file.Fname = file.Fname;
|
||||
new_file.Fshm = file.Fshm;
|
||||
new_file.UserTime = DateTime.Now;
|
||||
new_file.UserID = file.UserID;
|
||||
new_file.Flj = file.Flj;
|
||||
new_file.Flx = file.Flx;
|
||||
new_file.Bz = file.Bz;
|
||||
new_file.InstallationId = file.InstallationId;
|
||||
new_file.Unid = file.Unid;
|
||||
new_file.ProjectId = file.ProjectId;
|
||||
db.Cl_file.InsertOnSubmit(new_file);
|
||||
db.SubmitChanges();
|
||||
responeData.message = new_file.FID;
|
||||
}
|
||||
|
||||
}
|
||||
catch(System.Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
using System.Web.Http;
|
||||
|
||||
|
||||
@@ -37,9 +38,10 @@ namespace WebAPI.Controllers
|
||||
outm.PlanSheetMID = MaterialOutM.PlanSheetMID; // 工区ID
|
||||
outm.YYPID = MaterialOutM.YYPID;
|
||||
outm.RecordMan = MaterialOutM.RecordMan;
|
||||
MaterialOutM.OutSheetCode = string.Format("CKD--{0}{1}", DateTime.Now.ToString("yyyyMMdd"), count.ToString("000"));
|
||||
db.Cl_W_MaterialOutM.InsertOnSubmit(outm);
|
||||
db.SubmitChanges();
|
||||
responeData.data = MaterialOutM.OutSheetMID;
|
||||
responeData.data = MaterialOutM;
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
@@ -89,54 +91,6 @@ namespace WebAPI.Controllers
|
||||
outs.Bhsje = MaterialOutS.Bhsje;
|
||||
|
||||
db.Cl_W_MaterialOutS.InsertOnSubmit(outs);
|
||||
|
||||
var sourceData = db.Cl_W_MaterialOutS
|
||||
.Where(s => s.OutSheetMID == MaterialOutS.OutSheetMID)
|
||||
.Select(s => new // 先投影到匿名对象
|
||||
{
|
||||
ProjectId = s.ProjectId,
|
||||
InstallationId = db.Cl_W_MaterialOutM
|
||||
.Where(m => m.OutSheetMID == s.OutSheetMID)
|
||||
.Select(m => m.InstallationId)
|
||||
.FirstOrDefault(),
|
||||
Ghfs = db.Cl_W_MaterialOutM
|
||||
.Where(m => m.OutSheetMID == s.OutSheetMID)
|
||||
.Select(m => m.YYPID)
|
||||
.FirstOrDefault(),
|
||||
FirstpartyCode = s.FirstpartyCode,
|
||||
MaterialID = s.MaterialID,
|
||||
OutSheetMID = s.OutSheetMID,
|
||||
OutSheetSID = s.OutSheetSID,
|
||||
OutQuantity = s.OutQuantity
|
||||
})
|
||||
.AsEnumerable() // 切换到客户端评估
|
||||
.Select(x => new Model.Cl_w_comp // 现在可以构造实体对象了
|
||||
{
|
||||
CompID = Guid.NewGuid().ToString(),
|
||||
ProjectId = x.ProjectId,
|
||||
InstallationId = x.InstallationId,
|
||||
Ghfs = x.Ghfs,
|
||||
TAreaMaterialMID = x.FirstpartyCode,
|
||||
TAreaMaterialSID = "",
|
||||
MaterialID = x.MaterialID,
|
||||
Aquantity = 0,
|
||||
PlanSheetMID = "",
|
||||
PlanSheetSID = "",
|
||||
Pquantity = 0,
|
||||
StorageSheetMID = "",
|
||||
StorageSheetSID = "",
|
||||
SQuantity = 0,
|
||||
StorageHJSID = "",
|
||||
StorageHJMID = "",
|
||||
HQuantity = 0,
|
||||
OutSheetMID = x.OutSheetMID,
|
||||
OutSheetSID = x.OutSheetSID,
|
||||
OQuantity = x.OutQuantity,
|
||||
ReturnSheetMid = "",
|
||||
ReturnSheetSID = "",
|
||||
RQuantity = 0
|
||||
});
|
||||
db.Cl_w_comp.InsertAllOnSubmit(sourceData);
|
||||
Model.Cl_W_MaterialOutM clw = db.Cl_W_MaterialOutM.FirstOrDefault(x => x.OutSheetMID == MaterialOutS.OutSheetMID);
|
||||
if(clw.IsOk != "1")
|
||||
{
|
||||
@@ -144,7 +98,34 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
|
||||
db.SubmitChanges();
|
||||
|
||||
|
||||
Model.Cl_w_comp cl = new Model.Cl_w_comp();
|
||||
cl.CompID = Guid.NewGuid().ToString();
|
||||
cl.ProjectId = MaterialOutS.ProjectId;
|
||||
cl.InstallationId = clw.InstallationId;
|
||||
cl.Ghfs = clw.YYPID;
|
||||
cl.TAreaMaterialMID = MaterialOutS.FirstpartyCode;
|
||||
cl.TAreaMaterialSID = "";
|
||||
cl.MaterialID = MaterialOutS.MaterialID;
|
||||
cl.Aquantity = 0;
|
||||
cl.PlanSheetMID = "";
|
||||
cl.PlanSheetSID = "";
|
||||
cl.Pquantity = 0;
|
||||
cl.StorageSheetMID = "";
|
||||
cl.StorageSheetSID = "";
|
||||
cl.SQuantity = 0;
|
||||
cl.StorageHJSID = "";
|
||||
cl.StorageHJMID = "";
|
||||
cl.HQuantity = 0;
|
||||
cl.OutSheetMID = MaterialOutS.OutSheetMID;
|
||||
cl.OutSheetSID = outs.OutSheetSID;
|
||||
cl.OQuantity = MaterialOutS.OutQuantity;
|
||||
cl.ReturnSheetMid = "";
|
||||
cl.ReturnSheetSID = "";
|
||||
cl.RQuantity = 0;
|
||||
|
||||
db.Cl_w_comp.InsertOnSubmit(cl);
|
||||
db.SubmitChanges();
|
||||
responeData.data = MaterialOutS.OutSheetSID;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user