| | |
| | | try |
| | | { |
| | | //获取产品报工top5信息 |
| | | sql = @"select top 5 A.partname,isnull(sum(A.good_qty),0) as good_qty from( |
| | | select M.partname,A.good_qty from TK_Wrk_Record A |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TMateriel_Info M on A.materiel_code=M.partcode |
| | | where A.style='B' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0 |
| | | union all |
| | | select M.partname,A.sqty as good_qty from TK_Wrk_OutRecord A |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TMateriel_Info M on A.materiel_code=M.partcode |
| | | where A.style='S' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0 |
| | | ) as A group by A.partname order by good_qty desc"; |
| | | sql = @"select top 5 A.org_name as wkshname,A.name as linename,A.partname,isnull(sum(A.good_qty),0) as good_qty from( |
| | | select W.org_name,E.name,M.partname,A.good_qty from TK_Wrk_Record A |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TMateriel_Info M on A.materiel_code=M.partcode |
| | | inner join TEqpInfo E on A.eqp_code=E.code |
| | | inner join TOrganization W on E.wksp_code=W.org_code and W.description='W' |
| | | where A.style='B' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0 |
| | | union all |
| | | select C.name as linename,'' as wkshname,M.partname,A.sqty as good_qty from TK_Wrk_OutRecord A |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TMateriel_Info M on A.materiel_code=M.partcode |
| | | inner join TCustomer C on A.wx_code=C.code and C.btype='WX' |
| | | where A.style='S' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0 |
| | | ) as A group by A.org_name,A.name,A.partname order by good_qty desc"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | try |
| | | { |
| | | //获取报工不良top5信息 |
| | | sql = @"select isnull(COUNT(checkitem_name),0) cont,checkitem_name from TStepCheckRecordSub where DateDiff(dd,lm_date,getdate())<=7 |
| | | group by checkitem_name order by cont desc"; |
| | | sql = @"select isnull(COUNT(B.name),0) cont,B.name |
| | | from CSR_WorkRecord_Defect A |
| | | inner join TDefect B on A.defect_code=B.code |
| | | where DateDiff(dd,A.lm_date,getdate())<=7 |
| | | group by B.name order by cont desc"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[采购订单跟踪管理看板,左上本月采购订单数、本月采购进货单数、本月采购入库单数] |
| | | public static ToMessage PurchaseLeftTop() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | //获取本月采购订单数、本月采购进货单数、本月采购入库单数 |
| | | sql = @"select * from h_v_DDKanBan_PurchaseLeftTop "; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[采购订单跟踪管理看板,左下采购订单跟踪列表] |
| | | public static ToMessage PurchaseLeftBottom() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | //获取采购订单跟踪列表 |
| | | sql = @"select * from h_v_DDKanBan_PurchaseLeftBottom "; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[采购订单跟踪管理看板,右侧Top] |
| | | public static ToMessage PurchaseRight() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | //获取采购订单跟踪列表 |
| | | sql = @"select * from h_v_DDKanBan_PurchaseRight "; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |