|
|
using NFine.Code; using NFine.Domain.Entity.SystemManage; using System.Collections.Generic; using System.Data; using System.Data.Common; using NFine.Repository; using System.Text; using System; using System.Configuration; using NFine.Data; using System.IO; using Newtonsoft.Json; using NFine.Domain._02_ViewModel; using NFine.Data.Extensions; using Newtonsoft.Json.Linq;
namespace NFine.Application.SRM { public class WatchPanelApp : RepositoryFactory<ModuleEntity> { //到货明细
public DataTable GetList1(string queryJson, ref Pagination jqgridparam) { var queryParam = queryJson.ToJObject(); OperatorModel oo = NFine.Code.OperatorProvider.Provider.GetCurrent(); string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
select * from ( SELECT *,
收货数量 -已检数量 待检数量, CASE WHEN 收货数量 -已检数量> 0 THEN '待检验' WHEN 已检待入> 0 THEN '待入库' ELSE '完成' END 状态 FROM ( SELECT cc.receiptNo 到货单号,dd.orderno 订单号,dd.itemcode 料号,dd.planqty 收货数量,inv.invname 物料名称, isnull(( SELECT SUM (lotqty) FROM icsitemlot lot WHERE lot.TransNO=dd.ReceiptNO AND lot.TransLine=dd.ReceiptLine AND isnull(IQCStatus,'') !='' AND cc.workpoint=lot.workpoint),0) 已检数量, isnull(( SELECT SUM (lotqty) FROM icsitemlot lot WHERE lot.TransNO=dd.ReceiptNO AND lot.TransLine=dd.ReceiptLine AND isnull(IQCStatus,'') !='' AND cc.workpoint=lot.workpoint AND NOT EXISTS ( SELECT 1 FROM ICSWareHouseLotInfo info WHERE info.lotno=lot.lotno AND info.workpoint=lot.workpoint)),0) 已检待入 FROM ICSINVReceipt cc LEFT JOIN ICSINVReceiptDetail dd ON cc.ReceiptNO=dd.ReceiptNO AND dd.workpoint=cc.workpoint LEFT JOIN ICSINVENTORY inv ON inv.invcode=dd.itemcode AND dd.workpoint=inv.workpoint WHERE cc.mtime >=DATEADD(week, -1,getdate()) and cc.workpoint='" + workpoint + @"' ) ff ) gg ";
DataTable dt = Repository().FindTablePageBySql_Other(SqlText, "MESconnstr", parameter.ToArray(), ref jqgridparam);
return dt;
}
//来料不合格明细
public DataTable GetList2(string queryJson, ref Pagination jqgridparam) { var queryParam = queryJson.ToJObject(); string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; OperatorModel oo = NFine.Code.OperatorProvider.Provider.GetCurrent(); List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
select * from ( SELECT cc.receiptNo 到货单,dd.orderno 采购订单号,dd.itemcode 料号, inv.invname 物料名称, sum(lot.lotqty) 不合格数量 ,kk.CKITEMDESC 不良原因 FROM ICSINVReceipt cc LEFT JOIN ICSINVReceiptDetail dd ON cc.ReceiptNO=dd.ReceiptNO AND dd.workpoint=cc.workpoint LEFT JOIN ICSINVENTORY inv ON inv.invcode=dd.itemcode AND dd.workpoint=inv.workpoint left join icsitemlot lot on lot.TransNO=dd.ReceiptNO AND lot.TransLine=dd.ReceiptLine AND cc.workpoint=lot.workpoint left join (select * from (select ROW_NUMBER()over(partition by LOTNO order by mtime desc,id ) rowId,lotno ,errdata , CASE WHEN NG='' THEN CKITEMDESC ELSE NG END CKITEMDESC from ICSIQCErrList ck where workpoint='" + workpoint + @"' and errdata='不合格' ) as AuctionRecords where rowId=1) kk on kk.lotno=lot.lotno WHERE 1=1 and cc.mtime >=DATEADD(MONTH, -1,getdate()) -- and kk.errdata='不合格' and isnull(lot.iqcstatus,'') ='不合格' and cc.workpoint='" + workpoint + @"' group by cc.receiptNo ,dd.orderno ,dd.itemcode , inv.invname ,kk.CKITEMDESC ) jj ";
DataTable dt = Repository().FindTablePageBySql_Other(SqlText, "MESconnstr", parameter.ToArray(), ref jqgridparam);
return dt;
}
//配料信息表
public DataTable GetList3(string queryJson, ref Pagination jqgridparam) { string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; var queryParam = queryJson.ToJObject(); string type = queryParam["type"].ToString(); OperatorModel oo = NFine.Code.OperatorProvider.Provider.GetCurrent(); List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @" if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_TJRdTrans'))
drop table #Temp_TJRdTrans if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_TJRdTransLog')) drop table #Temp_TJRdTransLog if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_TJResult')) drop table #Temp_TJResult select tt.rdcode 出库单号,tt.invcode 产品编号, tt.rdstatus 业务类型, tt.depname 需求部门,tt.fromstoragecode 所属仓库, tt.mocode 生产工单号,'' 项目号,tt.rduser 制单人,tt.mtime 制单日期 , CASE WHEN isnull(tt.actqty,0) !=0 then '完成' else '待提交' end 状态, tt.rdNO,case when PLANQTY<0 then '物料退料' else '材料出库' end LogType into #Temp_TJRdTrans from ICSRdTransTer tt left join icsmo mo on mo.mocode=tt.mocode and mo.moseq=tt.moseq and mo.workpoint=tt.workpoint where tt.rdtype='材料出库单' AND TT.MTIME >DATEADD(MONTH, -1, GETDATE()) AND TT.WORKPOINT='" + workpoint + @"' and CASE WHEN isnull(tt.actqty,0) !=0 then '已完成' else '未完成' end ='" + type + @"'
SELECT * into #Temp_TJRdTransLog FROM ( select LOG.MUSERNAME,LOG.TransNO,LOG.TransLine,LOG.MTIME
,row_number() over (partition by LOG.BUSINESSCODE,LOG.TransNO,LOG.TransLine order by LOG.LOTNO desc,ID) rn
from ICSWareHouseLotInfoLog LOG WHERE EXISTS(SELECT 1 FROM #Temp_TJRdTrans TT WHERE tt.rdNO =LOG.TransLine AND TT.出库单号=LOG.TransNO AND LOG.BUSINESSCODE=tt.LogType and 状态='完成' ) AND LOG.WORKPOINT='" + workpoint + @"' ) FF WHERE RN=1
select distinct 出库单号,需求部门,生产工单号,制单人, CONVERT(varchar(19), 制单日期, 21) 制单日期,CONVERT(varchar(19), 完成日期, 21) 完成日期,状态 into #Temp_TJResult from ( SELECT tt.*,log.MUSERNAME 审核人,log.mtime 完成日期 FROM #Temp_TJRdTrans tt LEFT JOIN #Temp_TJRdTransLog log on tt.rdNO =LOG.TransLine AND TT.出库单号=LOG.TransNO
) gg ";
DataTable dt = Repository().FindTablePageBySql_OtherTemp(SqlText, " #Temp_TJResult ", @" if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_TJRdTrans'))
drop table #Temp_TJRdTrans if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_TJRdTransLog')) drop table #Temp_TJRdTransLog if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_TJResult')) drop table #Temp_TJResult ",
"MESconnstr", parameter.ToArray(), ref jqgridparam);
return dt;
}
//待入库明细
public DataTable GetList4(string queryJson, ref Pagination jqgridparam) { string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; var queryParam = queryJson.ToJObject(); OperatorModel oo = NFine.Code.OperatorProvider.Provider.GetCurrent(); List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
select * from ( SELECT cc.receiptNo 到货单,dd.orderno 采购订单号,dd.itemcode 料号, inv.invname 物料名称, sum(lot.lotqty) 待入库数量 ,(select top 1 bincode from ICSWareHouseLotInfo info where info.lotno=lot.lotno and info.workpoint=cc.workpoint) 库位,lot.lotno 条码 FROM ICSINVReceipt cc LEFT JOIN ICSINVReceiptDetail dd ON cc.ReceiptNO=dd.ReceiptNO AND dd.workpoint=cc.workpoint LEFT JOIN ICSINVENTORY inv ON inv.invcode=dd.itemcode AND dd.workpoint=inv.workpoint left join icsitemlot lot on lot.TransNO=dd.ReceiptNO AND lot.TransLine=dd.ReceiptLine AND cc.workpoint=lot.workpoint left join ICSWareHouseLotInfolog kk on kk.lotno=lot.lotno and kk.workpoint=cc.workpoint and kk.transtype='收' WHERE 1=1 and kk.lotno is null and lot.IQCStatus= '合格' and cc.mtime >=DATEADD(month, -1,getdate()) and cc.workpoint='" + workpoint + @"' group by cc.receiptNo ,dd.orderno ,dd.itemcode , inv.invname ,lot.lotno ,kk.tostackcode,cc.workpoint ) jj ";
DataTable dt = Repository().FindTablePageBySql_Other(SqlText, "MESconnstr", parameter.ToArray(), ref jqgridparam);
return dt;
}
//生产进度汇总表
public DataTable GetList_WIPJinDu(string queryJson, string filters, ref Pagination jqgridparam) { try { List<DbParameter> parameter = new List<DbParameter>();
#region 过滤条件
string SQLWhere = "";
if (!queryJson.Contains("[]")) { JObject jobject = JObject.Parse(queryJson); JArray array = JArray.Parse(jobject["value"].ToString()); SQLWhere += " and A.SEGCODE in (";
foreach(JObject j in array) { SQLWhere += "'" + j["value"].ToString()+"',"; } SQLWhere= SQLWhere.TrimEnd(','); SQLWhere += ")"; }
#endregion
string SqlText = @" SELECT A.SEGCODE AS 线体,a.MOCODE as 生产订单号,a.MOSEQ as 工单行,a.StartPlanDate as 工单日期,INVPARSETYPE as 产品代码,
a.INVSTD as 规格,a.ITEMCODE as 产品编码,a.pgqty as 计划量,isnull(B.ENDQTY,0) as 产出量, case when convert(decimal,isnull(B.ENDQTY,0))=0 or convert(decimal,isnull(a.pgqty,0))=0 then '0.00' else convert(nvarchar(20), CONVERT(DECIMAL(18,2), convert(decimal,isnull(B.ENDQTY,0))/ convert(decimal,isnull(a.pgqty,0)))*100) end as 完成率值,'' AS 完成率 FROM (select sum(convert(decimal,ISNULL(A.EATTRIBUTE1,0))) as pgqty,SEGCODE,A.MOCODE,A.MOSEQ,B.ITEMCODE,C.INVNAME,C.INVSTD,a.StartPlanDate,C.INVPARSETYPE,B.EATTRIBUTE3 from icsmo2user A inner JOIN ICSMO B ON A.MOCODE=B.MOCODE AND A.MOSEQ=B.MOSEQ LEFT JOIN ICSINVENTORY C ON C.INVCODE=B.ITEMCODE GROUP BY SEGCODE,A.MOCODE,A.MOSEQ,B.ITEMCODE,C.INVNAME,C.INVSTD,a.StartPlanDate,INVPARSETYPE,EATTRIBUTE3)A LEFT JOIN ( SELECT COUNT(*) AS ENDQTY,A.SSCODE,A.MOCODE,A.MOSEQ,SSDESC FROM ( select B.SSCODE,A.MOCODE,A.MOSEQ,C.SSDESC from icssimulation a INNER join ICSONWIP B ON A.RCARD=B.RCARD AND A.RCARDSEQ=B.RCARDSEQ LEFT JOIN ICSSS C ON C.SSCODE=B.SSCODE where a.EATTRIBUTE1='GOOD' and iscom='1')A GROUP BY A.SSCODE,A.MOCODE,A.MOSEQ,A.SSDESC)B ON (A.SEGCODE=B.SSCODE or a.SEGCODE=b.SSDESC) AND A.MOCODE=B.MOCODE AND A.MOSEQ=B.MOSEQ where A.eattribute3='SMT' " + SQLWhere+ @" ORDER BY a.StartPlanDate desc ";
DataTable dt = SqlHelper.GetDataTableBySql(SqlText); // WriteLogFile(SqlText, "看板异常");
dt.Columns.Add("ID", Type.GetType("System.String")); int i = 1; foreach (DataRow dr in dt.Rows) { dr["ID"] = "ID" + i.ToString(); i++; } return dt;
} catch (Exception ex) { WriteLogFile(ex.ToString(), "看板异常"); } return null; }
//项目阶段
public DataTable GetProjectJD() { List<DbParameter> parameter = new List<DbParameter>(); string sql = @" select distinct REPLACE(PROJECTSTAGE, '生产确认表', '待装配') NAME from EXP_PROJECTPRODUCTIONSCHEDULE
where OQC is null and not (PROJECTID>='2117101' and PROJECTID<='2117116') and REPLACE(PROJECTSTAGE, '生产确认表', '待装配') is not null";
DataTable dt = OracleHelper.GetTable(sql, "Oracleconnstr", parameter.ToArray()); return dt; //DataTable tblDatas = new DataTable("Datas");
//tblDatas.Columns.Add("NAME", Type.GetType("System.String"));
//for (int i = 0; i < 5; i++)
//{
// DataRow newRow;
// newRow = tblDatas.NewRow();
// newRow["NAME"] = i.ToString();
// tblDatas.Rows.Add(newRow);
//}
//return tblDatas;
}
//设备类型
public DataTable GetEQPType() { List<DbParameter> parameter = new List<DbParameter>(); string sql = @" select distinct DEVICETYPE NAME from EXP_PROJECTPRODUCTIONSCHEDULE
where OQC is null and not (PROJECTID>='2117101' and PROJECTID<='2117116') and DEVICETYPE is not null ";
DataTable dt = OracleHelper.GetTable(sql, "Oracleconnstr", parameter.ToArray()); return dt; }
//状态
public DataTable GetStatus() { List<DbParameter> parameter = new List<DbParameter>(); string sql = @" select distinct case when PROJECTSTAGE ='FAT完成' then '完成' when PROJECTSTAGE ='FQC' then '完成'
when BEGINDATE like '%-%-%' and TO_DATE(BEGINDATE,'YYYY-MM-DD')-sysdate < 7 and NVL(RTRIM(PROJECTSCHEDULE,'%'),0) <80 then '紧急' else STATUS end NAME from EXP_PROJECTPRODUCTIONSCHEDULE where OQC is null and not (PROJECTID>='2117101' and PROJECTID<='2117116') and case when PROJECTSTAGE ='FAT完成' then '完成' when PROJECTSTAGE ='FQC' then '完成' when BEGINDATE like '%-%-%' and TO_DATE(BEGINDATE,'YYYY-MM-DD')-sysdate < 7 and NVL(RTRIM(PROJECTSCHEDULE,'%'),0) <80 then '紧急' else STATUS end is not null ";
DataTable dt = OracleHelper.GetTable(sql, "Oracleconnstr", parameter.ToArray()); return dt; }
//生产进度-层析柱Qty
public DataTable GetWIPQty1() { try { List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
SELECT sum(case when REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) like '%开始%' or REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) not like '%完成%' then to_number ( QUANTITY ) else 0 end ) WIPQTY, sum(case when REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) not like '%开始%' and REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) like '%完成%' then to_number ( QUANTITY ) else 0 end ) COMQTY, sum(to_number ( QUANTITY ) ) ZQTY, REPLACE( REPLACE( REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ), '完成', '' ), '开始', '' ) PROJECTStr FROM EXP_PROJECTPRODUCTIONSCHEDULE WHERE 1 = 1 and not (PROJECTID>='2117101' and PROJECTID<='2117116') and DEVICETYPE in ('EAC系列') and OQC is null GROUP BY REPLACE( REPLACE( REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ), '完成', '' ), '开始', '' ) HAVING sum(to_number ( QUANTITY ) )>0 ";
DataTable dt = OracleHelper.GetTable(SqlText, "Oracleconnstr", parameter.ToArray());
return dt; } catch (Exception ex) { WriteLogFile(ex.ToString(), "看板异常"); } return null; }
//生产进度-设备Qty
public DataTable GetWIPQty5() { try { List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @" SELECT
sum(case when REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) like '%开始%' or REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) not like '%完成%' then to_number ( QUANTITY ) else 0 end ) WIPQTY, sum(case when REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) not like '%开始%' and REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ) like '%完成%' then to_number ( QUANTITY ) else 0 end ) COMQTY, sum(to_number ( QUANTITY ) ) ZQTY, REPLACE( REPLACE( REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ), '完成', '' ), '开始', '' ) PROJECTStr FROM EXP_PROJECTPRODUCTIONSCHEDULE WHERE 1 = 1 AND NOT ( PROJECTID >= '2117101' AND PROJECTID <= '2117116' ) AND DEVICETYPE NOT IN ( 'SAC系列','EAC系列' ) AND OQC IS NULL GROUP BY REPLACE( REPLACE( REPLACE( PROJECTSTAGE, '生产确认表', '待装配' ), '完成', '' ), '开始', '' ) HAVING sum(to_number ( QUANTITY ) )>0 ";
DataTable dt = OracleHelper.GetTable(SqlText, "Oracleconnstr", parameter.ToArray());
return dt; } catch (Exception ex) { WriteLogFile(ex.ToString(), "看板异常"); } return null; }
//生产进度 柱状图 (在制数 完成数 )
public DataTable GetWIPQty2() {
try { //生产确认表 有值中: 电装开始 有值 就是已开工,电装开始 无值 就是待开工
List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @" SELECT
SUM(CASE WHEN PRODUCTIONCONFIRM IS NOT NULL AND ELECTRICASSEMBLYSTART IS NOT NULL THEN to_number(QUANTITY) ELSE 0 END) YKGQty, SUM(CASE WHEN PRODUCTIONCONFIRM IS NOT NULL AND ELECTRICASSEMBLYSTART IS NULL THEN to_number(QUANTITY) ELSE 0 END) DKGQty
from EXP_PROJECTPRODUCTIONSCHEDULE WHERE 1=1 AND PRODUCTIONCONFIRM IS NOT NULL and not (PROJECTID>='2117101' and PROJECTID<='2117116') and OQC is null ";
DataTable dt = OracleHelper.GetTable(SqlText, "Oracleconnstr", parameter.ToArray());
return dt; } catch (Exception ex) { WriteLogFile(ex.ToString(), "看板异常"); } return null; }
//设备类型在制数
public DataTable GetWIPQty3() {
try { //生产确认表 有值 FQC 无值
List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @" SELECT
SUM( to_number(QUANTITY) ) Qty,nvl(DEVICETYPE,'空设备类型') EQPTypeName from EXP_PROJECTPRODUCTIONSCHEDULE WHERE 1=1 AND PRODUCTIONCONFIRM IS NOT NULL and not (PROJECTID>='2117101' and PROJECTID<='2117116') AND OQC IS NULL GROUP BY DEVICETYPE ";
DataTable dt = OracleHelper.GetTable(SqlText, "Oracleconnstr", parameter.ToArray());
return dt; } catch (Exception ex) { WriteLogFile(ex.ToString(), "看板异常"); } return null; }
//待开工项目(Qty)
public DataTable GetWIPQty4() {
try { //生产确认表 有值 电装开始 无值
List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
SELECT SUM ( to_number ( QUANTITY ) ) Qty, SUBSTR ( BEGINDATE, 0, 4+instr ( SUBSTR ( BEGINDATE, 6, 3 ), '-' ) ) MonthStr FROM EXP_PROJECTPRODUCTIONSCHEDULE WHERE 1 = 1 AND( (ELECTRICASSEMBLYSTART IS NULL AND PRODUCTIONCONFIRM IS NOT NULL and OQC IS NULL ) or PROJECTSTAGE='生产确认表' ) AND BEGINDATE IS NOT NULL and not (PROJECTID>='2117101' and PROJECTID<='2117116') GROUP BY SUBSTR ( BEGINDATE, 0, 4+instr ( SUBSTR ( BEGINDATE, 6, 3 ), '-' ) ), SUBSTR ( BEGINDATE, 0, 4 ), to_number ( SUBSTR ( BEGINDATE, 6, instr ( SUBSTR ( BEGINDATE, 6, 3 ), '-' ) - 1 ) ) ORDER BY SUBSTR ( BEGINDATE, 0, 4 ), to_number ( SUBSTR ( BEGINDATE, 6, instr ( SUBSTR ( BEGINDATE, 6, 3 ), '-' ) - 1 ) ) ";
DataTable dt = OracleHelper.GetTable(SqlText, "Oracleconnstr", parameter.ToArray());
return dt; } catch (Exception ex) { WriteLogFile(ex.ToString(), "看板异常"); } return null; }
//收货进度
public DataTable GetRCVJingDu() { string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
if exists(select* from tempdb..sysobjects where id= object_id('tempdb..#TEMP_ItemCK')) drop table #TEMP_ItemCK
select sum(lotqty) Qty,cktype INTO #TEMP_ItemCK from( select lot.lotno, lot.lotqty, lot.IQCStatus, lot.step, case when lot.step= '优先' and lot.IQCStatus= '' then '优先待检' when isnull(lot.step,'')!='优先' and lot.IQCStatus='' then '待检' when lot.IQCStatus= '合格' then '已检待入' else '' end CKType from ICSINVReceipt cc left join ICSINVReceiptDetail dd on cc.ReceiptNO= dd.ReceiptNO and dd.workpoint= cc.workpoint left join ICSITEMLot lot on lot.mcode= dd.itemcode and lot.TransNO= dd.ReceiptNO and lot.TransLine= dd.ReceiptLine and dd.workpoint= lot.workpoint
where not exists(select 1 from ICSWareHouseLotInfoLog log where log.lotno= lot.lotno) and lot.lotno is not null and cc.workpoint ='" + workpoint + @"' and cc.mtime >=DATEADD(week, -1,getdate()) ) gg where cktype!='' group by cktype
select * from ( SELECT QTY,CKTYPE,cast(CONVERT(DECIMAL(18,2),QTY/(SELECT SUM(QTY) FROM #TEMP_ItemCK )*100) as NVARCHAR) +'%' Qtypercent from #TEMP_ItemCK union all SELECT 0,'优先待检', '0%' Qtypercent where not EXISTS(select 1 from #TEMP_ItemCK where cktype='优先待检') union all SELECT 0,'已检待入', '0%' Qtypercent where not EXISTS(select 1 from #TEMP_ItemCK where cktype='已检待入') union all SELECT 0,'待检', '0%' Qtypercent where not EXISTS(select 1 from #TEMP_ItemCK where cktype='待检') ) ff order by case CKTYPE when '已检待入' then 0 when '优先待检' then 1 when '待检' then 2 else 3 end ";
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null);
return dt; }
//到货数量(item)
public DataTable GetRCVQty(string type) { string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; List<DbParameter> parameter = new List<DbParameter>();
string SqlText = ""; switch (type) { case "日": SqlText = @"
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 SELECT CONVERT( VARCHAR ( 100 ), DATEADD( DAY, number *- 1, getdate( ) ), 23 ) AS 日期 INTO #TEMP_Itemrr_tt2 FROM master.dbo.spt_values WHERE type = 'p' AND number <= 6 AND number >= 0 SELECT SUM( planqty ) QTY, CONVERT ( VARCHAR ( 100 ), mtime, 23 ) 日期 INTO #TEMP_Itemrr_tt FROM ICSINVReceiptDetail WHERE mtime >= CONVERT ( VARCHAR ( 10 ), DATEADD( DAY, - 6, getdate( ) ), 23 ) + ' 00:00:00' AND workpoint = '" + workpoint + @"' GROUP BY CONVERT ( VARCHAR ( 100 ), mtime, 23 ) SELECT substring( aa.日期,6,5) 日期, isnull( bb.qty, 0 ) QTY FROM #TEMP_Itemrr_tt2 aa LEFT JOIN #TEMP_Itemrr_tt bb ON aa.日期 = bb.日期 ORDER BY 1 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 ";
break; case "周": SqlText = @"
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2
SELECT DATEPART(wk,CONVERT( VARCHAR ( 10 ), DATEADD( week, -1*NUMBER, getdate( ) ),23)+' 00:00:00') AS 日期 , CONVERT( VARCHAR ( 4 ), DATEADD( week, -1*NUMBER, getdate( ) ),23) 年 INTO #TEMP_Itemrr_tt2 FROM master.dbo.spt_values WHERE type = 'p' AND number <= 7 AND number >= 0 SELECT SUM( planqty ) QTY, DATEPART(wk, mtime) 日期,CONVERT( VARCHAR ( 4 ),mtime,23) 年 INTO #TEMP_Itemrr_tt FROM ICSINVReceiptDetail WHERE mtime >= CONVERT( VARCHAR ( 10 ), DATEADD( week, -7, getdate( ) ),23)+' 00:00:00' AND workpoint = '" + workpoint + @"' GROUP BY DATEPART(wk, mtime) ,CONVERT( VARCHAR ( 4 ),mtime,23) ORDER BY CONVERT( VARCHAR ( 4 ),mtime,23),DATEPART(wk, mtime)
SELECT aa.日期, isnull( bb.qty, 0 ) QTY FROM #TEMP_Itemrr_tt2 aa LEFT JOIN #TEMP_Itemrr_tt bb ON aa.日期 = bb.日期 AND aa.年 = bb.年 ORDER BY aa.年, aa.日期 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 "; break;
case "月": SqlText = @"
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2
SELECT DATEPART(month,CONVERT( VARCHAR ( 10 ), DATEADD( month, -1*NUMBER, getdate( ) ),23)+' 00:00:00') AS 日期 , CONVERT( VARCHAR ( 4 ), DATEADD( month, -1*NUMBER, getdate( ) ),23) 年 INTO #TEMP_Itemrr_tt2 FROM master.dbo.spt_values WHERE type = 'p' AND number <= 11 AND number >= 0 SELECT SUM( planqty ) QTY, DATEPART(month, mtime) 日期,CONVERT( VARCHAR ( 4 ),mtime,23) 年 INTO #TEMP_Itemrr_tt FROM ICSINVReceiptDetail WHERE mtime >= CONVERT( VARCHAR ( 10 ), DATEADD( month, -11, getdate( ) ),23)+' 00:00:00' AND workpoint = '" + workpoint + @"' GROUP BY DATEPART(month, mtime) ,CONVERT( VARCHAR ( 4 ),mtime,23) ORDER BY CONVERT( VARCHAR ( 4 ),mtime,23),DATEPART(month, mtime)
SELECT aa.日期, isnull( bb.qty, 0 ) QTY FROM #TEMP_Itemrr_tt2 aa LEFT JOIN #TEMP_Itemrr_tt bb ON aa.日期 = bb.日期 AND aa.年 = bb.年 ORDER BY aa.年, aa.日期 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 "; break;
case "年": SqlText = @"
SELECT SUM( planqty ) QTY, CONVERT( VARCHAR ( 4 ),mtime,23) 日期 FROM ICSINVReceiptDetail WHERE workpoint = '" + workpoint + @"' GROUP BY CONVERT( VARCHAR ( 4 ),mtime,23) ORDER BY CONVERT( VARCHAR ( 4 ),mtime,23)
"; break;
}
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null);
return dt; }
//入库数量(item)
public DataTable GetWareInQty(string type) { string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; List<DbParameter> parameter = new List<DbParameter>();
string SqlText = ""; switch (type) { case "日": SqlText = @"
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 SELECT CONVERT( VARCHAR ( 100 ), DATEADD( DAY, number *- 1, getdate( ) ), 23 ) AS 日期 INTO #TEMP_Itemrr_tt2 FROM master.dbo.spt_values WHERE type = 'p' AND number <= 6 AND number >= 0 SELECT SUM( TRANSQTY ) QTY, CONVERT ( VARCHAR ( 100 ), MTIME, 23 ) 日期 INTO #TEMP_Itemrr_tt FROM ICSWareHouseLotInfoLOG log WHERE MTIME >= CONVERT ( VARCHAR ( 10 ), DATEADD( DAY, - 6, getdate( ) ), 23 ) + ' 00:00:00' AND workpoint = '" + workpoint + @"' and log.transtype in ('收','退') GROUP BY CONVERT ( VARCHAR ( 100 ), MTIME, 23 ) SELECT substring( aa.日期,6,5) 日期, isnull( bb.qty, 0 ) QTY FROM #TEMP_Itemrr_tt2 aa LEFT JOIN #TEMP_Itemrr_tt bb ON aa.日期 = bb.日期 ORDER BY 1 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 ";
break; case "周": SqlText = @"
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2
SELECT DATEPART(wk,CONVERT( VARCHAR ( 10 ), DATEADD( week, -1*NUMBER, getdate( ) ),23)+' 00:00:00') AS 日期 , CONVERT( VARCHAR ( 4 ), DATEADD( week, -1*NUMBER, getdate( ) ),23) 年 INTO #TEMP_Itemrr_tt2 FROM master.dbo.spt_values WHERE type = 'p' AND number <= 7 AND number >= 0 SELECT SUM( transqty ) QTY, DATEPART(wk, mtime) 日期,CONVERT( VARCHAR ( 4 ),mtime,23) 年 INTO #TEMP_Itemrr_tt FROM ICSWareHouseLotInfolog log WHERE mtime >= CONVERT( VARCHAR ( 10 ), DATEADD( week, -7, getdate( ) ),23)+' 00:00:00' AND workpoint = '" + workpoint + @"' and log.transtype in ('收','退') GROUP BY DATEPART(wk, mtime) ,CONVERT( VARCHAR ( 4 ),mtime,23) ORDER BY CONVERT( VARCHAR ( 4 ),mtime,23),DATEPART(wk, mtime)
SELECT aa.日期, isnull( bb.qty, 0 ) QTY FROM #TEMP_Itemrr_tt2 aa LEFT JOIN #TEMP_Itemrr_tt bb ON aa.日期 = bb.日期 AND aa.年 = bb.年 ORDER BY aa.年, aa.日期 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 "; break;
case "月": SqlText = @"
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2
SELECT DATEPART(month,CONVERT( VARCHAR ( 10 ), DATEADD( month, -1*NUMBER, getdate( ) ),23)+' 00:00:00') AS 日期 , CONVERT( VARCHAR ( 4 ), DATEADD( month, -1*NUMBER, getdate( ) ),23) 年 INTO #TEMP_Itemrr_tt2 FROM master.dbo.spt_values WHERE type = 'p' AND number <= 11 AND number >= 0 SELECT SUM( transqty ) QTY, DATEPART(month, mtime) 日期,CONVERT( VARCHAR ( 4 ),mtime,23) 年 INTO #TEMP_Itemrr_tt FROM ICSWareHouseLotInfolog log WHERE mtime >= CONVERT( VARCHAR ( 10 ), DATEADD( month, -11, getdate( ) ),23)+' 00:00:00' AND workpoint = '" + workpoint + @"' and log.transtype in ('收','退') GROUP BY DATEPART(month, mtime) ,CONVERT( VARCHAR ( 4 ),mtime,23) ORDER BY CONVERT( VARCHAR ( 4 ),mtime,23),DATEPART(month, mtime)
SELECT aa.日期, isnull( bb.qty, 0 ) QTY FROM #TEMP_Itemrr_tt2 aa LEFT JOIN #TEMP_Itemrr_tt bb ON aa.日期 = bb.日期 AND aa.年 = bb.年 ORDER BY aa.年, aa.日期 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt' ) ) DROP TABLE #TEMP_Itemrr_tt
IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = object_id( 'tempdb..#TEMP_Itemrr_tt2' ) ) DROP TABLE #TEMP_Itemrr_tt2 "; break;
case "年": SqlText = @"
SELECT SUM( transqty ) QTY, CONVERT( VARCHAR ( 4 ),mtime,23) 日期 FROM ICSWareHouseLotInfolog log WHERE workpoint = '" + workpoint + @"' and log.transtype in ('收','退') GROUP BY CONVERT( VARCHAR ( 4 ),mtime,23) ORDER BY CONVERT( VARCHAR ( 4 ),mtime,23)
"; break;
}
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null);
return dt; }
//配料进度
public DataTable GetPeiLiaoJingDu() { string workpoint = ConfigurationManager.ConnectionStrings["WorkPointCode"].ConnectionString; List<DbParameter> parameter = new List<DbParameter>(); string SqlText = @"
select UnDoQty, DoneQty, case when DoneQty + UnDoQty=0 then '0%' else cast(Convert(decimal(18, 2), DoneQty / (DoneQty + UnDoQty) * 100) as NVARCHAR) + '%' end DoneQtyPer, case when DoneQty + UnDoQty=0 then '0%' else cast(Convert(decimal(18, 2), UnDoQty / (DoneQty + UnDoQty) * 100) as NVARCHAR) + '%' end UnDoQtyPer from( select isnull(sum(case when isnull(actqty, 0) = 0 then planqty else 0 end),0) UnDoQty, isnull(sum(case when isnull(actqty, 0) = 0 then 0 else actqty end),0) DoneQty
from ICSRdTransTer where RdType = '材料出库单' and planqty > 0 and workpoint ='" + workpoint + @"' and mtime >=DATEADD(MONTH, -1,getdate()) ) gg ";
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); DataTable retdd = new DataTable(); retdd.Columns.Add("cktype", Type.GetType("System.String")); retdd.Columns.Add("Qty", Type.GetType("System.Decimal")); retdd.Columns.Add("Qtypercent", Type.GetType("System.String"));
if (dt != null && dt.Rows.Count > 0) { DataRow newRow = retdd.NewRow(); newRow["cktype"] = "待配料"; newRow["Qty"] = Convert.ToDecimal(dt.Rows[0]["UnDoQty"].ToString()); newRow["Qtypercent"] = dt.Rows[0]["UnDoQtyPer"].ToString(); retdd.Rows.Add(newRow);
DataRow newRow2 = retdd.NewRow(); newRow2["cktype"] = "已配料"; newRow2["Qty"] = Convert.ToDecimal(dt.Rows[0]["DoneQty"].ToString()); newRow2["Qtypercent"] = dt.Rows[0]["DoneQtyPer"].ToString(); retdd.Rows.Add(newRow2); } else { DataRow newRow = retdd.NewRow(); newRow["cktype"] = "待配料"; newRow["Qty"] = 0; newRow["Qtypercent"] = "0%"; retdd.Rows.Add(newRow);
DataRow newRow2 = retdd.NewRow(); newRow2["cktype"] = "已配料"; newRow2["Qty"] = 0; newRow2["Qtypercent"] = "0%"; retdd.Rows.Add(newRow2); }
return retdd; }
public DataTable GetSScode(string cookie) { string sql = "select distinct sscode as name,ssdesc as value,'' as selected from ICSSS"; DataTable table= Repository().GetDataTableBySql_Other(sql, "MESconnstr", null); foreach (DataRow row in table.Rows) { if (!string.IsNullOrEmpty(cookie)) { JObject jobject = JObject.Parse(cookie); JArray array = JArray.Parse(jobject["value"].ToString()); foreach (JObject j in array) { if (j["value"].ToString() == row["value"].ToString()) row["selected"] = "true"; }
}
} table.AcceptChanges(); return table; }
public static void WriteLogFile(string input, string txtName) { try { string logAdress = "C:\\看板日志" + "\\"; if (!System.IO.Directory.Exists(logAdress)) { System.IO.Directory.CreateDirectory(logAdress);//不存在就创建目录
}
string adress = logAdress + txtName; if (!System.IO.Directory.Exists(adress)) { System.IO.Directory.CreateDirectory(adress);//不存在就创建目录
}
// string logAdress = ConfigurationManager.AppSettings["logAdress"].ToString();
/**/ ///指定日志文件的目录
string fname = adress + "\\" + "log" + DateTime.Now.ToString("yy-MM-dd") + ".txt"; /**/ ///定义文件信息对象
FileInfo finfo = new FileInfo(fname);
if (!finfo.Exists) { FileStream fs; fs = File.Create(fname); fs.Close(); finfo = new FileInfo(fname); }
/**/ ///判断文件是否存在以及是否大于2K
if (finfo.Length > 1024 * 1024 * 10) { /**/ ///文件超过10MB则重命名
File.Move(logAdress + "\\Log\\" + txtName + ".txt", Directory.GetCurrentDirectory() + DateTime.Now.TimeOfDay + "\\Log\\" + txtName + ".txt"); /**/ ///删除该文件
//finfo.Delete();
} //finfo.AppendText();
/**/ ///创建只写文件流
using (FileStream fs = finfo.OpenWrite()) { /**/ ///根据上面创建的文件流创建写数据流
StreamWriter w = new StreamWriter(fs);
/**/ ///设置写数据流的起始位置为文件流的末尾
///设置写数据流的起始位置为文件流的末尾
w.BaseStream.Seek(0, SeekOrigin.End);
w.WriteLine("*****************Start*****************"); w.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); /**/ ///写入当前系统时间并换行
/**/ ///写入日志内容并换行
w.WriteLine(input);
/**/ ///写入------------------------------------“并换行
w.WriteLine("------------------END------------------------");
/**/ ///清空缓冲区内容,并把缓冲区内容写入基础流
w.Flush();
/**/ ///关闭写数据流
w.Close(); } } catch (Exception ex) { }
}
public string ConvertDataTableToJson(DataTable dt) { StringBuilder sbs = new StringBuilder(); if (dt.Rows.Count > 0)//如果有记录
{ sbs.Append("{'" + dt.TableName + "':["); string str = ""; foreach (DataRow dr in dt.Rows)//开始拼
{ string result = ""; foreach (DataColumn dc in dt.Columns) { result += string.Format(",'{0}':'{1}'", dc.ColumnName, dr[dc.ColumnName]); } result = result.Substring(1); result = ",{" + result + "}"; str += result; } str = str.Substring(1); sbs.Append(str); sbs.Append("]}"); } else//如果没有记录
{ sbs.Append(""); } return sbs.ToString(); }
#region 执行大看板
public DataTable GetZhiXing_MO(string ItemNumber) { string SqlText = ""; SqlText = @"
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempMOComQty')) drop table #TempMOComQty select dd.mocode,sum(dd.rcardqty) Qty into #TempMOComQty from ICSMO2RCARD dd where exists(select 1 from ICSAIODATA ii where ii.snno=dd.rcard ) group by dd.mocode
select mo.mocode 生产订单,inv.invname 产品名称, Convert(decimal(18,1),mo.moplanqty) 计划数量,Convert(decimal(18,1),isnull(QQ.qty,0)) 完成数量, CONVERT(varchar(10), mo.MOPLANENDDATE , 21) 计划完工日期, cast(Convert(decimal(18,2),isnull(QQ.qty,0)*1.00/mo.moplanqty*100) as NVARCHAR)+'%' 生产进度 from icsmo mo left join #TempMOComQty QQ on mo.mocode=qq.mocode left join ICSINVENTORY inv on inv.invcode=mo.itemcode where isnull(QQ.qty,0)<mo.moplanqty and qq.mocode is not null and MO.itemcode like '" + ItemNumber + @"%' if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempMOComQty')) drop table #TempMOComQty ";
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null);
return dt; }
public DataTable GetZhiXing_OQC( ) {
string SqlText = "";
SqlText = @"
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempIPPCC')) drop table #TempIPPCC if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempMonthcc')) drop table #TempMonthcc declare @begin datetime,@end datetime set @end=GETDATE() declare @months int set @months=6 select convert(varchar(7),DATEADD(month,number*-1+1,@end) ,120) AS 月份 into #TempMonthcc from master.dbo.spt_values where type='p' AND number<=@months and number>=1 order by 1 select count(1) Qty,result,月份 into #TempIPPCC from ( select distinct ccode, invcode ,result,convert(varchar(7),mtime,120) 月份
from ICSOQCLotNo where mtime>=DATEADD(month,DATEDIFF(month,0,DATEADD(mm, -5, GETDATE() )),0) and result in('合格','不合格') ) dd group by 月份,result
select isnull( case when isnull(gg.QtyAll,0) =0 then 0 else Convert(decimal(18,2), (isnull(gg.QtyAll,0)-isnull(FF.QtyNG,0))*1.00/gg.QtyAll*100) end ,0) PercentNum, cc.月份 FROM #TempMonthcc cc left join (select sum(qty) QtyAll,月份 from #TempIPPCC hh group by 月份 ) GG on cc.月份=gg.月份 left join (select isnull(sum(qty),0) QtyNG,月份 from #TempIPPCC hh where result='不合格' group by 月份 ) ff on cc.月份=ff.月份 ORDER BY cc.月份 if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempIPPCC')) drop table #TempIPPCC if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempMonthcc')) drop table #TempMonthcc ";
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null);
return dt; }
public DataTable GetZhiXing_RCVUnInWare() {
string SqlText = "";
SqlText = @"
select A.CCODE 到货单号, B.LOTNO,a.cInvCode as 物料编码,C.INVSTD 规格型号,C.INVNAME 物料名称,b.transno 采购订单号, A.iQuantity AS 数量,A.STNO 送货单号 ,CONVERT(varchar(100), a.MTime, 23) MTime , STUFF((select',' + MUSERName from (SELECT DISTINCT MUSERName FROM ICSOQCLotNo d where D.CCODE=a.cCode and d.InvCode=a.cInvCode ) DD for xml path('')),1,1,'') 检验人 from ICSPOArrive a with(nolock) inner join icsitemlot b with(nolock) on a.LOTNO=b.LotNO LEFT JOIN ICSINVENTORY C with(nolock) ON C.INVCODE = A.cInvCode where EXISTS(select 1 from ICSOQCLotNo d with(nolock) where D.CCODE=a.cCode and d.InvCode=a.cInvCode and result='合格' ) and not EXISTS(select 1 from ICSWareHouseLotInfoLog ll with(nolock) where ll.lotno=a.lotno and ll.TransType='收') order by A.CCODE,a.cInvCode,B.LOTNO ";
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null);
return dt; } #endregion
} }
|