yl
2024-03-04 010838be5afbc9659d8ce143ca4f712ff376bcf3
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
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.Models;
using VueWebCoreApi.Tools;
 
namespace VueWebCoreApi.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(User us, string mesordercode)
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
 
            //获取设备类型数据
            sql = @"select A.seq,A.wo_code,M.m_po,P.partcode,P.partname,P.partspec,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 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", us.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
    }
}