From 0d904f496fd15c98c07149bc87c53030abf856fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Wed, 16 Jun 2021 09:06:10 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Pmc/FinanceQuery.cs | 4 ++-- NX.ERP.WebAPi/Web.config | 2 +- NX.ERP.Webapp/src/views/inventory-SNDetail.vue | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NX.ERP.U8/Pmc/FinanceQuery.cs b/NX.ERP.U8/Pmc/FinanceQuery.cs index f099f5a..88d67f4 100644 --- a/NX.ERP.U8/Pmc/FinanceQuery.cs +++ b/NX.ERP.U8/Pmc/FinanceQuery.cs @@ -22,8 +22,8 @@ namespace NX.ERP.U8.Finance public IEnumerable InventorySNDetail(NX.ERP.Model.Request.SnOrderRequest info1) { string sql = $@" - select a.cInvCode,e.cInvName,b.cCode as Cprk, b.dDate as rkrq,c.cWhName, - b.cMPoCode,d.cDepName,a.cInvSN,k.iUnitCost, + select a.cInvCode,e.cInvName,b.cCode as Cprk, b.dDate as rkrq,c.cWhName, + b.cMPoCode,d.cDepName,a.cInvSN,a.csnmemo,k.iUnitCost, g.cCode as Clck,g.dDate as ckrq,h.cCusAbbName,f.cInvSN as ckcInvSN from ST_SNDetail_PROIN a WITH(NOLOCK) left join rdrecord10 b WITH(NOLOCK) on a.iVouchID=b.id diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 3e4344f..64546d8 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -8,7 +8,7 @@ - + diff --git a/NX.ERP.Webapp/src/views/inventory-SNDetail.vue b/NX.ERP.Webapp/src/views/inventory-SNDetail.vue index ebc2ee9..9b258a2 100644 --- a/NX.ERP.Webapp/src/views/inventory-SNDetail.vue +++ b/NX.ERP.Webapp/src/views/inventory-SNDetail.vue @@ -170,6 +170,11 @@ export default { align: "center", key: "iUnitCost", }, + { + title: "备注", + align: "center", + key: "csnmemo", + }, { title: "出库库单号", align: "center", From e0294963f82a6140aca758fcaa4719d700c4534f Mon Sep 17 00:00:00 2001 From: ehkang Date: Wed, 16 Jun 2021 10:05:13 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8CSN?= =?UTF-8?q?=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/MES/MesLogic.cs | 1046 ++++++++++++++++++++++++++++++++++--- 1 file changed, 982 insertions(+), 64 deletions(-) diff --git a/NX.ERP.U8/MES/MesLogic.cs b/NX.ERP.U8/MES/MesLogic.cs index 21937c3..5e3d9b8 100644 --- a/NX.ERP.U8/MES/MesLogic.cs +++ b/NX.ERP.U8/MES/MesLogic.cs @@ -8,70 +8,988 @@ namespace NX.ERP.U8.MES { public class MesLogic { - /// - /// - /// - /// - /// - public bool ReportSnList(Model.Request.ProductOrderReportSn info) - { - #region 校验数据 - var momOrder = new Mom.MomOrderDAL().GetModel(info.ProductOrder); - if (momOrder == null || string.IsNullOrEmpty(momOrder.ProductOrderNo)) - { - throw new Exception($"非法的生产单号[{info.ProductOrder}]"); - } - foreach (var detail in info.OrderDetails) - { - //校验明细行合法性 - var momOrderDetail = momOrder.ProductDtlLst.FirstOrDefault(m => { return m.ProductOrderDtlId == detail.SourceDetailId; }); - if (momOrderDetail == null || momOrderDetail.ProductOrderDtlId <= 0) - { - throw new Exception($"非法的生产明细[{detail.SourceDetailId}]"); - } - //校验SN合法性 - var lstExcept = detail.SnList.Except(momOrderDetail.SN).ToList(); - if (lstExcept.Count > 0) - { - throw new Exception($"包含非法的序列号[{string.Join(",", lstExcept.ToArray())}]"); - } - } - #endregion + /// + /// + /// + /// + /// + public bool ReportSnList(Model.Request.ProductOrderReportSn info) + { + #region 校验数据 + var momOrder = new Mom.MomOrderDAL().GetModel(info.ProductOrder); + if (momOrder == null || string.IsNullOrEmpty(momOrder.ProductOrderNo)) + { + throw new Exception($"非法的生产单号[{info.ProductOrder}]"); + } + using (var conn = U8LoginContext.Instance.Connection) + { - #region 写入DB - var instertSql = "INSERT INTO [dbo].[MES_PRODUCT_SN_LIST] ([PRODUCT_ORDER_NO], [ORDER_LINE_ID], [SN]) VALUES (@PRODUCT_ORDER_NO, @ORDER_LINE_ID, @SN);"; - using (var conn = U8LoginContext.Instance.Connection) - { - conn.Open(); - conn.ChangeDatabase(System.Configuration.ConfigurationManager.AppSettings["ApiDbName"]); - var tran = conn.BeginTransaction(); - try - { - conn.Execute($"DELETE FROM MES_PRODUCT_SN_LIST WHERE PRODUCT_ORDER_NO = '{info.ProductOrder}'", null, tran); - foreach (var detail in info.OrderDetails) - { - var newList = detail.SnList.Select(sn => new - { - PRODUCT_ORDER_NO = info.ProductOrder, - ORDER_LINE_ID = detail.SourceDetailId, - SN = sn, - }); - conn.Execute(instertSql, newList, tran); - } - tran.Commit(); - return true; - } - catch (Exception ex) - { - tran.Rollback(); - throw new Exception("保存失败"); - } - finally - { - conn.Close(); - } - } - #endregion 写入DB - } + foreach (var detail in info.OrderDetails) + { + //校验明细行合法性 + var momOrderDetail = momOrder.ProductDtlLst.FirstOrDefault(m => { return m.ProductOrderDtlId == detail.SourceDetailId; }); + if (momOrderDetail == null || momOrderDetail.ProductOrderDtlId <= 0) + { + throw new Exception($"非法的生产明细[{detail.SourceDetailId}]"); + } + //校验SN合法性 + var lstExcept = detail.SnList.Except(momOrderDetail.SN).ToList(); + if (lstExcept.Count > 0) + { + throw new Exception($"包含非法的序列号[{string.Join(",", lstExcept.ToArray())}]"); + } + + var dicSnCount = new Dictionary(); + 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 + + #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);"; + + + conn.Open(); + conn.ChangeDatabase(System.Configuration.ConfigurationManager.AppSettings["ApiDbName"]); + var tran = conn.BeginTransaction(); + try + { + conn.Execute($"DELETE FROM MES_PRODUCT_SN_LIST WHERE PRODUCT_ORDER_NO = '{info.ProductOrder}'", null, tran); + foreach (var detail in info.OrderDetails) + { + var newList = detail.SnList.Select(sn => new + { + PRODUCT_ORDER_NO = info.ProductOrder, + ORDER_LINE_ID = detail.SourceDetailId, + SN = sn, + }); + conn.Execute(instertSql, newList, tran); + } + tran.Commit(); + return true; + } + catch (Exception ex) + { + tran.Rollback(); + throw new Exception("保存失败"); + } + finally + { + conn.Close(); + } + } + #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 "; } } From 8bb0d8f6b9c9813abaf8a6ae08a3ed6bab5cee7b Mon Sep 17 00:00:00 2001 From: ehkang Date: Thu, 17 Jun 2021 17:03:50 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E9=A2=86=E6=96=99=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/NX.ERP.Model.csproj | 1 + .../Store/MaterialAppVouchAndPostName.cs | 76 +++ NX.ERP.U8/Store/MaterialAppDAL.cs | 99 +++- .../Store/MaterialAppController.cs | 9 + NX.ERP.Webapp/package-lock.json | 160 +++--- NX.ERP.Webapp/src/App.vue | 2 +- NX.ERP.Webapp/src/api/materialAppVouch.js | 6 + NX.ERP.Webapp/src/route/index.js | 2 + .../src/views/inventory-materialAppVouch.vue | 490 ++++++++++++++++++ U8Test/App.config | 11 +- U8Test/Store/APVouchTest.cs | 22 + U8Test/U8Test.csproj | 2 + 12 files changed, 795 insertions(+), 85 deletions(-) create mode 100644 NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs create mode 100644 NX.ERP.Webapp/src/api/materialAppVouch.js create mode 100644 NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue create mode 100644 U8Test/Store/APVouchTest.cs diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index 787a7cc..9ca16cb 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -89,6 +89,7 @@ + diff --git a/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs b/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs new file mode 100644 index 0000000..64ffdcb --- /dev/null +++ b/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs @@ -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 + { + + /// + /// 领料单号 + /// + public string AppVouchOrderNo { get; set; } + + /// + /// 物料编码 + /// + public string MaterialCode { get; set; } + + /// + /// 物料名称 + /// + public string MaterialName { get; set; } + + /// + /// 物料规格 + /// + public string MaterialSpec { get; set; } + + /// + /// 单位 + /// + public string Unit { get; set; } + + public decimal Quantit { get; set; } + /// + /// 需求日期 + /// + public string DemandDate { get; set; } + + /// + /// 仓库名称 + /// + public string WarehouseName { get; set; } + + /// + /// 生产单号 + /// + public string ProductOrderNo { get; set; } + + /// + /// 生产单行号 + /// + public string ProductOrderLineNo { get; set; } + + /// + /// 产品编码 + /// + public string ProductCode { get; set; } + + /// + /// 产品名称 + /// + public string ProductName { get; set; } + + /// + /// 产品规格 + /// + public string ProductSpec { get; set; } + /// + /// 库位 + /// + public string Position { get; set; } + } +} diff --git a/NX.ERP.U8/Store/MaterialAppDAL.cs b/NX.ERP.U8/Store/MaterialAppDAL.cs index d6fe8f8..bd18463 100644 --- a/NX.ERP.U8/Store/MaterialAppDAL.cs +++ b/NX.ERP.U8/Store/MaterialAppDAL.cs @@ -45,7 +45,7 @@ namespace NX.ERP.U8.Store headXml.setAttribute("cDepCode", param.DepCode); headXml.setAttribute("cMaker", param.Maker); headXml.setAttribute("cPersonCode", param.PersonCode); - Model.MOM.MomOrder Order = null; + Model.MOM.MomOrder Order = null; if (param.source == "生产订单") { Order = new Mom.MomOrderDAL().GetModel(param.SourceCode); @@ -251,5 +251,102 @@ FROM MaterialAppVouch a } + + + + /// + /// 根据领料单号查询 带库位 + /// + /// + /// + public IEnumerable GetModelAndPost(string OrderCode) + { + if (!string.IsNullOrEmpty(OrderCode)) + { + return this.GetListAndPost(" a.cCode=@OrderCode", new { OrderCode }); + } + else + { + return this.GetListAndPost(); + } + } + + /// + /// 查询领料信息 带库位 + /// + /// + /// + /// + public IEnumerable 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(strSQL, Params); + return list; + } + } } } diff --git a/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs b/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs index ba73b84..0d29b1c 100644 --- a/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs @@ -45,6 +45,15 @@ namespace NX.ERP.WebAPi.Controllers.Store } + [Route("api/MaterialApp/ListAndPost")] + [HttpGet] + public IEnumerable GetModelAndPost(string Code = "") + { + var dal = new NX.ERP.U8.Store.MaterialAppDAL(); + return dal.GetModelAndPost(Code); + } + + [Obsolete] [Route("api/MaterialApp/ListByMoCode")] [HttpGet] diff --git a/NX.ERP.Webapp/package-lock.json b/NX.ERP.Webapp/package-lock.json index 41308c8..8e74df1 100644 --- a/NX.ERP.Webapp/package-lock.json +++ b/NX.ERP.Webapp/package-lock.json @@ -2194,6 +2194,63 @@ "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "optional": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, "ssri": { "version": "8.0.1", "resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364647836&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz", @@ -2202,6 +2259,28 @@ "requires": { "minipass": "^3.1.1" } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.2.0", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz", + "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + } } } }, @@ -11709,87 +11788,6 @@ } } }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.2.0", - "resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.2.0.tgz", - "integrity": "sha1-BGpTMI3Ufljv4g3ewe3sAnzjtG4=", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "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", - "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.1", - "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", - "integrity": "sha1-yAs/qyi/Y3HmhjMl7uZ+YYt35q0=", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz", - "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz", - "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=", - "dev": true, - "optional": true - }, - "has-flag": { - "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", - "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=", - "dev": true, - "optional": true - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz", - "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=", - "dev": true, - "optional": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "supports-color": { - "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", - "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "vue-router": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.1.tgz", diff --git a/NX.ERP.Webapp/src/App.vue b/NX.ERP.Webapp/src/App.vue index c513de7..9114bb3 100644 --- a/NX.ERP.Webapp/src/App.vue +++ b/NX.ERP.Webapp/src/App.vue @@ -26,7 +26,7 @@ 到货单 异常单据查询 - + 领料单查询 diff --git a/NX.ERP.Webapp/src/api/materialAppVouch.js b/NX.ERP.Webapp/src/api/materialAppVouch.js new file mode 100644 index 0000000..0fdc5d1 --- /dev/null +++ b/NX.ERP.Webapp/src/api/materialAppVouch.js @@ -0,0 +1,6 @@ +import axios from 'axios' + +//查询领料列表带库位 +export const getListAndPost = (info) => { + return axios.get('/api/MaterialApp/ListAndPost', info) +} \ No newline at end of file diff --git a/NX.ERP.Webapp/src/route/index.js b/NX.ERP.Webapp/src/route/index.js index 86e652f..4971ddf 100644 --- a/NX.ERP.Webapp/src/route/index.js +++ b/NX.ERP.Webapp/src/route/index.js @@ -10,6 +10,7 @@ import inventorypoc from '@/views/inventory-poc.vue' import Purchasesum from '@/views/Purchasesum.vue' import inventoryrrival from '@/bill/inventory-arrival.vue' import inventoryerror from '@/bill/inventory-error.vue' +import inventoryMaterialAppVouch from '@/views/inventory-materialAppVouch.vue' export default [ { @@ -29,4 +30,5 @@ export default [ { path: '/Purchasesum', component: Purchasesum }, { path: '/inventoryrrival', component: inventoryrrival }, { path: '/inventoryerror', component: inventoryerror }, + { path: '/inventoryMaterialAppVouch', component: inventoryMaterialAppVouch }, ] diff --git a/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue b/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue new file mode 100644 index 0000000..666a1fb --- /dev/null +++ b/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue @@ -0,0 +1,490 @@ + + + + + + + diff --git a/U8Test/App.config b/U8Test/App.config index c45e339..b308506 100644 --- a/U8Test/App.config +++ b/U8Test/App.config @@ -5,10 +5,17 @@ + - - + + + + + + + + diff --git a/U8Test/Store/APVouchTest.cs b/U8Test/Store/APVouchTest.cs new file mode 100644 index 0000000..52d483e --- /dev/null +++ b/U8Test/Store/APVouchTest.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/U8Test/U8Test.csproj b/U8Test/U8Test.csproj index 350fc6b..f667165 100644 --- a/U8Test/U8Test.csproj +++ b/U8Test/U8Test.csproj @@ -57,8 +57,10 @@ + + From 8d4062c2429a0fb5412efed1b9628feaa9533016 Mon Sep 17 00:00:00 2001 From: ehkang Date: Thu, 17 Jun 2021 17:07:53 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs | 2 +- NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs b/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs index 64ffdcb..08edbe1 100644 --- a/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs +++ b/NX.ERP.Model/Response/Store/MaterialAppVouchAndPostName.cs @@ -33,7 +33,7 @@ namespace NX.ERP.Model.Response.Store /// public string Unit { get; set; } - public decimal Quantit { get; set; } + public decimal Qty { get; set; } /// /// 需求日期 /// diff --git a/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue b/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue index 666a1fb..91c65e2 100644 --- a/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue +++ b/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue @@ -172,7 +172,7 @@ { title: "数量", align: "center", - key: "quantit", + key: "qty", width: 80, className: "demo-table-info-nom", }, From d7581d8fe16df1219c9814bbebd7499e818311b7 Mon Sep 17 00:00:00 2001 From: ehkang Date: Thu, 17 Jun 2021 17:09:36 +0800 Subject: [PATCH 05/12] 1 --- NX.ERP.Webapp/src/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NX.ERP.Webapp/src/App.vue b/NX.ERP.Webapp/src/App.vue index 9114bb3..1f991a6 100644 --- a/NX.ERP.Webapp/src/App.vue +++ b/NX.ERP.Webapp/src/App.vue @@ -26,7 +26,7 @@ 到货单 异常单据查询 - 领料单查询 + 领料单查询 From fe0aec7fefb6f5bf4c1a1a466d3ae93ed1a3b077 Mon Sep 17 00:00:00 2001 From: ehkang Date: Sat, 19 Jun 2021 09:36:00 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E9=A2=86=E6=96=99=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8D=95=E6=89=93=E5=8D=B0=E5=92=8C=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Store/MaterialAppDAL.cs | 17 +++++- .../Store/MaterialAppController.cs | 6 +- NX.ERP.Webapp/src/api/materialAppVouch.js | 2 +- .../src/views/inventory-materialAppVouch.vue | 59 +++++++++---------- 4 files changed, 45 insertions(+), 39 deletions(-) diff --git a/NX.ERP.U8/Store/MaterialAppDAL.cs b/NX.ERP.U8/Store/MaterialAppDAL.cs index bd18463..b80b5ee 100644 --- a/NX.ERP.U8/Store/MaterialAppDAL.cs +++ b/NX.ERP.U8/Store/MaterialAppDAL.cs @@ -259,11 +259,22 @@ FROM MaterialAppVouch a /// /// /// - public IEnumerable GetModelAndPost(string OrderCode) + public IEnumerable GetModelAndPost(string OrderCode, string invCode) { - if (!string.IsNullOrEmpty(OrderCode)) + if (!string.IsNullOrEmpty(OrderCode) && !string.IsNullOrEmpty(invCode)) { - return this.GetListAndPost(" a.cCode=@OrderCode", new { OrderCode }); + 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 { diff --git a/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs b/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs index 0d29b1c..5a36523 100644 --- a/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs @@ -46,11 +46,11 @@ namespace NX.ERP.WebAPi.Controllers.Store [Route("api/MaterialApp/ListAndPost")] - [HttpGet] - public IEnumerable GetModelAndPost(string Code = "") + [HttpPost] + public IEnumerable GetModelAndPost(Model.Response.Store.MaterialAppVouchAndPostName req) { var dal = new NX.ERP.U8.Store.MaterialAppDAL(); - return dal.GetModelAndPost(Code); + return dal.GetModelAndPost(req.AppVouchOrderNo, req.MaterialCode); } diff --git a/NX.ERP.Webapp/src/api/materialAppVouch.js b/NX.ERP.Webapp/src/api/materialAppVouch.js index 0fdc5d1..208582c 100644 --- a/NX.ERP.Webapp/src/api/materialAppVouch.js +++ b/NX.ERP.Webapp/src/api/materialAppVouch.js @@ -2,5 +2,5 @@ import axios from 'axios' //查询领料列表带库位 export const getListAndPost = (info) => { - return axios.get('/api/MaterialApp/ListAndPost', info) + return axios.post('/api/MaterialApp/ListAndPost', info) } \ No newline at end of file diff --git a/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue b/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue index 91c65e2..5cf0757 100644 --- a/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue +++ b/NX.ERP.Webapp/src/views/inventory-materialAppVouch.vue @@ -5,13 +5,13 @@ - + - + - + + @@ -113,9 +116,8 @@ cpersonname:"", datas2: [], filter: { - inv_codes: "", - inv_std: "", - ar_codes: "", + app_vouch_order_no: "", + material_code: "", }, dom: "", ranges: [ @@ -133,13 +135,6 @@ // width: 60, // align: "center", // }, - { - title: "领料单号", - align: "center", - key: "app_vouch_order_no", - width: 150, - className: "demo-table-info-new", - }, { title: "存货编码", align: "center", @@ -158,7 +153,7 @@ title: "规格型号", align: "center", key: "material_spec", - width: 135, + width: 150, className: "demo-table-info-nom", }, { @@ -176,6 +171,13 @@ width: 80, className: "demo-table-info-nom", }, + { + title: "现存库位", + key: "position", + width: 160, + align: "left", + className: "demo-table-info-nom", + }, { title: "需求日期", align: "center", @@ -190,6 +192,13 @@ 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", @@ -225,13 +234,6 @@ width: 150, className: "demo-table-info-nom", }, - { - title: "现存库位", - key: "position", - width: 160, - align: "left", - className: "demo-table-info-nom", - }, ], columns: [ { @@ -379,7 +381,7 @@ this.loadData(); }, print() { - this.dom = document.getElementById("tb2"); + this.dom = document.getElementById("tb"); // console.log(this.dom); this.$print(this.dom); @@ -414,18 +416,11 @@ async loadData() { try { - let _filert = { - c_inv_code: this.filter.inv_codes, - inv_std: this.filter.inv_std, - arrival_nolist: - this.filter.ar_codes !== "" - ? this.filter.ar_codes.split(/[,\s\n,]/) - : null, - }; this.loading = true; - let resp = await getListAndPost(_filert); + let resp = await getListAndPost(this.filter); + this.pageNo = 1; - this.datas = sortByKey(resp.data.data, "ArrivalCode"); + this.datas = sortByKey(resp.data.data, "app_vouch_order_no"); // this.datas = resp.data.data; } catch (error) { } finally { From 2e103706e7df76d98246490727f44d433effdecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Mon, 21 Jun 2021 10:43:07 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E5=88=B0=E8=B4=A7=E5=8A=A0=E6=9C=AA?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Pmc/WarehouseQuery.cs | 2 +- NX.ERP.U8/Store/MaterialAppDAL.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NX.ERP.U8/Pmc/WarehouseQuery.cs b/NX.ERP.U8/Pmc/WarehouseQuery.cs index b70a559..0d834a6 100644 --- a/NX.ERP.U8/Pmc/WarehouseQuery.cs +++ b/NX.ERP.U8/Pmc/WarehouseQuery.cs @@ -51,7 +51,7 @@ select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.c , PO_Podetails C WITH (NOLOCK) Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') -- and ( isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')) - And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>'' and a.id=b.id and b.cinvcode=inventory.cinvcode1 and B.iPOsID = C.ID + And (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 isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1 diff --git a/NX.ERP.U8/Store/MaterialAppDAL.cs b/NX.ERP.U8/Store/MaterialAppDAL.cs index bd18463..89c0aad 100644 --- a/NX.ERP.U8/Store/MaterialAppDAL.cs +++ b/NX.ERP.U8/Store/MaterialAppDAL.cs @@ -263,7 +263,7 @@ FROM MaterialAppVouch a { if (!string.IsNullOrEmpty(OrderCode)) { - return this.GetListAndPost(" a.cCode=@OrderCode", new { OrderCode }); + return this.GetListAndPost(" MA.cCode=@OrderCode", new { OrderCode }); } else { From bd2cc8759c5726c47c6fa84a12d18b2c55cfd67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Mon, 21 Jun 2021 10:58:48 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Pmc/PurchaseQuery.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NX.ERP.U8/Pmc/PurchaseQuery.cs b/NX.ERP.U8/Pmc/PurchaseQuery.cs index 8b3d188..6bf6591 100644 --- a/NX.ERP.U8/Pmc/PurchaseQuery.cs +++ b/NX.ERP.U8/Pmc/PurchaseQuery.cs @@ -259,7 +259,7 @@ namespace NX.ERP.U8.Purchase (SELECT iAppIds, sum(iquantity) AS qty FROM PO_Podetails WITH (nolock) 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 GROUP BY cInvCode ) as tbl1 @@ -291,7 +291,7 @@ namespace NX.ERP.U8.Purchase (SELECT iAppIds, sum(iquantity) AS qty FROM PO_Podetails WITH (nolock) 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 GROUP BY cInvCode ) as tbl1 @@ -417,7 +417,7 @@ namespace NX.ERP.U8.Purchase 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) 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 + 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 ) puu "; From 79314a384bfed369052922cfbc8e855314adc976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Fri, 25 Jun 2021 15:28:29 +0800 Subject: [PATCH 09/12] 1 --- NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs | 2 +- NX.ERP.WebAPi/Web.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs b/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs index 5a36523..81e48ed 100644 --- a/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/MaterialAppController.cs @@ -34,7 +34,7 @@ namespace NX.ERP.WebAPi.Controllers.Store - [Obsolete] + [Route("api/MaterialApp/Model")] [HttpGet] diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 64546d8..3c2f47f 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -7,7 +7,7 @@ - + From 5fa6a403f64e4602b19cc9f1d8e93998de9a8cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Tue, 29 Jun 2021 16:12:29 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E8=AE=A2=EF=BC=8C=E7=A6=BB?= =?UTF-8?q?=E8=81=8C=E4=BA=A4=E6=8E=A5=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Pmc/PmcQuery.cs | 23 ++++--- NX.ERP.U8/Pmc/PurchaseQuery.cs | 79 ++++++++++++++++++----- NX.ERP.Webapp/src/views/inventory-mom.vue | 12 ++++ 3 files changed, 89 insertions(+), 25 deletions(-) diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs index 5c3b83c..fd549bc 100644 --- a/NX.ERP.U8/Pmc/PmcQuery.cs +++ b/NX.ERP.U8/Pmc/PmcQuery.cs @@ -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 left JOIN 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 FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN 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 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 mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join - 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 + mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId + + 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 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 left JOIN 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 FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN 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 - (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 mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join - 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 + mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId + + 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 FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN diff --git a/NX.ERP.U8/Pmc/PurchaseQuery.cs b/NX.ERP.U8/Pmc/PurchaseQuery.cs index 6bf6591..a8d48bc 100644 --- a/NX.ERP.U8/Pmc/PurchaseQuery.cs +++ b/NX.ERP.U8/Pmc/PurchaseQuery.cs @@ -211,7 +211,7 @@ namespace NX.ERP.U8.Purchase public IEnumerable Purchasesum(NX.ERP.Model.Request.PurchasesumRequest info) { string sql = $@" - DECLARE @RdRecord table( + DECLARE @RdRecord table( cPsn_Num nvarchar(30), cpersonname nvarchar(30), puappnumall int, @@ -273,7 +273,11 @@ namespace NX.ERP.U8.Purchase as tbl on tbl1.cinvcode=tbl.cInvCode ) 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=b.puappnumall 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= a.puappnumall +b.puappnumall 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 @@ -305,7 +309,11 @@ namespace NX.ERP.U8.Purchase as tbl on tbl1.cinvcode=tbl.cInvCode ) 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=b.puappnumall 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= a.puappnum03 +b.puappnumall 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 @@ -342,8 +350,12 @@ namespace NX.ERP.U8.Purchase as tbl on tbl1.cinvcode=tbl.cInvCode ) 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=b.puappnumall 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 ( select '其他' as cpersonname ,sum(puappnumall) as mommouth02 from @RdRecord4 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname @@ -379,21 +391,28 @@ namespace NX.ERP.U8.Purchase as tbl on tbl1.cinvcode=tbl.cInvCode ) 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=b.puappnumall From @RdRecord a left join @RdRecord5 b on a.cpersonname =b.cpersonname + update a set a.mommouth04=b.puappnumall 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= 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 where a.cpersonname='其他' + + delete from @RdRecord where cpersonname in (select quit from CGBB2021_0001_E001) + select *from @RdRecord + + "; @@ -407,8 +426,24 @@ namespace NX.ERP.U8.Purchase public IEnumerable Purchasesumpuapp(NX.ERP.Model.Request.PurchasesumRequest info) { string sql = $@" - 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 + 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 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 pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN (SELECT iAppIds, sum(iquantity) AS qty @@ -417,8 +452,15 @@ namespace NX.ERP.U8.Purchase 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) as c where c.rownumber=1) f on ommds.cInvCode =f.cInvCode + left join CGBB2021_0001_E001 k WITH (NOLOCK) on f.cMaker =k.quit 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 ) puu + 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 where = new List(); @@ -453,8 +495,9 @@ namespace NX.ERP.U8.Purchase public IEnumerable Purchasesummom(NX.ERP.Model.Request.PurchasesumRequest info) { string sql = $@" - DECLARE @RdRecord table( - CINVCODE nvarchar(200), + IF EXISTS (SELECT NAME FROM tempdb..SYSOBJECTS WHERE NAME ='tablemom20210625' AND Xtype='U') DROP Table tempdb..tablemom20210625 + create table tempdb..tablemom20210625 ( + CINVCODE nvarchar(200), RQTY int, iqty int, iQuantity int, @@ -462,10 +505,12 @@ namespace NX.ERP.U8.Purchase cpersonname nvarchar(200), cInvName nvarchar(200), cInvStd nvarchar(500) - ) - insert into @RdRecord + ) + + + insert into tempdb..tablemom20210625 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 ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN @@ -480,12 +525,14 @@ namespace NX.ERP.U8.Purchase ) 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) 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 - 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 where = new List(); diff --git a/NX.ERP.Webapp/src/views/inventory-mom.vue b/NX.ERP.Webapp/src/views/inventory-mom.vue index 9888e57..653398e 100644 --- a/NX.ERP.Webapp/src/views/inventory-mom.vue +++ b/NX.ERP.Webapp/src/views/inventory-mom.vue @@ -50,6 +50,18 @@ +
+ + + + + + + + + + +
Date: Mon, 2 Aug 2021 12:54:21 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E8=A1=A8BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.WebAPi/Web.config | 4 +- NX.ERP.Webapp/package-lock.json | 160 ++++++++++++++++---------------- NX.ERP.Webapp/src/libs/tools.js | 5 +- NX.ERP.Webapp/vue.config.js | 2 +- 4 files changed, 86 insertions(+), 85 deletions(-) diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 3c2f47f..cede30a 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -6,8 +6,8 @@ - - + + diff --git a/NX.ERP.Webapp/package-lock.json b/NX.ERP.Webapp/package-lock.json index 8e74df1..dfb0736 100644 --- a/NX.ERP.Webapp/package-lock.json +++ b/NX.ERP.Webapp/package-lock.json @@ -2194,63 +2194,6 @@ "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", "dev": true }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "optional": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, "ssri": { "version": "8.0.1", "resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364647836&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz", @@ -2259,28 +2202,6 @@ "requires": { "minipass": "^3.1.1" } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.2.0", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz", - "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - } } } }, @@ -11788,6 +11709,87 @@ } } }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.4.0", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.4.0.tgz", + "integrity": "sha512-oySoEgEedGw0jz2czEOdb6sycQ2PPyzUmF8Yclj1NTpoTVHGCYCQaGf+jsvxhdDVfhOnDLjkRzT2fLpGOrVPjg==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "optional": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "vue-router": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.1.tgz", diff --git a/NX.ERP.Webapp/src/libs/tools.js b/NX.ERP.Webapp/src/libs/tools.js index 4831484..e46e85e 100644 --- a/NX.ERP.Webapp/src/libs/tools.js +++ b/NX.ERP.Webapp/src/libs/tools.js @@ -274,9 +274,8 @@ export const export_col_to_excel = (colums, data, filename) => { ws[XLSX.utils.encode_cell({ c: _col.left, r: _dataRow })] = v } else { if (v) { - // if (typeof v == 'Number') t = 'n' - // else - if (typeof v == 'boolean') t = 'b' + if (typeof v === 'number') {t = 'n'} + else if (typeof v === 'boolean') {t = 'b'} else if (v instanceof Date) { t = 'd' // t = "n"; diff --git a/NX.ERP.Webapp/vue.config.js b/NX.ERP.Webapp/vue.config.js index 994f798..a3cd3a4 100644 --- a/NX.ERP.Webapp/vue.config.js +++ b/NX.ERP.Webapp/vue.config.js @@ -58,7 +58,7 @@ module.exports = { disableHostCheck: true, proxy: { '/api': { - target: 'http://localhost:61448', // 接口域名 + target: 'http://10.0.0.250:8081', // 接口域名 changeOrigin: true, // 是否跨域 pathRewrite: {} }, From d21926f4c064c7b01107ee38e2254a41ebefeaac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Mon, 2 Aug 2021 13:13:21 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BF=AE=E8=AE=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Pmc/PurchaseQuery.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/NX.ERP.U8/Pmc/PurchaseQuery.cs b/NX.ERP.U8/Pmc/PurchaseQuery.cs index a8d48bc..dca6c95 100644 --- a/NX.ERP.U8/Pmc/PurchaseQuery.cs +++ b/NX.ERP.U8/Pmc/PurchaseQuery.cs @@ -211,7 +211,7 @@ namespace NX.ERP.U8.Purchase public IEnumerable Purchasesum(NX.ERP.Model.Request.PurchasesumRequest info) { string sql = $@" - DECLARE @RdRecord table( + DECLARE @RdRecord table( cPsn_Num nvarchar(30), cpersonname nvarchar(30), puappnumall int, @@ -276,12 +276,12 @@ namespace NX.ERP.U8.Purchase 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=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= a.puappnumall +b.puappnumall From @RdRecord a left join ( + 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 - where a.cpersonname='其他' + where a.cpersonname='其他' insert into @RdRecord3 select cPsn_Num,sum(RQTY3) as puappnumall from ( @@ -312,10 +312,10 @@ namespace NX.ERP.U8.Purchase 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=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= a.puappnum03 +b.puappnumall From @RdRecord a left join ( + 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 where a.cpersonname='其他' @@ -353,11 +353,11 @@ namespace NX.ERP.U8.Purchase 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 + 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 where a.cpersonname='其他' @@ -395,10 +395,10 @@ namespace NX.ERP.U8.Purchase where b.quit is not null - update a set a.mommouth04=b.puappnumall From @RdRecord a left join ( + 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= a.mommouth04 +b.mommouth04 From @RdRecord a left join ( + update a set a.mommouth04= isnull(a.mommouth04,0) +isnull(b.mommouth04,0) 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 where a.cpersonname='其他' @@ -412,7 +412,6 @@ namespace NX.ERP.U8.Purchase - ";