| | |
| | | { |
| | | string sql = ""; |
| | | string search = ""; |
| | | List<ShopTopLeft> list = new List<ShopTopLeft>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | if (json == null || json.Count <= 0) //产线编码不为空 |
| | | if (json == null || json.Count>0) //产线编码不为空 |
| | | { |
| | | List<ShopTopLeft> list = new List<ShopTopLeft>(); |
| | | //获取产线信息 |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | |
| | | { |
| | | line.lineworkcont=data.Rows[0]["CONT"].ToString(); //产线总单量 |
| | | line.children = new List<TreeOne>(); |
| | | //查询产线下工单信息 |
| | | sql = @"select distinct E.saleOrderCode,P.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname from TFlw_Rteqp A |
| | | inner join TFlw_Rtdt B on A.step_code=B.step_code |
| | | inner join TK_Wrk_Man P on B.rout_code=P.route_code |
| | | //查询产线下已开工的加工单信息 |
| | | sql = @"select distinct E.saleOrderCode,A.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname from TK_Wrk_Record A |
| | | inner join TK_Wrk_Man P on A.wo_code=P.wo_code |
| | | left join TMateriel_Info M on P.materiel_code=M.partcode |
| | | left join TUom T on M.uom_code=T.code |
| | | left join TKimp_Ewo E on P.m_po=E.wo |
| | | where P.status<>'CLOSED' and P.status<>'NEW' and P.is_delete<>'1' and A.eqp_code=@linecode"; |
| | | where P.status<>'CLOSED' and P.status<>'NEW' and A.eqp_code=@linecode and A.style='S' and A.step_seq='1'"; |
| | | dynamicParams.Add("@linecode", json[i].code); |
| | | var data0 = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data0.Rows.Count > 0) |
| | |
| | | lineone.children = new List<TreeTwo>(); |
| | | |
| | | //查新工单下工序信息 |
| | | sql = @"select A.seq,T.stepcode,T.stepname,A.plan_qty,A.good_qty,A.ng_qty |
| | | sql = @"select A.seq,T.stepcode,T.stepname,A.plan_qty,A.good_qty,A.ng_qty,A.status |
| | | from TK_Wrk_Step A |
| | | left join TStep T on A.step_code=T.stepcode |
| | | where A.wo_code=@wo_code"; |
| | | dynamicParams.Add("@linecode", wo_code); |
| | | dynamicParams.Add("@wo_code", wo_code); |
| | | var data1 = DapperHelper.selectdata(sql, dynamicParams); |
| | | for (int k = 0; k < data1.Rows.Count; k++) |
| | | { |
| | |
| | | string planqty = data1.Rows[k]["PLAN_QTY"].ToString();//任务数量 |
| | | string good_qty = data1.Rows[k]["GOOD_QTY"].ToString();//报工数量 |
| | | string ng_qty = data1.Rows[k]["NG_QTY"].ToString();//不良数量 |
| | | string status = data1.Rows[k]["STATUS"].ToString();//状态 |
| | | TreeTwo linetwo = new TreeTwo(); |
| | | linetwo.stepseq = stepseq; |
| | | linetwo.stepcode = stepcode; |
| | |
| | | linetwo.planqty = planqty; |
| | | linetwo.goodqty = good_qty; |
| | | linetwo.ngqty = ng_qty; |
| | | linetwo.status = status; |
| | | lineone.children.Add(linetwo); |
| | | } |
| | | } |
| | |
| | | mes.code = "300"; |
| | | mes.Message = "当前产线下无在生产任务!"; |
| | | mes.data = null; |
| | | return mes; |
| | | list.Add(line); |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | |
| | | mes.code = "300"; |
| | | mes.Message = "当前产线下无在生产任务!"; |
| | | mes.data = null; |
| | | return mes; |
| | | list.Add(line); |
| | | continue; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = list; |
| | | return mes; |
| | | } |
| | | #endregion\ |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[大岛车间综合看板,右上top排行接口] |
| | | #region[大岛车间综合看板,右上top排行接口,当日] |
| | | public static ToMessage LineSearchTopRightData() |
| | | { |
| | | string sql = ""; |
| | |
| | | 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' |
| | | 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' |
| | | ) 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 = "查询成功!"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[大岛车间综合看板,右下top排行接口] |
| | | #region[大岛车间综合看板,右下top排行接口,当前时间往前一周] |
| | | public static ToMessage LineSearchBottomRightData() |
| | | { |
| | | string sql = ""; |
| | |
| | | try |
| | | { |
| | | //获取报工不良top5信息 |
| | | sql = @"select isnull(COUNT(checkitem_name),0) cont,checkitem_name from TStepCheckRecordSub |
| | | 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 = "查询成功!"; |
| | | 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 WareHouseTopLeftData() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | //获取仓库生产加工单待入库列表 |
| | | sql = @"select * from h_v_DDKanBan_WareHouseTopLeft"; |
| | | 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 WareHouseTopBottomData() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | //获取仓库生产加工单待入库列表 |
| | | sql = @"select * from h_v_DDKanBan_WareHouseTopBottom"; |
| | | 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[大岛仓库看板,右上成品库、半成品库top5库存排行] |
| | | public static ToMessage WareHouseRightTopData() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_DDKanBan_WareHouseRightTop"; |
| | | 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[大岛仓库看板,右下原料库库top5库存排行] |
| | | public static ToMessage WareHouseRightBottomData() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_DDKanBan_WareHouseRightBottom"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |