修改库存查询

This commit is contained in:
gongxh
2021-05-20 09:47:35 +08:00
parent d5d705ac8d
commit 38bc652cae
4 changed files with 58 additions and 33 deletions

View File

@@ -36,14 +36,10 @@ namespace NX.ERP.U8.Store
if (metailApp == null)
{
throw new Exception("未知的领料申请单");
}
headXml.setAttribute("cbustype", "领料");
headXml.setAttribute("cbuscode", metailApp.Code);
string lastProductNo = null;
string lastProductNo = null;
IXMLDOMElement bodyXml;
for (var n = 0; n < storeOut.Details.Count(); n++)
{
@@ -53,14 +49,10 @@ namespace NX.ERP.U8.Store
{
throw new Exception("未知明细");
}
bodyXml = domBody.createElement("z:row");
var metail = new NX.ERP.U8.MaterialDAL().GetInvPrice(detail.InvCode, 1, storeOut.Whcode, out var _cost);
bodyXml.setAttribute("iunitcost", _cost);
bodyXml.setAttribute("imaids", materialAppDetail.MaterialAppDtlId);
bodyXml.setAttribute("imaids", materialAppDetail.MaterialAppDtlId);//
var info = new Account.Accinformation();
bodyXml.setAttribute("iprice", info.FormatMoney(_cost * detail.Quantity));
bodyXml.setAttribute("cinvcode", detail.InvCode);
@@ -71,10 +63,8 @@ namespace NX.ERP.U8.Store
bodyXml.setAttribute("cposition", detail.Position);
bodyXml.setAttribute("editprop", "A");
bodyXml.setAttribute("innum", 10);
bodyXml.setAttribute("imoseq", materialAppDetail.Moseq);
bodyXml.setAttribute("inquantity", materialAppDetail.Quantit- materialAppDetail.OutQuantity);
bodyXml.setAttribute("inquantity", materialAppDetail.Quantit- materialAppDetail.OutQuantity);
bodyXml.setAttribute("crejectcode", materialAppDetail.RejectCode);
bodyXml.setAttribute("iOMoMID", materialAppDetail.OmomId);
bodyXml.setAttribute("iopseq", materialAppDetail.OpSeq);
@@ -100,10 +90,6 @@ namespace NX.ERP.U8.Store
bodyXml.setAttribute("cpesocode", materialAppDetail.PesoCode);
bodyXml.setAttribute("ipesodid", materialAppDetail.PesodId);
bodyXml.setAttribute("ipesoseq", materialAppDetail.PesoSeq);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
}
@@ -198,7 +184,11 @@ namespace NX.ERP.U8.Store
}
/// <summary>
///
/// </summary>
/// <param name="storeOut"></param>
/// <returns></returns>
public string AddVocher(Model.Request.MaterialStoreOut storeOut)
{
VoucherParameter voucherParameter = new VoucherParameter
@@ -254,7 +244,11 @@ namespace NX.ERP.U8.Store
}
}
/// <summary>
///
/// </summary>
/// <param name="storeOut"></param>
/// <returns></returns>
public string SaveVoucher(Model.Request.MaterialStoreOut storeOut)
{
var voucherParameter = this.LoadVoucher($"id='{storeOut.Id}'");
@@ -276,7 +270,12 @@ namespace NX.ERP.U8.Store
}
}
/// <summary>
///
/// </summary>
/// <param name="storeOut"></param>
/// <param name="voucherParameter"></param>
/// <returns></returns>
public bool UpdateVocher(Model.Request.MaterialStoreOut storeOut, VoucherParameter voucherParameter = null)
{
if (voucherParameter == null)

View File

@@ -8,24 +8,42 @@ namespace NX.ERP.U8.Store
{
public class StockDAL
{
/// <summary>
///
/// </summary>
/// <param name="strwhere"></param>
/// <param name="Params"></param>
/// <returns></returns>
public IEnumerable<Model.Response.Store.Stock> GetList(string strwhere = "", object Params = null)
{
using (var conn = U8LoginContext.Instance.Connection)
{
var sql = @"select a.cInvCode as MaterialCode ,c.cPosName as BinName,(isnull(a.iQuantity,0)-isnull(b.iQuantity,0)) as Qty from (
select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=1 group by cInvCode,cPosCode
)a full join (
select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=0 group by cInvCode,cPosCode)
b on isnull(a.cInvCode,'')=isnull(b.cInvCode,'') and a.cPosCode=b.cPosCode
left join Position c on a.cPosCode=c.cPosCode
where a.cPosCode like '021%'";
select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=1 group by cInvCode,cPosCode
)a full join (
select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=0 group by cInvCode,cPosCode)
b on isnull(a.cInvCode,'')=isnull(b.cInvCode,'') and a.cPosCode=b.cPosCode
left join Position c on a.cPosCode=c.cPosCode where a.iQuantity<>b.iQuantity";
if (!string.IsNullOrEmpty(strwhere))
{
sql += $" where {strwhere}";
sql += $" and {strwhere}";
}
return conn.Query<Model.Response.Store.Stock>(sql, Params);
}
}
/// <summary>
///
/// </summary>
/// <param name="Code"></param>
/// <returns></returns>
public IEnumerable<Model.Response.Store.Stock> GetListByMaterialCode(string Code)
{
return this.GetList(" a.cInvCode like @Code", new { Code = $"%{Code}%" });
}
}
}