This commit is contained in:
parent
64082cbb9c
commit
41c9569eea
File diff suppressed because it is too large
Load Diff
|
@ -156,13 +156,26 @@ namespace WebAPI.Controllers
|
|||
{
|
||||
|
||||
string strSql = "SELECT cp.ProjectId,cp.InstallationId,zz.Installationname AS InstallationName,ghfs AS Ghfs,cp.MaterialID,MaterialName,specificationtype AS Specificationtype,MaterialQuality,standardspecification ,unit AS Unit," +
|
||||
"technicalconditions AS TechnicalConditions,SystemCode,rtrim( ltrim( TAreaMaterialMID ) ) AS AreaCode,0.000 AS bcckl,SUM ( Aquantity ) AS Aquantity,SUM ( Pquantity ) AS jh_quantity,SUM ( SQuantity ) AS dj_quantity,SUM ( HQuantity ) AS hj_quantity,SUM ( Pquantity ) - SUM ( OQuantity ) AS ck_quantity,SUM ( RQuantity ) AS tk_quantity,(SELECT SUM( SQuantity ) - SUM ( OQuantity ) + SUM ( RQuantity ) - SUM ( HQuantity ) FROM cl_w_comp WHERE cl_w_comp.MaterialID= cp.MaterialID AND cl_w_comp.InstallationId= cp.InstallationId AND cl_w_comp.ghfs= cp.ghfs ) AS kc_quantity,ROW_NUMBER ( ) OVER ( ORDER BY zz.InstallationCode,SystemCode ASC ) AS RowNum,0 AS xz,0 AS xh FROM cl_w_comp cp LEFT JOIN CL_B_Material mt ON mt.MaterialID= cp.MaterialID LEFT JOIN cl_b_Installation zz ON zz.InstallationId= cp.InstallationId GROUP BY cp.ProjectId,cp.InstallationId,zz.InstallationCode,zz.Installationname,ghfs,cp.MaterialID,MaterialName,specificationtype,MaterialQuality,standardspecification,unit,technicalconditions,SystemCode,TAreaMaterialMID HAVING " ;
|
||||
"technicalconditions AS TechnicalConditions,SystemCode,";
|
||||
if (!string.IsNullOrWhiteSpace(area))
|
||||
{
|
||||
strSql += "rtrim( ltrim( TAreaMaterialMID ) ) AS AreaCode,";
|
||||
}
|
||||
strSql += "0.000 AS bcckl,SUM ( Aquantity ) AS Aquantity,SUM ( Pquantity ) AS jh_quantity,SUM ( SQuantity ) AS dj_quantity,SUM ( HQuantity ) AS hj_quantity,SUM ( Pquantity ) - SUM ( OQuantity ) AS ck_quantity,SUM ( RQuantity ) AS tk_quantity,(SELECT SUM( SQuantity ) - SUM ( OQuantity ) + SUM ( RQuantity ) - SUM ( HQuantity ) FROM cl_w_comp WHERE cl_w_comp.MaterialID= cp.MaterialID AND cl_w_comp.InstallationId= cp.InstallationId AND cl_w_comp.ghfs= cp.ghfs ) AS kc_quantity,ROW_NUMBER ( ) OVER ( ORDER BY zz.InstallationCode,SystemCode ASC ) AS RowNum,0 AS xz,0 AS xh FROM cl_w_comp cp LEFT JOIN CL_B_Material mt ON mt.MaterialID= cp.MaterialID LEFT JOIN cl_b_Installation zz ON zz.InstallationId= cp.InstallationId GROUP BY cp.ProjectId,cp.InstallationId,zz.InstallationCode,zz.Installationname,ghfs,cp.MaterialID,MaterialName,specificationtype,MaterialQuality,standardspecification,unit,technicalconditions,SystemCode";
|
||||
if (!string.IsNullOrWhiteSpace(area))
|
||||
{
|
||||
strSql += ", TAreaMaterialMID";
|
||||
}
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
strSql += "cp.ProjectId= @ProjectId AND cp.installationid= @InstallationId AND TAreaMaterialMID = @area AND ghfs = @ghfs";
|
||||
strSql += " HAVING cp.ProjectId= @ProjectId AND cp.installationid= @InstallationId AND ghfs = @ghfs";
|
||||
listStr.Add(new SqlParameter("@ProjectId", ProjectId));
|
||||
listStr.Add(new SqlParameter("@InstallationId", InstallationId));
|
||||
listStr.Add(new SqlParameter("@ghfs", ghfs));
|
||||
listStr.Add(new SqlParameter("@area", area));
|
||||
if (!string.IsNullOrWhiteSpace(area))
|
||||
{
|
||||
strSql += " AND TAreaMaterialMID = @area ";
|
||||
listStr.Add(new SqlParameter("@area", area));
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
responeData.data = tb;
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Web.Http;
|
||||
using WebAPI.Helpers;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
|
||||
public class MaterialsExitController : ApiController
|
||||
{
|
||||
#region 添加物资入库主表
|
||||
[HttpPost]
|
||||
public Model.ResponeData AddMaterialExitM(Model.Cl_W_MaterialStorageM exit)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var userTime = DateTime.Now;
|
||||
int count = db.Cl_W_MaterialStorageM.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_MaterialStorageM exitM = new Model.Cl_W_MaterialStorageM
|
||||
{
|
||||
StorageSheetMID = exit.StorageSheetMID,
|
||||
StorageSheetCode = string.Format("RKD--{0}{1}", DateTime.Now.ToString("yyyyMMdd"), count.ToString("000")),
|
||||
UserId = exit.UserId,
|
||||
UserTime = DateTime.Now,
|
||||
IsOk = "0", // 0-未审核,1-已审核
|
||||
APid = exit.APid, // 采购方类别(甲乙供)
|
||||
Specialityid = exit.Specialityid, // 专业ID
|
||||
InstallationId = exit.InstallationId
|
||||
};
|
||||
exit.UserTime = DateTime.Now;
|
||||
exit.StorageSheetCode = string.Format("CKD--{0}{1}", DateTime.Now.ToString("yyyyMMdd"), count.ToString("000"));
|
||||
db.Cl_W_MaterialStorageM.InsertOnSubmit(exitM);
|
||||
db.SubmitChanges();
|
||||
responeData.data = exit;
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 添加物资入库 子
|
||||
[HttpPost]
|
||||
public Model.ResponeData AddMaterialExitS(Model.Cl_W_MaterialStorageS s)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Cl_W_MaterialStorageS cws = new Model.Cl_W_MaterialStorageS();
|
||||
cws.SystemCode = s.SystemCode;
|
||||
cws.StorageQuantity = s.StorageQuantity; // 到货数量
|
||||
cws.TheoryWeight = s.TheoryWeight; // 单价
|
||||
cws.ActualWeight = s.ActualWeight; // 金额
|
||||
cws.RecordTableOptions = s.RecordTableOptions; // 备注说明
|
||||
cws.Manufacturer = s.Manufacturer; // 制造厂家
|
||||
cws.ProjectId = s.ProjectId;
|
||||
cws.StorageSheetMID = s.StorageSheetMID;
|
||||
cws.StorageSheetSID = Guid.NewGuid().ToString();
|
||||
cws.MaterialID = s.MaterialID;
|
||||
db.Cl_W_MaterialStorageS.InsertOnSubmit(cws);
|
||||
db.SubmitChanges();
|
||||
responeData.data = "添加成功";
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -176,7 +176,7 @@
|
|||
<Compile Include="Controllers\HSSE\SafetyInspectionController.cs" />
|
||||
<Compile Include="Controllers\HSSE\SafetyResponsibilitiesController.cs" />
|
||||
<Compile Include="Controllers\HSSE\TrainTestRecordController.cs" />
|
||||
<Compile Include="Controllers\MaterialEntranceAndExitController.cs" />
|
||||
<Compile Include="Controllers\MaterialsExitController.cs" />
|
||||
<Compile Include="Controllers\MaterialsBasicsController.cs" />
|
||||
<Compile Include="Controllers\MaterialsOutController.cs" />
|
||||
<Compile Include="Controllers\Person\PersonCheckController.cs" />
|
||||
|
|
Loading…
Reference in New Issue