zzr99
2021-09-30 5b8c86d6c9901a57d5688a16b0d0c569a87acbf9
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
101
102
103
104
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
 
namespace DAL
{
    public class ClsK3_Material_Edit_Ctl:DBUtility.ClsGy_Base_Ctl 
    {
        SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); 
 
        public Model.ClsK3_Material_Edit_Model oModel ;
        //新增
        public override bool AddNew()
        {
            try
            {
                oCnK3.BeginTran();
                oCnK3.RunProc("exec h_p_K3_Gy_AddMaterial " +
                    oModel.HUserID.ToString()    +
                ",'" + oModel.HUserName + "'" +
                "," + oModel.HParentID.ToString()    +
                "," +  oModel.HLevel.ToString() +
                ",'" + oModel.HNumber + "'" +
                ",'" + oModel.HShortNumber + "'" +
                ",'" + oModel.HName + "'" +
                ",'" + oModel.HModel + "'" +
                "," + oModel.HUnitGroupID.ToString() +
                "," + oModel.HUnitID.ToString() +
                "," + oModel.HErpClsID.ToString() +
                "," + oModel.HAcctID.ToString() +
                ",'" + oModel.HRemark + "'" 
                    , ref DBUtility.ClsPub.sExeReturnInfo);
                oCnK3.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCnK3.RollBack();
                throw (e);
            }
        }
 
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCnK3.BeginTran();
                oCnK3.RunProc("exec h_p_K3_Gy_UpdateMaterial " +
                    oModel.HUserID.ToString() +
                ",'" + oModel.HUserName + "'" +
                ",'" + oModel.HName + "'" +
                ",'" + oModel.HModel + "'" +
                "," + oModel.HUnitGroupID.ToString() +
                "," + oModel.HUnitID.ToString() +
                ",'" + oModel.HRemark + "'" +
                "," + sItemID.ToString() +
                ",'" + oModel.HShortNumber + "'" +
                ",'" + oModel.HNumber + "'" 
                    , ref DBUtility.ClsPub.sExeReturnInfo);
                oCnK3.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCnK3.RollBack();
                throw (e);
            }
        }
 
        //构造函数
        public ClsK3_Material_Edit_Ctl()
        {
            MvarItemKey = "h_v_K3_Material";
            MvarReportTitle = "物料设置";
            oModel = new Model.ClsK3_Material_Edit_Model();
        } 
 
 
        //判断K3中是否存在该物料(根据 长代码 和 图号 判断)
        public bool IsExistsSameMaterial(string HLongNumber, string HChartNumber)
        {
            try
            {
                DataSet DS;
                DS = oCn.RunProcReturn("Select HItemID from h_v_K3_Material Where   HNumber='" + HLongNumber + "'", MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
                if (DS==null ||  DS.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                else
                {
                    return true;
                } 
            }
            catch (Exception e)
            {
                return true;
            }
        }
    }
}