物资出库
This commit is contained in:
parent
3733479772
commit
22df00fd57
|
@ -176,7 +176,16 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, checkDate);
|
|
||||||
|
if(string.IsNullOrEmpty(projectId))
|
||||||
|
{
|
||||||
|
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(checkDate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, checkDate);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using BLL;
|
using BLL;
|
||||||
|
using Model;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
@ -22,7 +23,8 @@ namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
{
|
{
|
||||||
int count = db.Cl_W_MaterialOutM.Where(x => x.UserTime == DateTime.Now).ToList().Count();
|
var userTime = DateTime.Now;
|
||||||
|
int count = db.Cl_W_MaterialOutM.Where(x => x.UserTime.Value.Year == userTime.Year&&x.UserTime.Value.Month==userTime.Month&&x.UserTime.Value.Day==userTime.Day).ToList().Count();
|
||||||
Model.Cl_W_MaterialOutM outm = new Model.Cl_W_MaterialOutM();
|
Model.Cl_W_MaterialOutM outm = new Model.Cl_W_MaterialOutM();
|
||||||
|
|
||||||
outm.OutSheetMID = MaterialOutM.OutSheetMID;
|
outm.OutSheetMID = MaterialOutM.OutSheetMID;
|
||||||
|
@ -85,9 +87,64 @@ namespace WebAPI.Controllers
|
||||||
outs.InstallationId = MaterialOutS.InstallationId;
|
outs.InstallationId = MaterialOutS.InstallationId;
|
||||||
outs.Shue = MaterialOutS.Shue;
|
outs.Shue = MaterialOutS.Shue;
|
||||||
outs.Bhsje = MaterialOutS.Bhsje;
|
outs.Bhsje = MaterialOutS.Bhsje;
|
||||||
|
|
||||||
db.Cl_W_MaterialOutS.InsertOnSubmit(outs);
|
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")
|
||||||
|
{
|
||||||
|
clw.IsOk = "1";
|
||||||
|
}
|
||||||
|
|
||||||
db.SubmitChanges();
|
db.SubmitChanges();
|
||||||
|
|
||||||
responeData.data = MaterialOutS.OutSheetSID;
|
responeData.data = MaterialOutS.OutSheetSID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue