yl
2022-07-27 2f91cbefebb537819abc851a3c17a08c691055f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using VueWebApi.Tools;
 
namespace VueWebApi.DLL.DAL
{
    public class GridReportDAL
    {
        public static DataTable dt;    //定义全局变量dt
        public static bool res;       //定义全局变量dt
        public static ToMessage mes = new ToMessage(); //定义全局返回信息对象
        public static GridMessage gidmes = new GridMessage(); //定义全局返回信息对象
        public static string strProcName = ""; //定义全局sql变量
        public static List<SqlParameter> listStr = new List<SqlParameter>(); //定义全局参数集合
 
        public static SqlParameter[] parameters; //定义全局SqlParameter参数数组
 
 
        #region[MES工单打印]
        public static ToMessage MesOrderPrintSearch(string username, string mesordercode)
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
 
            //获取设备类型数据
            sql = @"select A.seq,A.wo_code,P.partcode,P.partname,P.partspec,R.name as routename,M.plan_qty as orderqty,@username as lm_user,@createdate as lm_date,
                        B.stepcode,B.stepname,A.plan_qty,(case when A.good_qty=0 then '' end) as good_qty,(case when A.ng_qty=0 then '' end) as ng_qty,A.wo_code+';'+B.stepcode as stepqrcode    
                        from TK_Wrk_Step A
                        left join TK_Wrk_Man M on A.wo_code=M.wo_code
                        left join TFlw_Rout R on A.route_code=R.code
                        left join TMateriel_Info P on M.materiel_code=P.partcode
                        left join TStep B on A.step_code=B.stepcode
                        where A.wo_code=@mesordercode ";
            dynamicParams.Add("@username", username);
            dynamicParams.Add("@createdate", DateTime.Now.ToString());
            dynamicParams.Add("@mesordercode", mesordercode);
            var data = DapperHelper.selectdata(sql, dynamicParams);
            if (data.Rows.Count > 0)
            {
                gidmes.recordset = data;
                mes.code = "200";
                mes.count = 0;
                mes.Message = "查询成功!";
                mes.data = gidmes;
            }
            else 
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = "无生产任务数据!";
                mes.data = null;
            }
            
            return mes;
        }
        #endregion
 
        #region[FastReport打印]
        public static PrintMessage MesOrderFastReportPrintSearch(string username, string mesordercode)
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
            PrintMessage ms = new PrintMessage();
            //获取工单工序任务数据
            sql = @"select A.seq,A.wo_code,P.partcode,P.partname,P.partspec,R.name as routename,M.plan_qty as orderqty,@username as lm_user,@createdate as lm_date,
                        B.stepcode,B.stepname,A.plan_qty,(case when A.good_qty=0 then '' end) as good_qty,(case when A.ng_qty=0 then '' end) as ng_qty,A.wo_code+';'+B.stepcode as stepqrcode    
                        from TK_Wrk_Step A
                        left join TK_Wrk_Man M on A.wo_code=M.wo_code
                        left join TFlw_Rout R on A.route_code=R.code
                        left join TMateriel_Info P on M.materiel_code=P.partcode
                        left join TStep B on A.step_code=B.stepcode
                        where A.wo_code=@mesordercode ";
            dynamicParams.Add("@username", username);
            dynamicParams.Add("@createdate", DateTime.Now.ToString());
            dynamicParams.Add("@mesordercode", mesordercode);
            DataTable data = DapperHelper.selectdata(sql, dynamicParams);
            if (data.Rows.Count > 0)
            {
                ms.code = "200";
                ms.Message = "查询成功!";
                ms.data = data;
            }
            else
            {
                ms.code = "300";
                ms.Message = "无生产任务数据!";
                ms.data = null;
            }
 
            return ms;
        }
        #endregion
 
    }
}