Administrator
2025-04-21 56ab5ce0e07d908b29821f31178cd607d16d0487
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
 
namespace DAL
{
    public class ClsGy_BarCodeEdit_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public Model.ClsGy_BarCodeEdit_Model omodel = new Model.ClsGy_BarCodeEdit_Model();
        public List<Model.ClsGy_BarCodeEdit_Model> DetailColl = new List<Model.ClsGy_BarCodeEdit_Model>();
 
        //新增
        public bool AddNew()
        {
 
            try
            {
                oCn.BeginTran();
                foreach (Model.ClsGy_BarCodeEdit_Model omodel in DetailColl)
                {
                    oCn.RunProc("INSERT INTO [Kf_ICStockBillSub_WMS] " +
                        "([HInterID],[HEntryID],[HBillType],[HMaterID],[HProcID] " +
                        ",[HWhID],[HSCWhID],[HStockPlaceID],[HOutStockPlaceID],[HGroupID] " +
                        ",[HQty],[HBarCode],[HAddr],[HBatchNo],[HMaker],[HMakeDate] " +
                        ",[HSourceInterID],[HSourceEntryID],[HSourceBillType],[HSourceItemID],[HBarCodeType]) " +
                        " Values ('" + omodel.HInterID + "'," + omodel.HEntryID.ToString() + ",'" + omodel.HBillType + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() +
                        "," + omodel.HWhID.ToString() + "," + omodel.HSCWhID.ToString() + "," + omodel.HStockPlaceID.ToString() + "," + omodel.HOutStockPlaceID.ToString() + "," + omodel.HGroupID.ToString() +
                        "," + omodel.HQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBatchNo + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                        "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillType + "'," + omodel.HSourceItemID.ToString() + ",'" + omodel.HBarCodeType + "'" + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                }
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
 
        //删除
        public bool DeleteByID(Int64 sItemID)
        {
            try
            {
                oCn.RunProc("Delete from Kf_ICStockBillSub_WMS where HItemID='" + sItemID + "'", ref Pub_Class.ClsPub.sExeReturnInfo);
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
 
        //设置单据网络信息
        public DataSet SetGridViewByBillNo(string sBillNo)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("Select * from h_v_Kf_StockBarCodeList Where HBillType='" + sBillNo + "'", "h_v_Kf_StockBarCodeList", ref Pub_Class.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                    return null;
                else
                {
                    return DS;
                }
            }
            catch (Exception e)
            {
                return null;
            }
        }
 
        //根据条码判断信息
        public bool HavParentCarCode(string sCode)
        {
            DataSet DS;
           
            try
            {
                DS = oCn.RunProcReturn("Select * from Gy_BarCodeBill Where hbarcode='" + sCode + "'", "Gy_BarCodeBill", ref Pub_Class.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                return false;
            //if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCodeType"]) == "箱号条码")
            //{
            //    DataSet oDS;
            //    try
            //    {
            //        oDS = oCn.RunProcReturn("select * from h_v_Sc_PackUnionBillList where 箱号条形码=" + sCode, "Sc_PackUnionBillMain", ref Pub_Class.ClsPub.sExeReturnInfo);
            //        if (oDS.Tables[0].Rows.Count == 0)
            //            return false;
                    
            //        else
            //        {
            //            DetailColl.Clear();
            //            for (int i = 0; i < oDS.Tables[0].Rows.Count; i++)
            //            {
            //                omodel.HMaterID = DBUtility.ClsPub.isLong(oDS.Tables[0].Rows[i]["HMaterID"]);
            //                omodel.HQty = DBUtility.ClsPub.isDoule(oDS.Tables[0].Rows[i]["数量"]);
            //                omodel.HBarCode = DBUtility.ClsPub.isStrNull(oDS.Tables[0].Rows[i]["箱号条形码"]);
            //                DetailColl.Add(omodel);
            //            }
            //            return true;
            //        } 
            //    }
            //    catch (Exception e)
            //    {
            //        throw (e);
            //    }
            //}
                 else
            {
                 //       omodel.HMaterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HMaterID"]);
                 //       omodel.HQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]);
                 //       omodel.HBarCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCode"]);
                 //       omodel.HBatchNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBatchNo"]);
                 //       omodel.HSourceInterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceInterID"]);
                 //       omodel.HSourceEntryID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceEntryID"]);
                 //       omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HSourceBillType"]);
                        return true;
                    }
                   
               
            }
 
            catch (Exception e)
            {
                throw (e);
            }
        }
 
 
        public bool Show(long sMater)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("Select * from Kf_ICStockBillSub_WMS Where HMaterID='" + sMater + "'", "Kf_ICStockBillSub_WMS", ref Pub_Class.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                    return false;
                else
                {
                    omodel.HMaterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HMaterID"]);
                    omodel.HQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]);
                    omodel.HBarCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCode"]);
                    omodel.HBatchNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBatchNo"]);
                    omodel.HSourceInterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceInterID"]);
                    omodel.HSourceEntryID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceEntryID"]);
                    omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HSourceBillType"]);
                    return true;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
 
    }
}