| | |
| | | |
| | | |
| | | #region[生产进度报表] |
| | | public static ToMessage ProductionScheduleReportSearch(string status, string wocode,string wkshopcode,string wkshopname, string partcode, string partname, string partspec, string opendate, string closedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage ProductionScheduleReportSearch(string status, string wkshopcode, string wocode, string partcode, string partname, string partspec, string opendate, string closedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code like '%'+@wkshopcode+'%' "; |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wkshopname != "" && wkshopname != null) |
| | | { |
| | | search += "and AA.wkshp_name like '%'+@wkshopname+'%' "; |
| | | dynamicParams.Add("@wkshopname", wkshopname); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | |
| | | where " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | #endregion |
| | | |
| | | #region[生产进度报表导出] |
| | | public static ToMessage ProductionScheduleReportExcelSearch(string status, string wocode, string wkshopcode, string wkshopname, string partcode, string partname, string partspec, string opendate, string closedate) |
| | | public static ToMessage ProductionScheduleReportExcelSearch(string status, string wkshopcode, string wocode,string partcode, string partname, string partspec, string opendate, string closedate) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code like '%'+@wkshopcode+'%' "; |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wkshopname != "" && wkshopname != null) |
| | | { |
| | | search += "and AA.wkshp_name like '%'+@wkshopname+'%' "; |
| | | dynamicParams.Add("@wkshopname", wkshopname); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | |
| | | data.TableName = "Table"; //设置DataTable的名称 |
| | | string msg = DownLoad.DataTableToExcel(data, "生产进度报表"); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = msg; |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | |
| | | |
| | | #region[班组工资报表记录查询] |
| | | public static ToMessage GroupSalaryReportSearch(string compute, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage GroupSalaryReportSearch(string compute,string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | { |
| | | search += "and P.isend=@isend "; |
| | | dynamicParams.Add("@isend", "Y"); |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and K.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select distinct A.id,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,A.task_qty,G.usergroupcode,G.usergroupname,A.good_qty, |
| | | var sql = @"select distinct A.id,K.wkshp_code,F.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,A.task_qty,G.usergroupcode,G.usergroupname,A.good_qty, |
| | | isnull(P.stepprice,0) as unprice,A.good_qty*isnull(P.stepprice,0) as usermoney,U.username as lm_user,A.lm_date,B.report_date |
| | | from TK_Wrk_Record A |
| | | inner join TK_Wrk_RecordSub B on A.id=B.m_id |
| | |
| | | left join TMateriel_Info M on A.materiel_code=M.partcode |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TUser U on A.lm_user=U.usercode |
| | | left join TOrganization F on K.wkshp_code=F.torg_code |
| | | where B.usergroup_code<>'' and A.style='B' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | dynamicParams.Add("@id", id); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | #endregion |
| | | |
| | | #region[班组工资报表记录导出] |
| | | public static ToMessage GroupSalaryReportExcelSearch(string compute, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate) |
| | | public static ToMessage GroupSalaryReportExcelSearch(string compute,string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | { |
| | | search += "and P.isend=@isend "; |
| | | dynamicParams.Add("@isend", "Y"); |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and K.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | |
| | | } |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select distinct A.wo_code as 工单编号,M.partcode as 产品编码,M.partname as 产品名称,M.partspec as 产品规格, |
| | | var sql = @"select distinct K.wkshp_code as 车间编码,F.torg_name as 车间名称, A.wo_code as 工单编号,M.partcode as 产品编码,M.partname as 产品名称,M.partspec as 产品规格, |
| | | T.stepcode as 工序编码,T.stepname as 工序名称,A.task_qty as 任务数量,G.usergroupcode as 班组编码,G.usergroupname as 班组名称, |
| | | A.good_qty as 报工数量,isnull(P.stepprice,0) as 工序单价,A.good_qty*isnull(P.stepprice,0) as 计件工资,U.username as 操作人员,A.lm_date as 操作时间,B.report_date as 报工时间 |
| | | from TK_Wrk_Record A |
| | |
| | | left join TMateriel_Info M on A.materiel_code=M.partcode |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TUser U on A.lm_user=U.usercode |
| | | left join TOrganization F on K.wkshp_code=F.torg_code |
| | | where B.usergroup_code<>'' and A.style='B' " + search; |
| | | DataTable data = DapperHelper.selectdata(sql, dynamicParams); |
| | | data.TableName = "Table"; //设置DataTable的名称 |
| | | string msg = DownLoad.DataTableToExcel(data, "班组计件工资报表"); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = msg; |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | |
| | | |
| | | #region[人员工资明细报表] |
| | | public static ToMessage PeopleSalaryReportSearch(string compute, string wocode, string partcode, string partname, string partspec,string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage PeopleSalaryReportSearch(string compute,string wkshopcode, string wocode, string partcode, string partname, string partspec,string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | { |
| | | search += "and AA.isend=@isend "; |
| | | dynamicParams.Add("@isend", "Y"); |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | select M.wkshp_code,F.torg_name as wkshp_name,A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | A.task_qty,B.report_qty,isnull(A.step_price,0) as step_price,(B.report_qty*isnull(A.step_price,0)) as moneys, |
| | | B.report_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | |
| | | left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TMateriel_Info P on A.materiel_code=P.partcode |
| | | left join TOrganization F on M.wkshp_code=F.torg_code |
| | | where A.style='B' and B.style='B' and A.verify='Y' and B.usergroup_code='' |
| | | union all |
| | | select A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | select M.wkshp_code,F.torg_name as wkshp_name,A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | M.plan_qty as task_qty,B.sqty as report_qty,isnull(A.step_price,0) as step_price,(B.sqty*isnull(A.step_price,0)) as moneys, |
| | | B.in_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | |
| | | left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code |
| | | left join TStep S on A.step_code = S.stepcode |
| | | left join TMateriel_Info P on A.materiel_code = P.partcode |
| | | left join TOrganization F on M.wkshp_code=F.torg_code |
| | | where A.style = 'S' and B.style = 'S' and A.verify='Y' |
| | | ) as AA |
| | | where " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | #endregion |
| | | |
| | | #region[人员工资明细报表导出] |
| | | public static ToMessage PeopleSalaryReportSearch(string compute, string wocode, string partcode, string partname, string partspec, string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate) |
| | | public static ToMessage PeopleSalaryReportSearch(string compute,string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | { |
| | | search += "and AA.isend=@isend "; |
| | | dynamicParams.Add("@isend", "Y"); |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | |
| | | search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select AA.wo_code as '工单号',AA.partcode as '产品编码',AA.partname '产品名称',AA.partspec as '规格型号',AA.step_seq as '工序序号', |
| | | var sql = @"select AA.wkshp_code as 车间编码,AA.wkshp_name as 车间名称,AA.wo_code as '工单号',AA.partcode as '产品编码',AA.partname '产品名称',AA.partspec as '规格型号',AA.step_seq as '工序序号', |
| | | AA.step_code as '工序编码',AA.stepname as '工序名称',(case when AA.steptype='Z' then '自制' else '外协' end) as '工序类型',AA.task_qty as '任务数量',AA.report_qty as '报工数量', |
| | | AA.step_price as '工序单价',AA.moneys as '计件工资',AA.usercode as '报工人员编号',AA.username as '报工人员名称',AA.report_date as '报工时间' |
| | | from( |
| | | select A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | select M.wkshp_code,F.torg_name as wkshp_name,A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | A.task_qty,B.report_qty,isnull(A.step_price,0) as step_price,(B.report_qty*isnull(A.step_price,0)) as moneys, |
| | | B.report_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | |
| | | left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TMateriel_Info P on A.materiel_code=P.partcode |
| | | left join TOrganization F on M.wkshp_code=F.torg_code |
| | | where A.style='B' and B.style='B' and A.verify='Y' and B.usergroup_code='' |
| | | union all |
| | | select A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | select M.wkshp_code,F.torg_name as wkshp_name,A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend, |
| | | M.plan_qty as task_qty,B.sqty as report_qty,isnull(A.step_price,0) as step_price,(B.sqty*isnull(A.step_price,0)) as moneys, |
| | | B.in_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | |
| | | left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code |
| | | left join TStep S on A.step_code = S.stepcode |
| | | left join TMateriel_Info P on A.materiel_code = P.partcode |
| | | left join TOrganization F on M.wkshp_code=F.torg_code |
| | | where A.style = 'S' and B.style = 'S' and A.verify='Y' |
| | | ) as AA |
| | | where " + search; |
| | |
| | | data.TableName = "Table"; //设置DataTable的名称 |
| | | string msg = DownLoad.DataTableToExcel(data, "人员工资明细报表"); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = msg; |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | |
| | | |
| | | #region[委外报表记录查询] |
| | | public static ToMessage OutSourceReportSearch(string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage OutSourceReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and P.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and A.wo_code like '%'+@wocode+'%' "; |
| | |
| | | search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,C.code,C.name,(case when A.style='F' then '发料' when A.style='S' then '收料' end) as style, |
| | | var sql = @"select P.wkshp_code,G.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,C.code,C.name,(case when A.style='F' then '发料' when A.style='S' then '收料' end) as style, |
| | | A.fqty,A.sqty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,U.username as out_person,B.out_time,T.username as in_person,B.in_time |
| | | from TK_Wrk_OutRecord A |
| | | inner join TK_Wrk_OutRecordSub B on A.id=B.m_id |
| | | left join TK_Wrk_Man P on A.wo_code=P.wo_code |
| | | left join TOrganization G on P.wkshp_code=G.torg_code |
| | | left join TMateriel_Info M on A.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TCustomer C on A.wx_code=C.code |
| | |
| | | where " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | #endregion |
| | | |
| | | #region[委外报表记录导出] |
| | | public static ToMessage OutSourceReportExcelSearch(string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate) |
| | | public static ToMessage OutSourceReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and P.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and A.wo_code like '%'+@wocode+'%' "; |
| | |
| | | search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.wo_code as '工单编号',M.partcode as '产品编码',M.partname as '产品名称',M.partspec as '产品规格',S.stepcode as '工序编码',S.stepname as '工序名称', |
| | | var sql = @"select P.wkshp_code as 车间编码,G.torg_name as 车间名称,A.wo_code as '工单编号',M.partcode as '产品编码',M.partname as '产品名称',M.partspec as '产品规格',S.stepcode as '工序编码',S.stepname as '工序名称', |
| | | C.code as '外协供方编码',C.name as '外协供方名称',(case when A.style='F' then '发料' when A.style='S' then '收料' end) as '操作类型', |
| | | A.fqty as '发料数量',A.sqty as '收料数量',A.ng_qty as '不良数量',A.laborbad_qty as '工废数量',A.materielbad_qty as '料废数量',U.username as '发料人员',B.out_time as '发料时间', |
| | | T.username as '收料人员',B.in_time as '收料时间' |
| | | from TK_Wrk_OutRecord A |
| | | inner join TK_Wrk_OutRecordSub B on A.id=B.m_id |
| | | left join TK_Wrk_Man P on A.wo_code=P.wo_code |
| | | left join TOrganization G on P.wkshp_code=G.torg_code |
| | | left join TMateriel_Info M on A.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TCustomer C on A.wx_code=C.code |
| | |
| | | data.TableName = "Table"; //设置DataTable的名称 |
| | | string msg = DownLoad.DataTableToExcel(data, "委外报工记录报表"); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = msg; |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | |
| | | |
| | | #region[不良明细报表] |
| | | public static ToMessage DefectDetailsReportSearch(string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage DefectDetailsReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and AA.wo_code like '%'+@wocode+'%' "; |
| | |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | select W.wkshp_code,G.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | A.defect_code, |
| | | STUFF((SELECT ',' + F.name |
| | | FROM TDefect F |
| | |
| | | A.style,U.username as lm_user,A.lm_date |
| | | from CSR_WorkRecord_Defect A |
| | | inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code |
| | | left join TK_Wrk_Man W on A.wo_code=W.wo_code |
| | | left join TOrganization G on W.wkshp_code=G.torg_code |
| | | left join TMateriel_Info M on A.partnumber=M.partcode |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TUser U on A.lm_user=U.usercode |
| | |
| | | where " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | #endregion |
| | | |
| | | #region[不良明细报表导出] |
| | | public static ToMessage DefectDetailsReportExcelSearch(string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate) |
| | | public static ToMessage DefectDetailsReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and AA.wo_code like '%'+@wocode+'%' "; |
| | |
| | | search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select AA.wo_code as 工单编号,AA.partcode as 产品编码,AA.partname as 产品名称,AA.partspec as 产品规格,AA.stepcode as 工序编码, |
| | | var sql = @"select AA.wkshp_code as 车间编码,AA.wkshp_name as 车间名称,AA.wo_code as 工单编号,AA.partcode as 产品编码,AA.partname as 产品名称,AA.partspec as 产品规格,AA.stepcode as 工序编码, |
| | | AA.stepname as 工序名称,AA.plan_qty as 任务数量,AA.defect_qty as 不良数量,AA.defect_code as 缺陷代码,AA.defect_name as 缺陷名称, |
| | | (case when AA.style='B' then '报工' when AA.style='S' then '收料' end) as '操作类型',AA.lm_user as 操作人员,AA.lm_date as 操作时间 |
| | | from( |
| | | select A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | select W.wkshp_code,G.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | A.defect_code, |
| | | STUFF((SELECT ',' + F.name |
| | | FROM TDefect F |
| | |
| | | A.style,U.username as lm_user,A.lm_date |
| | | from CSR_WorkRecord_Defect A |
| | | inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code |
| | | left join TK_Wrk_Man W on A.wo_code=W.wo_code |
| | | left join TOrganization G on W.wkshp_code=G.torg_code |
| | | left join TMateriel_Info M on A.partnumber=M.partcode |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TUser U on A.lm_user=U.usercode |
| | |
| | | data.TableName = "Table"; //设置DataTable的名称 |
| | | string msg = DownLoad.DataTableToExcel(data, "不良明细报表"); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = msg; |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | |
| | | |
| | | #region[维修明细报表] |
| | | public static ToMessage MaintenanceDetailsReportSearch(string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MaintenanceDetailsReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and AA.wo_code like '%'+@wocode+'%' "; |
| | |
| | | search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select AA.wo_code,AA.partcode,AA.partname,AA.partspec,AA.stepcode,AA.stepname,(case when AA.style='B' then '报工' when AA.style='S' then '收料' end) as style, |
| | | var sql = @"select AA.wkshp_code,AA.wkshp_name,AA.wo_code,AA.partcode,AA.partname,AA.partspec,AA.stepcode,AA.stepname,(case when AA.style='B' then '报工' when AA.style='S' then '收料' end) as style, |
| | | AA.plan_qty,AA.repair_qty,AA.laborbad_qty,AA.materielbad_qty,AA.defect_code,AA.defect_name,AA.lm_user,AA.lm_date |
| | | from( |
| | | select F.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,F.style,P.plan_qty,F.repair_qty,F.laborbad_qty,F.materielbad_qty,F.defect_code, |
| | | select W.wkshp_code,G.torg_name as wkshp_name,F.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,F.style,P.plan_qty,F.repair_qty,F.laborbad_qty,F.materielbad_qty,F.defect_code, |
| | | defect_name = STUFF(( SELECT ',' + T.name |
| | | FROM TDefect as T |
| | | where PATINDEX('%,' + RTRIM(T.code) + ',%',',' + F.defect_code + ',')>0 |
| | |
| | | FOR XML PATH('')), 1, 1,''),U.username as lm_user,F.lm_date |
| | | from CSR_WorkRecord_DefectHandle as F |
| | | inner join TK_Wrk_Step P on F.wo_code=P.wo_code and F.step_code=P.step_code |
| | | left join TK_Wrk_Man W on F.wo_code=W.wo_code |
| | | left join TOrganization G on W.wkshp_code=G.torg_code |
| | | left join TMateriel_Info M on F.partnumber=M.partcode |
| | | left join TStep S on F.step_code=S.stepcode |
| | | left join TUser U on F.lm_user=U.usercode |
| | |
| | | where " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | |
| | | #endregion |
| | | |
| | | #region[维修明细报表导出] |
| | | public static ToMessage MaintenanceDetailsReportExcelSearch(string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate) |
| | | public static ToMessage MaintenanceDetailsReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and AA.wo_code like '%'+@wocode+'%' "; |
| | |
| | | search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select AA.wo_code as 工单编号,AA.partcode as 产品编码,AA.partname as 产品名称,AA.partspec as 产品规格,AA.stepcode as 工序编码,AA.stepname as 工序名称, |
| | | var sql = @"select AA.wkshp_code as 车间编码,AA.wkshp_name as 车间名称,AA.wo_code as 工单编号,AA.partcode as 产品编码,AA.partname as 产品名称,AA.partspec as 产品规格,AA.stepcode as 工序编码,AA.stepname as 工序名称, |
| | | (case when AA.style='B' then '报工' when AA.style='S' then '收料' end) as 操作类型, |
| | | AA.plan_qty as 任务数量,AA.repair_qty as 维修数量,AA.laborbad_qty as 工废数量,AA.materielbad_qty as 料废数量,AA.defect_name as 缺陷名称,AA.lm_user as 维修人员,AA.lm_date as 维修时间 |
| | | from( |
| | | select F.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,F.style,P.plan_qty,F.repair_qty,F.laborbad_qty,F.materielbad_qty,F.defect_code, |
| | | select W.wkshp_code,G.torg_name as wkshp_name,F.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,F.style,P.plan_qty,F.repair_qty,F.laborbad_qty,F.materielbad_qty,F.defect_code, |
| | | defect_name = STUFF(( SELECT ',' + T.name |
| | | FROM TDefect as T |
| | | where PATINDEX('%,' + RTRIM(T.code) + ',%',',' + F.defect_code + ',')>0 |
| | |
| | | FOR XML PATH('')), 1, 1,''),U.username as lm_user,F.lm_date |
| | | from CSR_WorkRecord_DefectHandle as F |
| | | inner join TK_Wrk_Step P on F.wo_code=P.wo_code and F.step_code=P.step_code |
| | | left join TK_Wrk_Man W on F.wo_code=W.wo_code |
| | | left join TOrganization G on W.wkshp_code=G.torg_code |
| | | left join TMateriel_Info M on F.partnumber=M.partcode |
| | | left join TStep S on F.step_code=S.stepcode |
| | | left join TUser U on F.lm_user=U.usercode |
| | |
| | | data.TableName = "Table"; //设置DataTable的名称 |
| | | string msg = DownLoad.DataTableToExcel(data, "维修明细报表"); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = msg; |
| | | } |
| | |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |