沈泽
2021-08-20 d111e4321dcc4baa63f63597694f80d94e67ca11
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
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
 
namespace BLL
{
    public class ClsGy_BarCodeEdit_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public ClsGy_BarCodeEdit_Model omodel = new ClsGy_BarCodeEdit_Model();
 
        //新增
        public bool AddNew()
        {
 
            try
            {
                oCn.BeginTran();
                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]) " +
                    " 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() + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + omodel.HParentID, 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 + "'", "Gy_BarCodeBill", 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;
                else
                {
                    omodel.HMaterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HMaterID"]);
                    //omodel.HProcID =0;
                    //omodel.HWhID = 0;
                    //omodel.HSCWhID = 0;
                    //omodel.HStockPlaceID =0;
                    //omodel.HOutStockPlaceID = 0;
                    //omodel.HGroupID =0;
                    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.HAddr = "";
                    //omodel.HMaker = "";
                    //omodel.HMakeDate = ;
                    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"]);
                    //omodel.HSourceItemID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceItemID"]);
                    return true;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
 
    }
}