Merge branch 'master' of http://36.153.118.214:10080/nx.wms/u8-import
This commit is contained in:
@@ -5,10 +5,32 @@ using System.Text;
|
||||
|
||||
namespace NX.ERP.U8.MES
|
||||
{
|
||||
public class MesLogic:BaseLogic
|
||||
public class MesLogic : BaseLogic
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
public bool ReportSnList(Model.Request.ProductOrderReportSn info)
|
||||
{
|
||||
#region 校验数据
|
||||
var momOrder = new Mom.MomOrderDAL().GetModel(info.ProductOrder);
|
||||
if (momOrder == null || string.IsNullOrEmpty(momOrder.ProductOrderNo))
|
||||
{
|
||||
throw new Exception($"非法的生产单号[{info.ProductOrder}]");
|
||||
}
|
||||
foreach (var detail in info.OrderDetails)
|
||||
{
|
||||
var momOrderDetail = momOrder.ProductDtlLst.First(m => { return m.ProductOrderDtlId == detail.SourceDetailId; });
|
||||
if (momOrderDetail == null || momOrderDetail.ProductOrderDtlId <= 0)
|
||||
{
|
||||
throw new Exception($"非法的生产明细[{detail.SourceDetailId}]");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 写入DB
|
||||
var instertSql = "INSERT INTO [dbo].[MES_PRODUCT_SN_LIST] ([PRODUCT_ORDER_NO], [ORDER_LINE_ID], [SN]) VALUES (@PRODUCT_ORDER_NO, @ORDER_LINE_ID, @SN);";
|
||||
using (var conn = MesDb.GetSqlConnection())
|
||||
{
|
||||
@@ -29,7 +51,7 @@ namespace NX.ERP.U8.MES
|
||||
cmd.CommandText = instertSql;
|
||||
cmd.Parameters.Clear();
|
||||
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PRODUCT_ORDER_NO", info.ProductOrder));
|
||||
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ORDER_LINE_ID", detail.OrderLineId));
|
||||
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ORDER_LINE_ID", detail.SourceDetailId));
|
||||
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@SN", sn));
|
||||
var val = cmd.ExecuteNonQuery();
|
||||
if (val <= 0)
|
||||
@@ -44,6 +66,7 @@ namespace NX.ERP.U8.MES
|
||||
conn.Close();
|
||||
return true;
|
||||
}
|
||||
#endregion 写入DB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,54 @@ namespace NX.ERP.U8.Finance
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<object> Voucherror(NX.ERP.Model.Request.VouchererrorRequest info)
|
||||
{
|
||||
string sql = $@"
|
||||
select *from (
|
||||
select c.MoCode,b.SortSeq,b.InvCode,d.cInvName,a.InvCode as InvCode1, t.cInvName as cInvName1,t.cInvStd,a.Qty , a.IssQty ,'超领' as error from mom_moallocate a WITH (NOLOCK)
|
||||
left join mom_orderdetail b WITH (NOLOCK) on a.MoDId= b.MoDId
|
||||
left join mom_order c WITH (NOLOCK) on b.MoId= c.MoId
|
||||
left join Inventory d WITH (NOLOCK) on b.InvCode= d.cInvCode
|
||||
left join Inventory t WITH (NOLOCK) on a.InvCode= t.cInvCode
|
||||
where a.Qty < a.IssQty
|
||||
|
||||
union all
|
||||
select c.MoCode,b.SortSeq,b.InvCode,d.cInvName,a.InvCode as InvCode1, t.cInvName as cInvName1,t.cInvStd,a.Qty , a.IssQty ,'缺领' as error from mom_moallocate a WITH (NOLOCK)
|
||||
left join mom_orderdetail b WITH (NOLOCK) on a.MoDId= b.MoDId
|
||||
left join mom_order c WITH (NOLOCK) on b.MoId= c.MoId
|
||||
left join Inventory d WITH (NOLOCK) on b.InvCode= d.cInvCode
|
||||
left join Inventory t WITH (NOLOCK) on a.InvCode= t.cInvCode
|
||||
where a.IssQty < a.Qty*(b.QualifiedInQty/b.qty)
|
||||
) mm
|
||||
";
|
||||
|
||||
|
||||
List<string> where = new List<string>();
|
||||
|
||||
if (info.Ccode != null)
|
||||
{
|
||||
where.Add(" mm.MoCode in @Ccode");
|
||||
}
|
||||
if (info.error != null)
|
||||
{
|
||||
where.Add(" mm.error in @error");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var aa = string.Join(" and ", where.ToArray());
|
||||
|
||||
if (!string.IsNullOrEmpty(aa))
|
||||
{
|
||||
sql += " where " + aa;
|
||||
}
|
||||
|
||||
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
|
||||
{
|
||||
return conn.Query<object>(sql, new { info.Ccode, info.error });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,25 +37,24 @@ SELECT cinvcode,
|
||||
),1 ,1, '') cPosName
|
||||
FROM InvPositionSum b
|
||||
GROUP BY cinvcode
|
||||
|
||||
|
||||
|
||||
select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as ArrivalDate,A.cVenCode AS SupplierCode,
|
||||
select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode, CONVERT(varchar(100), a.dDate, 23) as ArrivalDate,A.cVenCode AS SupplierCode,
|
||||
B.Autoid as id,b.ID as ArrivalID,
|
||||
b.cInvCode AS MaterialCode,
|
||||
b.cInvCode AS MaterialCode,cinvname ,cinvstd,
|
||||
b.cBatch AS BatchNo,
|
||||
b.fvalidinquan as RealQuantity,
|
||||
b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum,
|
||||
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate,
|
||||
Pos.cPosName
|
||||
FROM pu_ArrBody b , pu_ArrHead a
|
||||
, (select cinvcode as cinvcode1,iId from inventory) inventory
|
||||
, PO_Podetails C WITH (NOLOCK) ,
|
||||
tempdb..tablearrive20210603 Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
|
||||
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
|
||||
FROM pu_ArrBody b left join tempdb..tablearrive20210603 Pos on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'') , pu_ArrHead a
|
||||
, (select cinvcode as cinvcode1,iId from inventory WITH (NOLOCK) ) inventory
|
||||
, PO_Podetails C WITH (NOLOCK)
|
||||
|
||||
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') -- and ( isnull (b.cInvCode,'')=isnull(Pos.cInvCode,''))
|
||||
And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>'' and a.id=b.id and b.cinvcode=inventory.cinvcode1 and B.iPOsID = C.ID
|
||||
And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2
|
||||
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1
|
||||
|
||||
";
|
||||
|
||||
List<string> where = new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user