1
This commit is contained in:
@@ -89,6 +89,7 @@
|
|||||||
<Compile Include="Response\Pmc\PmcInventorymomRes.cs" />
|
<Compile Include="Response\Pmc\PmcInventorymomRes.cs" />
|
||||||
<Compile Include="Response\Store\MaterialApp.cs" />
|
<Compile Include="Response\Store\MaterialApp.cs" />
|
||||||
<Compile Include="Response\Store\BinStock.cs" />
|
<Compile Include="Response\Store\BinStock.cs" />
|
||||||
|
<Compile Include="Response\Store\MaterialAppVouchAndPostName.cs" />
|
||||||
<Compile Include="Response\Store\Stock.cs" />
|
<Compile Include="Response\Store\Stock.cs" />
|
||||||
<Compile Include="TimestampConverter.cs" />
|
<Compile Include="TimestampConverter.cs" />
|
||||||
<Compile Include="Request\Arrival.cs" />
|
<Compile Include="Request\Arrival.cs" />
|
||||||
|
|||||||
76
NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs
Normal file
76
NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace NX.ERP.Model.Response.Store
|
||||||
|
{
|
||||||
|
public class MaterialAppVouchAndPostName
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 领料单号
|
||||||
|
/// </summary>
|
||||||
|
public string AppVouchOrderNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialSpec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位
|
||||||
|
/// </summary>
|
||||||
|
public string Unit { get; set; }
|
||||||
|
|
||||||
|
public decimal Qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 需求日期
|
||||||
|
/// </summary>
|
||||||
|
public string DemandDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库名称
|
||||||
|
/// </summary>
|
||||||
|
public string WarehouseName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产单号
|
||||||
|
/// </summary>
|
||||||
|
public string ProductOrderNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产单行号
|
||||||
|
/// </summary>
|
||||||
|
public string ProductOrderLineNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品编码
|
||||||
|
/// </summary>
|
||||||
|
public string ProductCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品名称
|
||||||
|
/// </summary>
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品规格
|
||||||
|
/// </summary>
|
||||||
|
public string ProductSpec { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 库位
|
||||||
|
/// </summary>
|
||||||
|
public string Position { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,9 @@ namespace NX.ERP.U8.MES
|
|||||||
{
|
{
|
||||||
throw new Exception($"非法的生产单号[{info.ProductOrder}]");
|
throw new Exception($"非法的生产单号[{info.ProductOrder}]");
|
||||||
}
|
}
|
||||||
|
using (var conn = U8LoginContext.Instance.Connection)
|
||||||
|
{
|
||||||
|
|
||||||
foreach (var detail in info.OrderDetails)
|
foreach (var detail in info.OrderDetails)
|
||||||
{
|
{
|
||||||
//校验明细行合法性
|
//校验明细行合法性
|
||||||
@@ -35,13 +38,48 @@ namespace NX.ERP.U8.MES
|
|||||||
{
|
{
|
||||||
throw new Exception($"包含非法的序列号[{string.Join(",", lstExcept.ToArray())}]");
|
throw new Exception($"包含非法的序列号[{string.Join(",", lstExcept.ToArray())}]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dicSnCount = new Dictionary<string, int>();
|
||||||
|
var rd = conn.ExecuteReader(querySnSql, new { SN = string.Join(",", detail.SnList.ToArray()) });
|
||||||
|
while (rd.Read())
|
||||||
|
{
|
||||||
|
var sn = rd["cinvsn"]?.ToString();
|
||||||
|
var compareCount = -1;//仅用于未赋值的标记,实际数据不存在-1
|
||||||
|
if (dicSnCount.ContainsKey(sn))
|
||||||
|
{
|
||||||
|
compareCount = dicSnCount[sn];
|
||||||
|
}
|
||||||
|
if (rd["InOutType"]?.ToString() == "出")
|
||||||
|
{
|
||||||
|
if (compareCount == -1)
|
||||||
|
{
|
||||||
|
dicSnCount.Add(sn, int.Parse(rd["COUNT"].ToString()));
|
||||||
|
}
|
||||||
|
else if (int.Parse(rd["COUNT"].ToString()) <= compareCount)
|
||||||
|
{
|
||||||
|
throw new Exception($"序列号[{rd["cinvsn"]?.ToString()}]校验失败,无法继续入库");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rd["InOutType"]?.ToString() == "入")
|
||||||
|
{
|
||||||
|
if (compareCount == -1)
|
||||||
|
{
|
||||||
|
dicSnCount.Add(sn, int.Parse(rd["COUNT"].ToString()));
|
||||||
|
}
|
||||||
|
else if (int.Parse(rd["COUNT"].ToString()) > compareCount)
|
||||||
|
{
|
||||||
|
throw new Exception($"序列号[{rd["cinvsn"]?.ToString()}]校验失败,无法继续入库");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conn.Close();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 写入DB
|
#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);";
|
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 = U8LoginContext.Instance.Connection)
|
|
||||||
{
|
|
||||||
conn.Open();
|
conn.Open();
|
||||||
conn.ChangeDatabase(System.Configuration.ConfigurationManager.AppSettings["ApiDbName"]);
|
conn.ChangeDatabase(System.Configuration.ConfigurationManager.AppSettings["ApiDbName"]);
|
||||||
var tran = conn.BeginTransaction();
|
var tran = conn.BeginTransaction();
|
||||||
@@ -73,5 +111,885 @@ namespace NX.ERP.U8.MES
|
|||||||
}
|
}
|
||||||
#endregion 写入DB
|
#endregion 写入DB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const string querySnSql = @"
|
||||||
|
declare @chrSQl as nvarchar(4000) ,@tmptableName nvarchar(100),
|
||||||
|
@sWhere nvarchar(4000)=''
|
||||||
|
declare @sTmpWhere as nvarchar(4000)
|
||||||
|
set @sWhere=rtrim(ltrim(@sWhere))
|
||||||
|
select @tmptableName='SP_ST_SNLSZ20210615'
|
||||||
|
|
||||||
|
if @sWhere<>'' set @sWhere=' and '+@sWhere
|
||||||
|
|
||||||
|
if exists (select name from tempdb..sysobjects where name=@tmptablename and xtype=N'u')
|
||||||
|
exec ('drop table tempdb..'+@tmptableName)
|
||||||
|
|
||||||
|
|
||||||
|
set @chrSQL = N'CREATE TABLE tempdb..'+@tmptableName +N' (
|
||||||
|
[ID] [int] NULL ,
|
||||||
|
[cVouchType] [nvarchar] (20) NULL ,
|
||||||
|
[VouchType] [nvarchar] (150) NULL ,
|
||||||
|
[cInvCode] [nvarchar] (60) NULL ,
|
||||||
|
[cInvName] [nvarchar] (60) NOT NULL ,
|
||||||
|
[cInvAddCode] [nvarchar] (30) NULL ,
|
||||||
|
[cInvStd] [nvarchar] (60) NULL ,
|
||||||
|
[ccomunitcode] [nvarchar] (35) NULL ,
|
||||||
|
[cinvm_unit] [nvarchar] (20) NOT NULL ,
|
||||||
|
[cFree1] [nvarchar] (20) NULL ,
|
||||||
|
[cFree2] [nvarchar] (20) NULL ,
|
||||||
|
[cFree3] [nvarchar] (20) NULL ,
|
||||||
|
[cFree4] [nvarchar] (20) NULL ,
|
||||||
|
[cFree5] [nvarchar] (20) NULL ,
|
||||||
|
[cFree6] [nvarchar] (20) NULL ,
|
||||||
|
[cFree7] [nvarchar] (20) NULL ,
|
||||||
|
[cFree8] [nvarchar] (20) NULL ,
|
||||||
|
[cFree9] [nvarchar] (20) NULL ,
|
||||||
|
[cFree10] [nvarchar] (20) NULL ,
|
||||||
|
[cInvDefine1] [nvarchar] (20) NULL ,
|
||||||
|
[cInvDefine2] [nvarchar] (20) NULL ,
|
||||||
|
[cInvDefine3] [nvarchar] (20) NULL ,
|
||||||
|
[cInvDefine4] [nvarchar] (60) NULL ,
|
||||||
|
[cInvDefine5] [nvarchar] (60) NULL ,
|
||||||
|
[cInvDefine6] [nvarchar] (60) NULL ,
|
||||||
|
[cInvDefine7] [nvarchar] (120) NULL ,
|
||||||
|
[cInvDefine8] [nvarchar] (120) NULL ,
|
||||||
|
[cInvDefine9] [nvarchar] (120) NULL ,
|
||||||
|
[cInvDefine10] [nvarchar] (120) NULL ,
|
||||||
|
[cInvDefine11] [int] NULL ,
|
||||||
|
[cInvDefine12] [int] NULL ,
|
||||||
|
[cInvDefine13] [float] NULL ,
|
||||||
|
[cInvDefine14] [float] NULL ,
|
||||||
|
[cInvDefine15] [datetime] NULL ,
|
||||||
|
[cInvDefine16] [datetime] NULL ,
|
||||||
|
[iId] [int] NULL ,
|
||||||
|
[cinvccode] [nvarchar] (12) NULL ,
|
||||||
|
[cinvcname] [nvarchar] (100) NULL ,
|
||||||
|
[cBatch] [nvarchar] (60) NULL ,
|
||||||
|
[dmdate] [datetime] NULL ,
|
||||||
|
[imassunit] [smallint] NULL ,
|
||||||
|
[cmassunit] [nvarchar] (150) NULL ,
|
||||||
|
[imassdate] [int] NULL ,
|
||||||
|
[dvdate] [datetime] NULL ,
|
||||||
|
[cincode] [nvarchar] (30) NULL ,
|
||||||
|
[cVenCode] [nvarchar] (30) NULL ,
|
||||||
|
[cVenAbbName] [nvarchar] (60) NULL ,
|
||||||
|
[cWhCode] [nvarchar] (10) NULL ,
|
||||||
|
[cWhName] [nvarchar] (20) NULL ,
|
||||||
|
[cposition] [nvarchar] (30) NULL ,
|
||||||
|
[cposname] [nvarchar] (30) NULL ,
|
||||||
|
[cinvsn] [nvarchar] (150) NULL ,
|
||||||
|
[cSNDefine1] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine2] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine3] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine4] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine5] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine6] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine7] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine8] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine9] [nvarchar] (200) NULL ,
|
||||||
|
[cSNDefine10] [nvarchar] (200) NULL ,
|
||||||
|
[cSNMemo] [nvarchar] (200) NULL ,
|
||||||
|
[InOutTypeCode] [nvarchar] (20) NULL ,
|
||||||
|
[InOutType] [nvarchar] (150) NULL ,
|
||||||
|
[ccode] [nvarchar] (30) NULL ,
|
||||||
|
[ddate] [datetime] NULL ,
|
||||||
|
[cstate] [nvarchar] (150) NULL ,
|
||||||
|
[cbustype] [nvarchar] (12) NULL ,
|
||||||
|
[cbustypename] [nvarchar] (150) NULL ,
|
||||||
|
[cdepcode] [nvarchar] (12) NULL ,
|
||||||
|
[cdepname] [nvarchar] (20) NULL ,
|
||||||
|
[cpersoncode] [nvarchar] (20) NULL ,
|
||||||
|
[cpersonname] [nvarchar] (40) NULL ,
|
||||||
|
[chvencode] [nvarchar] (20) NULL ,
|
||||||
|
[chvenabbname] [nvarchar] (60) NULL ,
|
||||||
|
[ccuscode] [nvarchar] (20) NULL ,
|
||||||
|
[ccusabbname] [nvarchar] (60) NULL ,
|
||||||
|
[crdcode] [nvarchar] (5) NULL ,
|
||||||
|
[crdname] [nvarchar] (20) NULL ,
|
||||||
|
[cmaker] [nvarchar] (60) NULL ,
|
||||||
|
[chandler] [nvarchar] (60) NULL
|
||||||
|
)'
|
||||||
|
--exec (@chrSQL)
|
||||||
|
|
||||||
|
|
||||||
|
set @chrSQL =N' select r.id,convert (nvarchar(10), Null ) as cVouchType
|
||||||
|
,convert (nvarchar(255), Null ) as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,convert (nvarchar(20), Null ) as InOutTypeCode
|
||||||
|
,convert (nvarchar(150), Null ) as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,
|
||||||
|
convert (nvarchar(150), Null ) as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
into tempdb..'+@tmptableName +N'
|
||||||
|
from ST_SNDetail_QC SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords34 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord34 r on rs.id=r.id and r.cvouchtype=N''34''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''34''
|
||||||
|
where 1=0 '
|
||||||
|
|
||||||
|
exec (@chrSQL)
|
||||||
|
--期初结存
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_QC SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords34 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord34 r on rs.id=r.id and r.cvouchtype=N''34''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''34''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--期初不合格品
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.cspcode as ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.cverifyperson,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.cirdcode as crdcode,rd_style.crdname,r.cmaker,r.cverifyperson as chandler
|
||||||
|
from ST_SNDetail_QCUnQ SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join scrapvouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join scrapvouch r on rs.id=r.id and r.cvouchtype=N''55''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.cirdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''55''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--期初合格品序列号
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select rs.autoid as id,N''91'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''91'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,null as ccode,rs.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(rs.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,null as cdepcode,null as cdepname,null as cpersoncode,null as cpersonname
|
||||||
|
,rs.cbvencode as chvencode,v.cvenabbname as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,null as crdcode,null as crdname,rs.cmaker,rs.chandler
|
||||||
|
from ST_SNDetail_QCQu SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join St_QCQualifiedSNdetail rs on SN.iVouchsid=rs.autoid and rs.cvouchtype=N''SN88''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join vendor v on v.cvencode=rs.cbvencode
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--期初不合格品序列号
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select rs.autoid as id,N''92'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''92'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,null as ccode,rs.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(rs.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,null as cdepcode,null as cdepname,null as cpersoncode,null as cpersonname
|
||||||
|
,rs.cbvencode as chvencode,v.cvenabbname as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,null as crdcode,null as crdname,rs.cmaker,rs.chandler
|
||||||
|
from ST_SNDetail_QCScrap SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join St_QCQualifiedSNdetail rs on SN.iVouchsid=rs.autoid and rs.cvouchtype=N''SN89''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join vendor v on v.cvencode=rs.cbvencode
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--采购入库单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when isnull(rs.iquantity,0)<0 then N''0'' else N''1'' end as InOutTypeCode
|
||||||
|
,case when isnull(rs.iquantity,0)<0 then
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
else
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
end as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_PUIN SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords01 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord01 r on rs.id=r.id and r.cvouchtype=N''01''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''01''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--产成品入库单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when isnull(rs.iquantity,0)<0 then N''0'' else N''1'' end as InOutTypeCode
|
||||||
|
,case when isnull(rs.iquantity,0)<0 then
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
else
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
end as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_PROIN SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords10 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord10 r on rs.id=r.id and r.cvouchtype=N''10''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''10''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--其他入库单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when isnull(rs.iquantity,0)<0 then N''0'' else N''1'' end as InOutTypeCode
|
||||||
|
,case when isnull(rs.iquantity,0)<0 then
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
else
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
end as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_OtherIN SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords08 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord08 r on rs.id=r.id and r.cvouchtype=N''08''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''08''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--销售出库单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when isnull(rs.iquantity,0)>=0 then N''0'' else N''1'' end as InOutTypeCode
|
||||||
|
,case when isnull(rs.iquantity,0)>=0 then
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
else
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
end as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_SaleOut SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords32 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord32 r on rs.id=r.id and r.cvouchtype=N''32''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''32''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--材料出库单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when isnull(rs.iquantity,0)>=0 then N''0'' else N''1'' end as InOutTypeCode
|
||||||
|
,case when isnull(rs.iquantity,0)>=0 then
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
else
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'')
|
||||||
|
end as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_MaOut SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords11 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord11 r on rs.id=r.id and r.cvouchtype=N''11''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''11''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--其他出库单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when isnull(rs.iquantity,0)>=0 then N''0'' else N'''' end as InOutTypeCode
|
||||||
|
,case when isnull(rs.iquantity,0)>=0 then
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=''ST.InOutFlag'')
|
||||||
|
else
|
||||||
|
(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=''ST.InOutFlag'')
|
||||||
|
end as InOutType
|
||||||
|
,r.ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.chandler,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.crdcode,rd_style.crdname,r.cmaker,r.chandler
|
||||||
|
from ST_SNDetail_OtherOut SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join rdrecords09 rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join rdrecord09 r on rs.id=r.id and r.cvouchtype=N''09''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''09''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--调拨单
|
||||||
|
--调拨转入
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,N''12'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''12'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cinWhCode as cwhcode,W.cWhName,SN.cinposition as cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.ctvcode as ccode,r.dtvdate as ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.cverifyperson,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.cidepcode,d.cdepname
|
||||||
|
,r.cpersoncode,person.cpersonname
|
||||||
|
,null as chvencode,null as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,r.cirdcode as crdcode,rd_style.crdname,r.cmaker,r.cverifyperson as chandler
|
||||||
|
from ST_SNDetail_Tran SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join transvouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join transvouch r on rs.id=r.id
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cinposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cinwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cidepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join rd_style on r.cirdcode = rd_style.crdcode
|
||||||
|
where isnull(r.cverifyperson,'''')='''''
|
||||||
|
|
||||||
|
set @sTmpWhere = REPLACE(@sWhere,'SN.cposition','SN.cinposition')
|
||||||
|
set @sTmpWhere = REPLACE(@sWhere,'SN.cWhCode','SN.cinWhCode')
|
||||||
|
|
||||||
|
exec (@chrSQL+@sTmpWhere)
|
||||||
|
|
||||||
|
--调拨转出
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,N''12'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''12'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.coutWhCode as cwhcode,W.cWhName,SN.coutposition as cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,N''0'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.ctvcode as ccode,r.dtvdate as ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.cverifyperson,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.codepcode as cdepcode,d.cdepname
|
||||||
|
,r.cpersoncode,person.cpersonname
|
||||||
|
,null as chvencode,null as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,r.cordcode as crdcode,rd_style.crdname,r.cmaker,r.cverifyperson as chandler
|
||||||
|
from ST_SNDetail_Tran SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join transvouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join transvouch r on rs.id=r.id
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.coutposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.coutwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.codepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join rd_style on r.cordcode = rd_style.crdcode
|
||||||
|
where isnull(r.cverifyperson,'''')='''''
|
||||||
|
|
||||||
|
set @sTmpWhere = REPLACE(@sWhere,'SN.cposition','SN.coutposition')
|
||||||
|
set @sTmpWhere = REPLACE(@sWhere,'SN.cWhCode','SN.coutWhCode')
|
||||||
|
|
||||||
|
exec (@chrSQL+@sTmpWhere)
|
||||||
|
|
||||||
|
--不合格品记录单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.cspcode as ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.cverifyperson,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.cirdcode as crdcode,rd_style.crdname,r.cmaker,r.cverifyperson as chandler
|
||||||
|
from ST_SNDetail_QARecord SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join scrapvouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join scrapvouch r on rs.id=r.id and r.cvouchtype=N''45''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.cirdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''45''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--不合格品处理单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo,N''0'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.cspcode as ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.cverifyperson,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,r.cvencode as chvencode,v.cvenabbname as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
,r.cirdcode as crdcode,rd_style.crdname,r.cmaker,r.cverifyperson as chandler
|
||||||
|
from ST_SNDetail_QA SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join scrapvouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join scrapvouch r on rs.id=r.id and r.cvouchtype=N''46''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
left join vendor v on v.cvencode=r.cvencode
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.cirdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=N''46''
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
|
||||||
|
--货位调整单
|
||||||
|
--货位调整前
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,N''19'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''19'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.coutposition as cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,N''0'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''0'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.cvouchcode as ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''4'' and enumtype=N''ST.VouchState'') as cstate,null as cbustype,null as cbustypename,r.cdepcode,d.cdepname
|
||||||
|
,r.cpersoncode,person.cpersonname
|
||||||
|
,null as chvencode,null as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,null as crdcode,null as crdname,r.cmaker,null as chandler
|
||||||
|
from ST_SNDetail_InvPosAjust SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join AdjustPVouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join AdjustPVouch r on rs.id=r.id
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.coutposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
where 1=1 '
|
||||||
|
set @sTmpWhere = REPLACE(@sWhere,'SN.cposition','SN.coutposition')
|
||||||
|
exec (@chrSQL+@sTmpWhere)
|
||||||
|
|
||||||
|
--货位调整后
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,N''19'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''19'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cinposition as cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,N''1'' as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''1'' and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.cvouchcode as ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''4'' and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.cdepcode,d.cdepname
|
||||||
|
,r.cpersoncode,person.cpersonname
|
||||||
|
,null as chvencode,null as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,null as crdcode,null as crdname,r.cmaker,null as chandler
|
||||||
|
from ST_SNDetail_InvPosAjust SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join AdjustPVouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join AdjustPVouch r on rs.id=r.id
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cinposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
where 1=1 '
|
||||||
|
set @sTmpWhere = REPLACE(@sWhere,'SN.cposition','SN.cinposition')
|
||||||
|
exec (@chrSQL+@sTmpWhere)
|
||||||
|
|
||||||
|
--序列号调整
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.id,N''SN10'' as cVouchType
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''SN10'' and enumtype=N''ST.VouchType'') as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition as cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,case when bpresn =1 then
|
||||||
|
case when ipostinvsnstate =''2'' or ipostinvsnstate=''6'' then N''1''
|
||||||
|
when ipostinvsnstate=''10'' then '''' else ''0'' end
|
||||||
|
else
|
||||||
|
case when ipreinvsnstate =''2'' or ipreinvsnstate=''6'' then N''1''
|
||||||
|
when ipreinvsnstate=''10'' then '''' else ''0'' end
|
||||||
|
end
|
||||||
|
as InOutTypeCode
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=(case when bpresn =1 then
|
||||||
|
case when ipostinvsnstate =''2'' or ipostinvsnstate=''6'' then N''1''
|
||||||
|
when isnpoststate=''10'' then '''' else ''0'' end
|
||||||
|
else
|
||||||
|
case when ipreinvsnstate =''2'' or ipreinvsnstate=''6'' then N''1''
|
||||||
|
when ipreinvsnstate=''10'' then '''' else ''0'' end
|
||||||
|
end ) and enumtype=N''ST.InOutFlag'') as InOutType
|
||||||
|
,r.ccode as ccode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=N''4'' and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,null as cbustype,null as cbustypename,r.cdepcode,d.cdepname
|
||||||
|
,r.cpersoncode,person.cpersonname
|
||||||
|
,null as chvencode,null as chvenabbname,null as ccuscode,null as ccusabbname
|
||||||
|
,null as crdcode,null as crdname,r.cmaker,null as chandler
|
||||||
|
from v_ST_SNDetail_SNAdjVouch SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join ST_SNAdjustVouchs rs on SN.iVouchsid=rs.autoid
|
||||||
|
left join ST_SNAdjustVouch r on rs.id=r.id
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
where 1=1 '
|
||||||
|
--set @sTmpWhere = REPLACE(@sWhere,'SN.cposition','SN.cinposition')
|
||||||
|
exec (@chrSQL+@sTmpWhere)
|
||||||
|
|
||||||
|
--销售发货单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.dlid,r.cVouchType
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,vendor.cVenAbbName,SN.cWhCode,W.cWhName,SN.cposition,p.cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,NULL as InOutTypeCode
|
||||||
|
,NULL AS InOutType
|
||||||
|
,r.cdlcode,r.ddate
|
||||||
|
,(select top 1 EnumName from v_aa_enum where enumcode=
|
||||||
|
(case when isnull(r.cverifier,'''')='''' then N''4'' else N''1'' end) and enumtype=N''ST.VouchState'') as cstate
|
||||||
|
,r.cbustype,enum1.enumname as cbustypename,r.cdepcode,d.cdepname,r.cpersoncode,person.cpersonname
|
||||||
|
,Null as chvencode,Null as chvenabbname,r.ccuscode,customer.ccusabbname
|
||||||
|
, r.crdcode,rd_style.crdname,r.cmaker,r.cverifier
|
||||||
|
from SA_SNDetail_Disp SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join dispatchlists rs on SN.idlsid=rs.idlsid
|
||||||
|
left join dispatchlist r on rs.dlid=r.dlid
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
left join position p on SN.cposition=p.cposcode
|
||||||
|
left join vendor on SN.cvencode=vendor.cvencode
|
||||||
|
inner join warehouse w on SN.cwhcode=w.cwhcode
|
||||||
|
left join department d on d.cdepcode=r.cdepcode
|
||||||
|
left join person on person.cpersoncode=r.cpersoncode
|
||||||
|
|
||||||
|
left join customer on r.ccuscode = customer.ccuscode
|
||||||
|
left join rd_style on r.crdcode = rd_style.crdcode
|
||||||
|
left join v_aa_enum enum1 on enum1.enumtype=N''ST.BusType'' and enum1.enumcode=r.cbustype
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.VouchType'' and enum3.enumcode=isnull(r.cvouchtype,N''05'')
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
--升产订单
|
||||||
|
set @chrSQL =N'insert into tempdb..'+@tmptableName +N' select r.moid,''MO''
|
||||||
|
,enum3.enumname as VouchType
|
||||||
|
,SN.cInvCode,I.cInvName,I.cInvAddCode,I.cInvStd,i.ccomunitcode,computationunit.ccomunitname as cinvm_unit
|
||||||
|
,SN.cFree1,SN.cFree2,SN.cFree3,SN.cFree4,SN.cFree5,SN.cFree6,SN.cFree7,SN.cFree8,SN.cFree9,SN.cFree10
|
||||||
|
,I.cInvDefine1,I.cInvDefine2,I.cInvDefine3,I.cInvDefine4,I.cInvDefine5,I.cInvDefine6,I.cInvDefine7,I.cInvDefine8
|
||||||
|
,I.cInvDefine9,I.cInvDefine10,I.cInvDefine11,I.cInvDefine12,I.cInvDefine13,I.cInvDefine14,I.cInvDefine15
|
||||||
|
,I.cInvDefine16,I.iId,IC.cinvccode,IC.cinvcname,SN.cBatch,SN.dmdate,SN.imassunit,enum2.enumname as cmassunit
|
||||||
|
,sn.imassdate,SN.dvdate,SN.cincode,SN.cVenCode,Null as cVenAbbName,Null as cWhCode,NUll as cWhName,SN.cposition,Null as cposname
|
||||||
|
,SN.cinvsn,SN.cSNDefine1,SN.cSNDefine2,SN.cSNDefine3,SN.cSNDefine4,SN.cSNDefine5,SN.cSNDefine6,SN.cSNDefine7
|
||||||
|
,SN.cSNDefine8,SN.cSNDefine9,SN.cSNDefine10,SN.cSNMemo
|
||||||
|
,NULL as InOutTypeCode
|
||||||
|
,NULL AS InOutType
|
||||||
|
,r.mocode,r.CreateDate
|
||||||
|
,NUll as cstate
|
||||||
|
,Null as cbustype,Null cbustypename,dp.cdepcode,dp.cdepname,Null as cpersoncode,Null as cpersonname
|
||||||
|
,Null as chvencode,Null as chvenabbname,Null ccuscode,Null ccusabbname
|
||||||
|
, Null crdcode,Null as crdname,us.cUser_Name as cmaker,Null as cverifier
|
||||||
|
from mom_sndetail SN
|
||||||
|
inner join Inventory I on SN.cInvCode = I.cInvCode
|
||||||
|
inner join computationunit on I.ccomunitcode = computationunit.ccomunitcode
|
||||||
|
inner join inventoryclass IC on I.cinvccode=IC.cinvccode
|
||||||
|
left join mom_orderdetail rs on SN.ivouchsid=rs.modid
|
||||||
|
left join mom_order r on rs.moid=r.moid
|
||||||
|
left join ufsystem..ua_user us on us.cUser_Id =r.CreateUser
|
||||||
|
left join department dp on rs.MDeptCode=dp.cdepcode
|
||||||
|
left join v_aa_enum enum3 on enum3.enumtype=N''ST.Sotype'' and enum3.enumcode=''7''
|
||||||
|
left join v_aa_enum enum2 on enum2.enumtype=N''ST.MassUnit'' and enum2.enumcode=sn.imassunit
|
||||||
|
where 1=1 '
|
||||||
|
exec (@chrSQL+@sWhere)
|
||||||
|
--isnpoststate ,bpresn
|
||||||
|
|
||||||
|
select InOutType,tb.cinvsn SN,COUNT(0) [COUNT] From tempdb..SP_ST_SNLSZ20210615 tb WHERE tb.cinvsn in (@SN) AND InOutType IS NOT NULL GROUP BY InOutType,tb.cinvsn ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace NX.ERP.U8.Finance
|
|||||||
{
|
{
|
||||||
string sql = $@"
|
string sql = $@"
|
||||||
select a.cInvCode,e.cInvName,b.cCode as Cprk, b.dDate as rkrq,c.cWhName,
|
select a.cInvCode,e.cInvName,b.cCode as Cprk, b.dDate as rkrq,c.cWhName,
|
||||||
b.cMPoCode,d.cDepName,a.cInvSN,k.iUnitCost,
|
b.cMPoCode,d.cDepName,a.cInvSN,a.csnmemo,k.iUnitCost,
|
||||||
g.cCode as Clck,g.dDate as ckrq,h.cCusAbbName,f.cInvSN as ckcInvSN
|
g.cCode as Clck,g.dDate as ckrq,h.cCusAbbName,f.cInvSN as ckcInvSN
|
||||||
from ST_SNDetail_PROIN a WITH(NOLOCK)
|
from ST_SNDetail_PROIN a WITH(NOLOCK)
|
||||||
left join rdrecord10 b WITH(NOLOCK) on a.iVouchID=b.id
|
left join rdrecord10 b WITH(NOLOCK) on a.iVouchID=b.id
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Rem
|
|||||||
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
|
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
|
||||||
left JOIN
|
left JOIN
|
||||||
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
|
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
|
||||||
INNER JOIN
|
left JOIN
|
||||||
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
|
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
|
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
|
||||||
@@ -199,12 +199,14 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Rem
|
|||||||
WHERE md.Status = 3
|
WHERE md.Status = 3
|
||||||
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
|
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
|
||||||
|
|
||||||
|
(select a.MoCode ,a.InvCode ,a.MoDId ,(a.dtty/b.Qty) as dtty from (
|
||||||
(SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0))/md.Qty,3) dtty
|
SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0)),3) dtty, md.MoDId
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
|
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
|
||||||
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
||||||
GROUP BY ma.InvCode,mom.MoCode,md.Qty ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
|
|
||||||
|
GROUP BY ma.InvCode,mom.MoCode, md.MoDId ) a left join mom_orderdetail b WITH (NOLOCK) ON a.MoDId = b.MoDId ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode and md.MoDId= dtyl.MoDId
|
||||||
|
LEFT JOIN
|
||||||
|
|
||||||
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
|
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
@@ -288,7 +290,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate,md.Rema
|
|||||||
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
|
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
|
||||||
left JOIN
|
left JOIN
|
||||||
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
|
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
|
||||||
INNER JOIN
|
left JOIN
|
||||||
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
|
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
|
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
|
||||||
@@ -321,11 +323,14 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate,md.Rema
|
|||||||
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
|
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
|
||||||
|
|
||||||
|
|
||||||
(SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0))/md.Qty,3) dtty
|
(select a.MoCode ,a.InvCode ,a.MoDId ,(a.dtty/b.Qty) as dtty from (
|
||||||
|
SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0)),3) dtty, md.MoDId
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
|
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
|
||||||
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
||||||
GROUP BY ma.InvCode,mom.MoCode,md.Qty ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
|
|
||||||
|
GROUP BY ma.InvCode,mom.MoCode, md.MoDId ) a left join mom_orderdetail b WITH (NOLOCK) ON a.MoDId = b.MoDId ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode and md.MoDId= dtyl.MoDId
|
||||||
|
LEFT JOIN
|
||||||
|
|
||||||
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
|
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace NX.ERP.U8.Purchase
|
|||||||
(SELECT iAppIds, sum(iquantity) AS qty
|
(SELECT iAppIds, sum(iquantity) AS qty
|
||||||
FROM PO_Podetails WITH (nolock)
|
FROM PO_Podetails WITH (nolock)
|
||||||
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
|
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
|
||||||
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 and
|
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(omm.cverifier, N'') <> N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 and
|
||||||
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
|
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
|
||||||
GROUP BY cInvCode
|
GROUP BY cInvCode
|
||||||
) as tbl1
|
) as tbl1
|
||||||
@@ -273,9 +273,13 @@ namespace NX.ERP.U8.Purchase
|
|||||||
as tbl on tbl1.cinvcode=tbl.cInvCode
|
as tbl on tbl1.cinvcode=tbl.cInvCode
|
||||||
) q group by cPsn_Num
|
) q group by cPsn_Num
|
||||||
|
|
||||||
update a set a.puappnumall=b.puappnumall From @RdRecord a left join @RdRecord2 b on a.cpersonname =b.cpersonname
|
update a set a.cpersonname=b.receive From @RdRecord2 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||||
|
where b.quit is not null
|
||||||
|
|
||||||
update a set a.puappnumall= a.puappnumall +b.puappnumall From @RdRecord a left join (
|
update a set a.puappnumall=isnull(b.puappnumall,0) From @RdRecord a left join
|
||||||
|
(select cpersonname,sum(puappnumall) as puappnumall from @RdRecord2 group by cpersonname ) b on a.cpersonname =b.cpersonname
|
||||||
|
|
||||||
|
update a set a.puappnumall= isnull(a.puappnumall,0) +isnull(b.puappnumall,0) From @RdRecord a left join (
|
||||||
select '其他' as cpersonname ,sum(puappnumall) as puappnumall from @RdRecord2 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
select '其他' as cpersonname ,sum(puappnumall) as puappnumall from @RdRecord2 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||||
where a.cpersonname='其他'
|
where a.cpersonname='其他'
|
||||||
|
|
||||||
@@ -291,7 +295,7 @@ namespace NX.ERP.U8.Purchase
|
|||||||
(SELECT iAppIds, sum(iquantity) AS qty
|
(SELECT iAppIds, sum(iquantity) AS qty
|
||||||
FROM PO_Podetails WITH (nolock)
|
FROM PO_Podetails WITH (nolock)
|
||||||
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
|
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
|
||||||
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 and DATEDIFF(day,ddate ,GETDATE()) >=3 and
|
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(omm.cverifier, N'') <> N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 and DATEDIFF(day,ddate ,GETDATE()) >=3 and
|
||||||
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
|
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
|
||||||
GROUP BY cInvCode
|
GROUP BY cInvCode
|
||||||
) as tbl1
|
) as tbl1
|
||||||
@@ -305,9 +309,13 @@ namespace NX.ERP.U8.Purchase
|
|||||||
as tbl on tbl1.cinvcode=tbl.cInvCode
|
as tbl on tbl1.cinvcode=tbl.cInvCode
|
||||||
) q group by cPsn_Num
|
) q group by cPsn_Num
|
||||||
|
|
||||||
update a set a.puappnum03=b.puappnumall From @RdRecord a left join @RdRecord3 b on a.cpersonname =b.cpersonname
|
update a set a.cpersonname=b.receive From @RdRecord3 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||||
|
where b.quit is not null
|
||||||
|
|
||||||
update a set a.puappnum03= a.puappnum03 +b.puappnumall From @RdRecord a left join (
|
update a set a.puappnum03=isnull(b.puappnumall,0) From @RdRecord a left join
|
||||||
|
(select cpersonname,sum(puappnumall) as puappnumall from @RdRecord3 group by cpersonname) b on a.cpersonname =b.cpersonname
|
||||||
|
|
||||||
|
update a set a.puappnum03= isnull(a.puappnum03,0) +isnull(b.puappnumall,0) From @RdRecord a left join (
|
||||||
select '其他' as cpersonname ,sum(puappnumall) as puappnumall from @RdRecord3 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
select '其他' as cpersonname ,sum(puappnumall) as puappnumall from @RdRecord3 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||||
where a.cpersonname='其他'
|
where a.cpersonname='其他'
|
||||||
|
|
||||||
@@ -342,10 +350,14 @@ namespace NX.ERP.U8.Purchase
|
|||||||
as tbl on tbl1.cinvcode=tbl.cInvCode )
|
as tbl on tbl1.cinvcode=tbl.cInvCode )
|
||||||
q group by cPsn_Num
|
q group by cPsn_Num
|
||||||
|
|
||||||
|
update a set a.cpersonname=b.receive From @RdRecord4 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||||
|
where b.quit is not null
|
||||||
|
|
||||||
update a set a.mommouth02=b.puappnumall From @RdRecord a left join @RdRecord4 b on a.cpersonname =b.cpersonname
|
update a set a.mommouth02=isnull(b.puappnumall,0) From @RdRecord a left join
|
||||||
|
(select cpersonname,sum(puappnumall) as puappnumall from @RdRecord4 group by cpersonname
|
||||||
|
) b on a.cpersonname =b.cpersonname
|
||||||
|
|
||||||
update a set a.mommouth02= a.mommouth02 +b.mommouth02 From @RdRecord a left join (
|
update a set a.mommouth02= isnull(a.mommouth02,0) +isnull(b.mommouth02,0) From @RdRecord a left join (
|
||||||
select '其他' as cpersonname ,sum(puappnumall) as mommouth02 from @RdRecord4 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
select '其他' as cpersonname ,sum(puappnumall) as mommouth02 from @RdRecord4 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||||
where a.cpersonname='其他'
|
where a.cpersonname='其他'
|
||||||
|
|
||||||
@@ -379,21 +391,27 @@ namespace NX.ERP.U8.Purchase
|
|||||||
as tbl on tbl1.cinvcode=tbl.cInvCode )
|
as tbl on tbl1.cinvcode=tbl.cInvCode )
|
||||||
q group by cPsn_Num
|
q group by cPsn_Num
|
||||||
|
|
||||||
|
update a set a.cpersonname=b.receive From @RdRecord5 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||||
|
where b.quit is not null
|
||||||
|
|
||||||
|
|
||||||
|
update a set a.mommouth04=isnull(b.puappnumall,0) From @RdRecord a left join (
|
||||||
|
select cpersonname,sum(puappnumall) as puappnumall from @RdRecord5 group by cpersonname) b on a.cpersonname =b.cpersonname
|
||||||
|
|
||||||
update a set a.mommouth04=b.puappnumall From @RdRecord a left join @RdRecord5 b on a.cpersonname =b.cpersonname
|
update a set a.mommouth04= isnull(a.mommouth04,0) +isnull(b.mommouth04,0) From @RdRecord a left join (
|
||||||
|
|
||||||
update a set a.mommouth04= a.mommouth04 +b.mommouth04 From @RdRecord a left join (
|
|
||||||
select '其他' as cpersonname ,sum(puappnumall) as mommouth04 from @RdRecord5 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
select '其他' as cpersonname ,sum(puappnumall) as mommouth04 from @RdRecord5 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||||
where a.cpersonname='其他'
|
where a.cpersonname='其他'
|
||||||
|
|
||||||
|
|
||||||
|
delete from @RdRecord where cpersonname in (select quit from CGBB2021_0001_E001)
|
||||||
|
|
||||||
|
|
||||||
select *from @RdRecord
|
select *from @RdRecord
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
@@ -407,8 +425,24 @@ namespace NX.ERP.U8.Purchase
|
|||||||
public IEnumerable<object> Purchasesumpuapp(NX.ERP.Model.Request.PurchasesumRequest info)
|
public IEnumerable<object> Purchasesumpuapp(NX.ERP.Model.Request.PurchasesumRequest info)
|
||||||
{
|
{
|
||||||
string sql = $@"
|
string sql = $@"
|
||||||
|
IF EXISTS (SELECT NAME FROM tempdb..SYSOBJECTS WHERE NAME ='tablepuapp20210625' AND Xtype='U') DROP Table tempdb..tablepuapp20210625
|
||||||
|
create table tempdb..tablepuapp20210625 (
|
||||||
|
ccode nvarchar(200),
|
||||||
|
dDatel nvarchar(200),
|
||||||
|
ddate datetime,
|
||||||
|
cInvCode nvarchar(200),
|
||||||
|
cinvname nvarchar(500),
|
||||||
|
cinvstd nvarchar(500),
|
||||||
|
RQTY decimal(28, 6),
|
||||||
|
cMaker nvarchar(200)
|
||||||
|
)
|
||||||
|
CREATE INDEX IX_test ON tempdb..tablepuapp20210625 (cinvcode)
|
||||||
|
|
||||||
|
|
||||||
|
insert into tempdb..tablepuapp20210625
|
||||||
|
|
||||||
select *from (
|
select *from (
|
||||||
SELECT omm.ccode, CONVERT(varchar(100), omm.ddate, 23) as dDatel, omm.ddate ,ommds.cInvCode,ommds.cinvname, ommds.cinvstd,ommds.fquantity - ISNULL(rds.qty, 0) as RQTY,isnull(f.cMaker,'其他') as cMaker
|
SELECT omm.ccode, CONVERT(varchar(100), omm.ddate, 23) as dDatel, omm.ddate ,ommds.cInvCode,ommds.cinvname, ommds.cinvstd,ommds.fquantity - ISNULL(rds.qty, 0) as RQTY,isnull(isnull(k.receive ,f.cMaker),'其他') as cMaker
|
||||||
FROM pu_AppHead omm WITH (nolock) INNER JOIN
|
FROM pu_AppHead omm WITH (nolock) INNER JOIN
|
||||||
pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN
|
pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN
|
||||||
(SELECT iAppIds, sum(iquantity) AS qty
|
(SELECT iAppIds, sum(iquantity) AS qty
|
||||||
@@ -417,8 +451,15 @@ namespace NX.ERP.U8.Purchase
|
|||||||
left join
|
left join
|
||||||
(select cInvCode,cMaker from ( select cInvCode,ROW_NUMBER() over( partition by b.cInvCode order by a.poid desc) as rownumber ,a.cMaker from PO_Pomain a WITH (nolock), PO_Podetails b WITH (nolock) where a.poid=b.poid)
|
(select cInvCode,cMaker from ( select cInvCode,ROW_NUMBER() over( partition by b.cInvCode order by a.poid desc) as rownumber ,a.cMaker from PO_Pomain a WITH (nolock), PO_Podetails b WITH (nolock) where a.poid=b.poid)
|
||||||
as c where c.rownumber=1) f on ommds.cInvCode =f.cInvCode
|
as c where c.rownumber=1) f on ommds.cInvCode =f.cInvCode
|
||||||
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 AND
|
left join CGBB2021_0001_E001 k WITH (NOLOCK) on f.cMaker =k.quit
|
||||||
ommds.fquantity - ISNULL(rds.qty, 0) > 0 ) puu
|
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(omm.cverifier, N'') <> N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 AND
|
||||||
|
ommds.fquantity - ISNULL(rds.qty, 0) > 0 ) puapp
|
||||||
|
|
||||||
|
update tempdb..tablepuapp20210625 set cmaker='其他' where cMaker not in ( select cPsn_Name from hr_v_HR31_show WITH (NOLOCK) where cDepCode ='52' and rEmployState ='在职')
|
||||||
|
and cMaker not in (select quit from CGBB2021_0001_E001 WITH (NOLOCK))
|
||||||
|
|
||||||
|
|
||||||
|
select *From tempdb..tablepuapp20210625 puu
|
||||||
";
|
";
|
||||||
|
|
||||||
List<string> where = new List<string>();
|
List<string> where = new List<string>();
|
||||||
@@ -453,7 +494,8 @@ namespace NX.ERP.U8.Purchase
|
|||||||
public IEnumerable<object> Purchasesummom(NX.ERP.Model.Request.PurchasesumRequest info)
|
public IEnumerable<object> Purchasesummom(NX.ERP.Model.Request.PurchasesumRequest info)
|
||||||
{
|
{
|
||||||
string sql = $@"
|
string sql = $@"
|
||||||
DECLARE @RdRecord table(
|
IF EXISTS (SELECT NAME FROM tempdb..SYSOBJECTS WHERE NAME ='tablemom20210625' AND Xtype='U') DROP Table tempdb..tablemom20210625
|
||||||
|
create table tempdb..tablemom20210625 (
|
||||||
CINVCODE nvarchar(200),
|
CINVCODE nvarchar(200),
|
||||||
RQTY int,
|
RQTY int,
|
||||||
iqty int,
|
iqty int,
|
||||||
@@ -463,9 +505,11 @@ namespace NX.ERP.U8.Purchase
|
|||||||
cInvName nvarchar(200),
|
cInvName nvarchar(200),
|
||||||
cInvStd nvarchar(500)
|
cInvStd nvarchar(500)
|
||||||
)
|
)
|
||||||
insert into @RdRecord
|
|
||||||
|
|
||||||
|
insert into tempdb..tablemom20210625
|
||||||
select *from (
|
select *from (
|
||||||
select a.*,isnull(f.cMaker,'其他') as cpersonname ,inv.cInvName,inv.cInvStd from (
|
select a.*,isnull(isnull(k.receive ,f.cMaker),'其他') as cpersonname ,inv.cInvName,inv.cInvStd from (
|
||||||
select a.InvCode as CINVCODE ,1 as RQTY , iqty,cur.iQuantity, (cur.iQuantity-iqty) as bull From (
|
select a.InvCode as CINVCODE ,1 as RQTY , iqty,cur.iQuantity, (cur.iQuantity-iqty) as bull From (
|
||||||
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
|
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
|
||||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||||
@@ -480,12 +524,14 @@ namespace NX.ERP.U8.Purchase
|
|||||||
) a left join
|
) a left join
|
||||||
(select cInvCode,cMaker from ( select cInvCode,ROW_NUMBER() over( partition by b.cInvCode order by a.poid desc) as rownumber ,a.cMaker from PO_Pomain a WITH (NOLOCK), PO_Podetails b WITH (NOLOCK) where a.poid=b.poid)
|
(select cInvCode,cMaker from ( select cInvCode,ROW_NUMBER() over( partition by b.cInvCode order by a.poid desc) as rownumber ,a.cMaker from PO_Pomain a WITH (NOLOCK), PO_Podetails b WITH (NOLOCK) where a.poid=b.poid)
|
||||||
as c where c.rownumber=1) f on a.CINVCODE=f.cInvCode
|
as c where c.rownumber=1) f on a.CINVCODE=f.cInvCode
|
||||||
|
left join CGBB2021_0001_E001 k WITH (NOLOCK) on f.cMaker =k.quit
|
||||||
left join Inventory inv WITH (NOLOCK) on a.CINVCODE=inv.cInvCode )pumo
|
left join Inventory inv WITH (NOLOCK) on a.CINVCODE=inv.cInvCode )pumo
|
||||||
|
|
||||||
update @RdRecord set cpersonname ='其他' where cpersonname not in ( select cPsn_Name from hr_v_HR31_show where cDepCode ='52' and rEmployState ='在职')
|
update tempdb..tablemom20210625 set cpersonname ='其他' where cpersonname not in ( select cPsn_Name from hr_v_HR31_show WITH (NOLOCK) where cDepCode ='52' and rEmployState ='在职')
|
||||||
|
and cpersonname not in (select quit from CGBB2021_0001_E001 WITH (NOLOCK))
|
||||||
|
|
||||||
|
|
||||||
select *From @RdRecord
|
select *From tempdb..tablemom20210625
|
||||||
";
|
";
|
||||||
|
|
||||||
List<string> where = new List<string>();
|
List<string> where = new List<string>();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.c
|
|||||||
, PO_Podetails C WITH (NOLOCK)
|
, PO_Podetails C WITH (NOLOCK)
|
||||||
|
|
||||||
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') -- and ( 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,''))
|
||||||
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 (1=1) and isnull(b.cbcloser,N'')=N'' 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 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
|
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
[Route("api/MaterialApp/Model")]
|
[Route("api/MaterialApp/Model")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|
||||||
@@ -45,6 +45,15 @@ namespace NX.ERP.WebAPi.Controllers.Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Route("api/MaterialApp/ListAndPost")]
|
||||||
|
[HttpPost]
|
||||||
|
public IEnumerable<Model.Response.Store.MaterialAppVouchAndPostName> GetModelAndPost(Model.Response.Store.MaterialAppVouchAndPostName req)
|
||||||
|
{
|
||||||
|
var dal = new NX.ERP.U8.Store.MaterialAppDAL();
|
||||||
|
return dal.GetModelAndPost(req.AppVouchOrderNo, req.MaterialCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
[Route("api/MaterialApp/ListByMoCode")]
|
[Route("api/MaterialApp/ListByMoCode")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="ApiDbName" value="MES_SUBMIT" />
|
<add key="ApiDbName" value="MES_SUBMIT" />
|
||||||
<add key="server" value="10.0.0.12" />
|
<add key="server" value="10.0.0.250" />
|
||||||
<add key="AccId" value="u8-2@001" />
|
<add key="AccId" value="u8@001" />
|
||||||
<add key="UserId" value="wx994" />
|
<add key="UserId" value="wx997" />
|
||||||
<add key="Password" value="1" />
|
<add key="Password" value="1" />
|
||||||
<add key="EaiPort" value="80" />
|
<add key="EaiPort" value="80" />
|
||||||
<add key="EaiPath" value="U8EAI/import.asp" />
|
<add key="EaiPath" value="U8EAI/import.asp" />
|
||||||
|
|||||||
36
NX.ERP.Webapp/package-lock.json
generated
36
NX.ERP.Webapp/package-lock.json
generated
@@ -11710,9 +11710,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vue-loader-v16": {
|
"vue-loader-v16": {
|
||||||
"version": "npm:vue-loader@16.2.0",
|
"version": "npm:vue-loader@16.4.0",
|
||||||
"resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.4.0.tgz",
|
||||||
"integrity": "sha1-BGpTMI3Ufljv4g3ewe3sAnzjtG4=",
|
"integrity": "sha512-oySoEgEedGw0jz2czEOdb6sycQ2PPyzUmF8Yclj1NTpoTVHGCYCQaGf+jsvxhdDVfhOnDLjkRzT2fLpGOrVPjg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -11723,8 +11723,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-styles": {
|
"ansi-styles": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz?cache=0&sync_timestamp=1618995625950&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fansi-styles%2Fdownload%2Fansi-styles-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -11732,9 +11732,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chalk": {
|
"chalk": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.1.tgz?cache=0&sync_timestamp=1618995297666&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
"integrity": "sha1-yAs/qyi/Y3HmhjMl7uZ+YYt35q0=",
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -11744,8 +11744,8 @@
|
|||||||
},
|
},
|
||||||
"color-convert": {
|
"color-convert": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -11754,22 +11754,22 @@
|
|||||||
},
|
},
|
||||||
"color-name": {
|
"color-name": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"has-flag": {
|
"has-flag": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz?cache=0&sync_timestamp=1618847009337&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"loader-utils": {
|
"loader-utils": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
|
||||||
"integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
|
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -11780,8 +11780,8 @@
|
|||||||
},
|
},
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
"version": "7.2.0",
|
"version": "7.2.0",
|
||||||
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1618560998281&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<MenuGroup title="单据">
|
<MenuGroup title="单据">
|
||||||
<MenuItem to="/inventoryrrival" name="4-2">到货单</MenuItem>
|
<MenuItem to="/inventoryrrival" name="4-2">到货单</MenuItem>
|
||||||
<MenuItem to="/inventoryerror" name="4-3">异常单据查询</MenuItem>
|
<MenuItem to="/inventoryerror" name="4-3">异常单据查询</MenuItem>
|
||||||
|
<MenuItem to="/inventoryMaterialAppVouch" name="4-4">领料单查询</MenuItem>
|
||||||
</MenuGroup>
|
</MenuGroup>
|
||||||
</Submenu>
|
</Submenu>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
6
NX.ERP.Webapp/src/api/materialAppVouch.js
Normal file
6
NX.ERP.Webapp/src/api/materialAppVouch.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
//查询领料列表带库位
|
||||||
|
export const getListAndPost = (info) => {
|
||||||
|
return axios.post('/api/MaterialApp/ListAndPost', info)
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import inventorypoc from '@/views/inventory-poc.vue'
|
|||||||
import Purchasesum from '@/views/Purchasesum.vue'
|
import Purchasesum from '@/views/Purchasesum.vue'
|
||||||
import inventoryrrival from '@/bill/inventory-arrival.vue'
|
import inventoryrrival from '@/bill/inventory-arrival.vue'
|
||||||
import inventoryerror from '@/bill/inventory-error.vue'
|
import inventoryerror from '@/bill/inventory-error.vue'
|
||||||
|
import inventoryMaterialAppVouch from '@/views/inventory-materialAppVouch.vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@@ -29,4 +30,5 @@ export default [
|
|||||||
{ path: '/Purchasesum', component: Purchasesum },
|
{ path: '/Purchasesum', component: Purchasesum },
|
||||||
{ path: '/inventoryrrival', component: inventoryrrival },
|
{ path: '/inventoryrrival', component: inventoryrrival },
|
||||||
{ path: '/inventoryerror', component: inventoryerror },
|
{ path: '/inventoryerror', component: inventoryerror },
|
||||||
|
{ path: '/inventoryMaterialAppVouch', component: inventoryMaterialAppVouch },
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -170,6 +170,11 @@ export default {
|
|||||||
align: "center",
|
align: "center",
|
||||||
key: "iUnitCost",
|
key: "iUnitCost",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "备注",
|
||||||
|
align: "center",
|
||||||
|
key: "csnmemo",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "出库库单号",
|
title: "出库库单号",
|
||||||
align: "center",
|
align: "center",
|
||||||
|
|||||||
485
NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue
Normal file
485
NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue
Normal file
@@ -0,0 +1,485 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h4>领料单</h4>
|
||||||
|
<div>
|
||||||
|
<Row :gutter="16">
|
||||||
|
<Col span="4">
|
||||||
|
<label>领料单号</label>
|
||||||
|
<Input autosize type="textarea" v-model="filter.app_vouch_order_no" />
|
||||||
|
</Col>
|
||||||
|
<Col span="4">
|
||||||
|
<label>物料编号</label>
|
||||||
|
<Input v-model="filter.material_code" />
|
||||||
|
</Col>
|
||||||
|
<Col span="6">
|
||||||
|
<Button
|
||||||
|
size="large"
|
||||||
|
type="primary"
|
||||||
|
icon="ios-search"
|
||||||
|
@click="handleClick"
|
||||||
|
>查询</Button
|
||||||
|
>
|
||||||
|
<Button size="large" type="success" @click="handelExport"
|
||||||
|
>导出</Button
|
||||||
|
>
|
||||||
|
<Button size="large" type="info" @click="print"
|
||||||
|
>打印</Button
|
||||||
|
>
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
<div id="tb">
|
||||||
|
<Table
|
||||||
|
style="margin-top: 20px"
|
||||||
|
:loading="loading"
|
||||||
|
size="small"
|
||||||
|
border
|
||||||
|
:columns="columnsMaterialAppVouch"
|
||||||
|
:data="pagedData"
|
||||||
|
>
|
||||||
|
</Table>
|
||||||
|
</div>
|
||||||
|
<Page
|
||||||
|
style="margin-top: 20px"
|
||||||
|
:current="pageNo"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="total"
|
||||||
|
:page-size-opts="PageSizeOpts"
|
||||||
|
@on-change="handlePagechange"
|
||||||
|
@on-page-size-change="handlePageSize"
|
||||||
|
show-elevator
|
||||||
|
show-sizer
|
||||||
|
show-total
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Modal width="1366" v-model="modal1" title="单据详情" @on-cancel="cancel">
|
||||||
|
<Button size="large" type="primary" @click="print">打印</Button>
|
||||||
|
<div id="tb2">
|
||||||
|
<div>
|
||||||
|
<Row :gutter="16">
|
||||||
|
<Col span="7">
|
||||||
|
<label></label>
|
||||||
|
</Col>
|
||||||
|
<Col span="6">
|
||||||
|
<h1>采购到货单</h1>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Row :gutter="16">
|
||||||
|
<Col span="8">
|
||||||
|
{{"领料单号:"+this.ccode}}
|
||||||
|
</Col>
|
||||||
|
<Col span="6">
|
||||||
|
{{"领料时间:"+this.ArrivalDate}}
|
||||||
|
</Col>
|
||||||
|
<Col span="4">
|
||||||
|
{{"业务员:"+this.cpersonname}}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
<Table
|
||||||
|
style="margin-top: 20px"
|
||||||
|
height="700"
|
||||||
|
size="small"
|
||||||
|
border
|
||||||
|
:columns="columns2"
|
||||||
|
:data="datas2"
|
||||||
|
>
|
||||||
|
</Table>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//import vUpLoad from "@/bill/PrintView";
|
||||||
|
import { pageingData, export_col_to_excel, sortByKey } from "@/libs/tools";
|
||||||
|
import {getListAndPost} from "../api/materialAppVouch";
|
||||||
|
export default {
|
||||||
|
//components:{vUpLoad},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
PageSizeOpts: [10, 15, 20, 30],
|
||||||
|
pageNo: 1,
|
||||||
|
modal1: false,
|
||||||
|
printing: false,
|
||||||
|
strfilter: "",
|
||||||
|
multiple: false,
|
||||||
|
pageSize: 15,
|
||||||
|
datas: [],
|
||||||
|
ccode:"",
|
||||||
|
ArrivalDate:"",
|
||||||
|
cpersonname:"",
|
||||||
|
datas2: [],
|
||||||
|
filter: {
|
||||||
|
app_vouch_order_no: "",
|
||||||
|
material_code: "",
|
||||||
|
},
|
||||||
|
dom: "",
|
||||||
|
ranges: [
|
||||||
|
{
|
||||||
|
type: "price",
|
||||||
|
ccode: "",
|
||||||
|
// low: "", //区间的最小值
|
||||||
|
// height: "", //区间的最大值
|
||||||
|
},
|
||||||
|
],
|
||||||
|
columnsMaterialAppVouch: [
|
||||||
|
// {
|
||||||
|
// type: "index",
|
||||||
|
// title: "序号",
|
||||||
|
// width: 60,
|
||||||
|
// align: "center",
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: "存货编码",
|
||||||
|
align: "center",
|
||||||
|
key: "material_code",
|
||||||
|
width: 110,
|
||||||
|
className: "demo-table-info-new",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "存货名称",
|
||||||
|
align: "center",
|
||||||
|
key: "material_name",
|
||||||
|
width: 130,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "规格型号",
|
||||||
|
align: "center",
|
||||||
|
key: "material_spec",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "单位",
|
||||||
|
align: "center",
|
||||||
|
key: "unit",
|
||||||
|
width: 80,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "数量",
|
||||||
|
align: "center",
|
||||||
|
key: "qty",
|
||||||
|
width: 80,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "现存库位",
|
||||||
|
key: "position",
|
||||||
|
width: 160,
|
||||||
|
align: "left",
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "需求日期",
|
||||||
|
align: "center",
|
||||||
|
key: "demand_date",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "仓库",
|
||||||
|
align: "center",
|
||||||
|
key: "warehouse_name",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "领料单号",
|
||||||
|
align: "center",
|
||||||
|
key: "app_vouch_order_no",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-new",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "生产单号",
|
||||||
|
align: "center",
|
||||||
|
key: "product_order_no",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "行号",
|
||||||
|
align: "center",
|
||||||
|
key: "product_order_line_no",
|
||||||
|
width: 70,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "产品编码",
|
||||||
|
align: "center",
|
||||||
|
key: "product_code",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "产品名称",
|
||||||
|
align: "center",
|
||||||
|
key: "product_name",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "产品规格",
|
||||||
|
align: "product_spec",
|
||||||
|
key: "Quantity",
|
||||||
|
width: 150,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: "到货单号",
|
||||||
|
align: "center",
|
||||||
|
key: "ArrivalCode",
|
||||||
|
|
||||||
|
className: "demo-table-info-old",
|
||||||
|
render: (h, params) => {
|
||||||
|
return h("div", [
|
||||||
|
h(
|
||||||
|
"a",
|
||||||
|
{
|
||||||
|
props: {
|
||||||
|
type: "primary",
|
||||||
|
size: "small",
|
||||||
|
},
|
||||||
|
style: { color: "#2db7f5" },
|
||||||
|
domProps: {
|
||||||
|
title: params.row.ArrivalCode, //添加title属性
|
||||||
|
},
|
||||||
|
on: {
|
||||||
|
click: () => {
|
||||||
|
this.handleShow(params.row.ArrivalCode); //点击事件
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
params.row.ArrivalCode
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "到货日期",
|
||||||
|
align: "center",
|
||||||
|
key: "ArrivalDate",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "业务员",
|
||||||
|
align: "center",
|
||||||
|
key: "cpersonname",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "存货编码",
|
||||||
|
align: "center",
|
||||||
|
key: "MaterialCode",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "存货名称",
|
||||||
|
align: "center",
|
||||||
|
key: "cinvname",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "规格型号",
|
||||||
|
align: "center",
|
||||||
|
key: "cinvstd",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "单位",
|
||||||
|
align: "center",
|
||||||
|
key: "cinvm_unit",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "到货数量",
|
||||||
|
align: "center",
|
||||||
|
key: "Quantity",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "现存库位",
|
||||||
|
align: "center",
|
||||||
|
key: "cPosName",
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
columns2: [
|
||||||
|
{
|
||||||
|
title: "存货编码",
|
||||||
|
align: "center",
|
||||||
|
key: "MaterialCode",
|
||||||
|
width: 110,
|
||||||
|
className: "demo-table-info-new",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "存货名称",
|
||||||
|
align: "center",
|
||||||
|
key: "cinvname",
|
||||||
|
width: 130,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "规格型号",
|
||||||
|
align: "center",
|
||||||
|
key: "cinvstd",
|
||||||
|
width: 135,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "单位",
|
||||||
|
align: "center",
|
||||||
|
key: "cinvm_unit",
|
||||||
|
width: 80,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "数量",
|
||||||
|
align: "center",
|
||||||
|
key: "Quantity",
|
||||||
|
width: 80,
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "现存库位",
|
||||||
|
key: "cPosName",
|
||||||
|
width: 160,
|
||||||
|
align: "left",
|
||||||
|
className: "demo-table-info-nom",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
total() {
|
||||||
|
return this.datas.length;
|
||||||
|
},
|
||||||
|
pagedData() {
|
||||||
|
return pageingData(this.datas, this.pageSize, this.pageNo);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.loadData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handelExport() {
|
||||||
|
export_col_to_excel(this.columnsMaterialAppVouch, this.datas);
|
||||||
|
},
|
||||||
|
handleClick() {
|
||||||
|
this.loadData();
|
||||||
|
},
|
||||||
|
print() {
|
||||||
|
this.dom = document.getElementById("tb");
|
||||||
|
|
||||||
|
// console.log(this.dom);
|
||||||
|
this.$print(this.dom);
|
||||||
|
},
|
||||||
|
inventory(ranges) {
|
||||||
|
const skus = new Array();
|
||||||
|
//筛选条件
|
||||||
|
this.datas.map((Item, index) => {
|
||||||
|
if (Item.ArrivalCode == this.ranges[0].ccode) {
|
||||||
|
skus.push({
|
||||||
|
...Item,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return skus;
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.datas2 = [];
|
||||||
|
this.modal1 = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
async handleShow(h) {
|
||||||
|
this.ranges[0].ccode = h;
|
||||||
|
this.datas2 = this.inventory(this.ranges);
|
||||||
|
this.ccode=h;
|
||||||
|
this.ArrivalDate=this.datas2[0].ArrivalDate;
|
||||||
|
this.cpersonname=this.datas2[0].cpersonname;
|
||||||
|
|
||||||
|
|
||||||
|
this.modal1 = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadData() {
|
||||||
|
try {
|
||||||
|
this.loading = true;
|
||||||
|
let resp = await getListAndPost(this.filter);
|
||||||
|
|
||||||
|
this.pageNo = 1;
|
||||||
|
this.datas = sortByKey(resp.data.data, "app_vouch_order_no");
|
||||||
|
// this.datas = resp.data.data;
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePagechange(page) {
|
||||||
|
this.pageNo = page;
|
||||||
|
},
|
||||||
|
handlePageSize(pageSize) {
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
<style >
|
||||||
|
h3 {
|
||||||
|
margin: 40px 0 0;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ivu-table .demo-table-info-row td {
|
||||||
|
background-color: #2db7f5;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.ivu-table .demo-table-error-row td {
|
||||||
|
background-color: #ff6600;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ivu-table td.demo-table-info-old {
|
||||||
|
color: #2db7f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ivu-table td.demo-table-info-new {
|
||||||
|
color: #ff6600;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.ivu-table td.demo-table-info-nom {
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
.ivu-table td.demo-table-info-ex {
|
||||||
|
color: #187;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
padding: 10px 1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -50,6 +50,18 @@
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<Row :gutter="16">
|
||||||
|
<Col span="15">
|
||||||
|
<label></label>
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
<Col span="4">
|
||||||
|
<label>默认不勾选查应领大于已领量,勾选则已领>0</label>
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Table
|
<Table
|
||||||
style="margin-top: 20px"
|
style="margin-top: 20px"
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ module.exports = {
|
|||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:61448', // 接口域名
|
target: 'http://10.0.0.250:8081', // 接口域名
|
||||||
changeOrigin: true, // 是否跨域
|
changeOrigin: true, // 是否跨域
|
||||||
pathRewrite: {}
|
pathRewrite: {}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,10 +5,17 @@
|
|||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
|
<add key="ApiDbName" value="MES_SUBMIT" />
|
||||||
<add key="server" value="10.0.0.12" />
|
<add key="server" value="10.0.0.12" />
|
||||||
<add key="AccId" value="u8-2@001" />
|
<add key="AccId" value="u8-2@002" />
|
||||||
<add key="UserId" value="wxapi" />
|
<add key="UserId" value="wx997" />
|
||||||
<add key="Password" value="1" />
|
<add key="Password" value="1" />
|
||||||
|
<add key="EaiPort" value="80" />
|
||||||
|
<add key="EaiPath" value="U8EAI/import.asp" />
|
||||||
|
<add key="webpages:Version" value="3.0.0.0" />
|
||||||
|
<add key="webpages:Enabled" value="false" />
|
||||||
|
<add key="ClientValidationEnabled" value="true" />
|
||||||
|
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<runtime>
|
<runtime>
|
||||||
|
|
||||||
|
|||||||
22
U8Test/Store/APVouchTest.cs
Normal file
22
U8Test/Store/APVouchTest.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using NX.ERP.U8.Store;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NX.ERP.U8.Store.Tests
|
||||||
|
{
|
||||||
|
[TestClass()]
|
||||||
|
public class APVouchTest
|
||||||
|
{
|
||||||
|
[TestMethod()]
|
||||||
|
public void GetListAndPostNameTest()
|
||||||
|
{
|
||||||
|
var ap = new NX.ERP.U8.Store.MaterialAppDAL();
|
||||||
|
ap.GetListAndPost();
|
||||||
|
//Assert.Fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,8 +57,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="APVouchTest.cs" />
|
<Compile Include="APVouchTest.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Store\APVouchTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user