1
This commit is contained in:
@@ -45,7 +45,7 @@ namespace NX.ERP.U8.Store
|
||||
headXml.setAttribute("cDepCode", param.DepCode);
|
||||
headXml.setAttribute("cMaker", param.Maker);
|
||||
headXml.setAttribute("cPersonCode", param.PersonCode);
|
||||
Model.MOM.MomOrder Order = null;
|
||||
Model.MOM.MomOrder Order = null;
|
||||
if (param.source == "生产订单")
|
||||
{
|
||||
Order = new Mom.MomOrderDAL().GetModel(param.SourceCode);
|
||||
@@ -251,5 +251,113 @@ FROM MaterialAppVouch a
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据领料单号查询 带库位
|
||||
/// </summary>
|
||||
/// <param name="Code"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<Model.Response.Store.MaterialAppVouchAndPostName> GetModelAndPost(string OrderCode, string invCode)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(OrderCode) && !string.IsNullOrEmpty(invCode))
|
||||
{
|
||||
return this.GetListAndPost(" MA.cCode=@OrderCode AND MAS.cInvCode = @invCode ", new { OrderCode, invCode });
|
||||
}
|
||||
else
|
||||
if (!string.IsNullOrEmpty(OrderCode))
|
||||
{
|
||||
|
||||
return this.GetListAndPost(" MA.cCode=@OrderCode", new { OrderCode });
|
||||
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(invCode))
|
||||
{
|
||||
return this.GetListAndPost(" MAS.cInvCode = @invCode ", new { invCode });
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.GetListAndPost();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询领料信息 带库位
|
||||
/// </summary>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <param name="Params"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<Model.Response.Store.MaterialAppVouchAndPostName> GetListAndPost(string strWhere = null, object Params = null)
|
||||
{
|
||||
var strSQL = @"SELECT
|
||||
MA.cCode AS AppVouchOrderNo,--领料申请单号
|
||||
MAS.cInvCode MaterialCode,--物料编码
|
||||
INV.cInvName MaterialName,--物料名称
|
||||
INV.cInvStd MaterialSpec,--物料规格
|
||||
UNT.cComUnitName Unit,--单位
|
||||
MAS.iQuantity Qty,--数量
|
||||
CONVERT(varchar(100), MA.dDate, 23) DemandDate,--需求日期
|
||||
wh.cWhName WarehouseName,--仓库名称
|
||||
MAS.cpesocode ProductOrderNo,--生产单号
|
||||
MAS.ipesoseq ProductOrderLineNo,--生产单行号
|
||||
MAS.invcode ProductCode,--产品编码,
|
||||
PDT.cInvName ProductName,--产品名称
|
||||
PDT.cInvStd ProductSpec,--产品规格
|
||||
POST.cPosName [Position]--库位
|
||||
|
||||
FROM
|
||||
MaterialAppVouch MA
|
||||
LEFT JOIN MaterialAppVouchs MAS ON MA.ID = MAS.ID
|
||||
LEFT JOIN Inventory INV ON MAS.cInvCode = INV.cInvCode
|
||||
LEFT JOIN Warehouse wh ON WH.cwhcode = MAS.cwhcode
|
||||
LEFT JOIN ComputationUnit UNT ON INV.ccomunitcode = UNT.ccomunitcode
|
||||
LEFT JOIN Inventory PDT ON MAS.invcode = PDT.cInvCode
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
cinvcode,
|
||||
STUFF(
|
||||
(
|
||||
SELECT
|
||||
',' + cPosName
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
b.cPosName,
|
||||
a.cInvCode,
|
||||
a.iQuantity
|
||||
FROM
|
||||
InvPositionSum a WITH ( NOLOCK ),
|
||||
POSITION b WITH ( NOLOCK )
|
||||
WHERE
|
||||
a.iQuantity <> 0
|
||||
AND a.cPosCode= b.cPosCode
|
||||
) a
|
||||
WHERE
|
||||
b.cinvcode = a.cinvcode
|
||||
ORDER BY
|
||||
a.iQuantity DESC FOR XML PATH ( '' )
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) cPosName
|
||||
FROM
|
||||
InvPositionSum b
|
||||
GROUP BY
|
||||
cinvcode
|
||||
) AS post ON INV.cinvcode = post.cinvcode
|
||||
WHERE MAS.iQuantity > ISNULL(MAS.foutquantity,0)
|
||||
";
|
||||
if (!string.IsNullOrEmpty(strWhere))
|
||||
{
|
||||
strSQL += $" AND {strWhere} ";
|
||||
}
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
var list = conn.Query<Model.Response.Store.MaterialAppVouchAndPostName>(strSQL, Params);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user