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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
 
namespace DAL
{
    public class ClsGy_ICBomBill_K3 : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsGy_ICBomBillMain_K3 omodel = new Model.ClsGy_ICBomBillMain_K3();
        public List<Model.ClsGy_ICBomBillSub_K3> DetailColl = new List<Model.ClsGy_ICBomBillSub_K3>();
 
        public ClsGy_ICBomBill_K3()
        {
            base.MvarItemKeySub = "ICBomChild";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "ICBom";
            base.MvarReportTitle = "生产BOM";
            base.BillType = "50";
        }
 
        #region 固定代码
 
        ~ClsGy_ICBomBill_K3()
        {
            DetailColl = null;
        }
 
        #endregion   自定义方法
 
        //单据号是否重复
        public bool IsExistBillNo(ref string sReturn, string sBillNo, DBUtility.ClsPub.Enum_BillStatus oBillStatus, Int64 lngBillKey)
        {
            try
            {
                string sSql = "";
                if (oBillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
                {
                    sSql = "Select FInterID from ICBom where FTranType='" + BillType + "' and FBomNumber ='" + sBillNo + "'";
                }
                else
                {
                    sSql = "Select FInterID from ICBom where FTranType='" + BillType + "' and FBomNumber ='" + sBillNo + "' and FInterID<>" + lngBillKey.ToString();
                }
                DataSet Ds;
                Ds = oK3Cn.RunProcReturn(sSql, "ICBom");
                if (Ds.Tables[0].Rows.Count != 0)
                {
                    sReturn = "单号重复";
                    return true;
                }
                sReturn = "单号未重复";
                return false;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                return false;
            }
        }
 
        //删除子表
        public void DeleteBillSub(Int64 lngBillKey)
        {
            oK3Cn.RunProc("Delete From ICBomChild where FInterID=" + lngBillKey.ToString());
        }
        //删除主表
        public void DeleteBillMain(Int64 lngBillKey)
        {
            oK3Cn.RunProc("Delete From ICBom where FInterID=" + lngBillKey.ToString());
        }
        //删除单据
        public bool DeleteBill(Int64 lngBillKey, ref string sReturn)
        {
            DataSet Ds = new DataSet();
            try
            {
                oK3Cn.BeginTran();
                //删除关联
                //DeleteRelation(ref sReturn, lngBillKey);
                //删除明细表
                DeleteBillSub(lngBillKey);
                //删除主表
                DeleteBillMain(lngBillKey);
                //删除关联
 
                sReturn = "删除单据成功!";
                oK3Cn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oK3Cn.RollBack();
                return false;
            }
        }
 
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oK3Cn.BeginTran();
                omodel.HBillerID = DBUtility.ClsPub.GetUser_K3(DBUtility.ClsPub.CurUserName);
                if (omodel.HBillerID == 0)
                {
                    sReturn = "错误用户,未在K3中设置用户!";
                    oK3Cn.RollBack();
                    return false;
                }
                //删除主表
                DeleteBillMain(lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //
                //更新主表
                oK3Cn.RunProc("Insert Into ICBom " +
                "(FInterID,FBomNumber,FBrNo,FTranType,FCancellation" +
                ",FStatus,FVersion,FUseStatus,FItemID,FUnitID,FAuxPropID,FAuxQty,FYield" +
                ",FNote,FCheckID,FCheckDate,FOperatorID,FEntertime,FRoutingID,FBomType" +
                ",FCustID,FParentID,FAudDate,FImpMode,FPDMImportDate,FBOMSkip" +
                ") " +
                " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0" +
                ",0,'" + omodel.HVersion + "','1073'," + omodel.HMaterID.ToString() + "," + omodel.HUnitID.ToString() + ",0," + omodel.HQty.ToString() + "," + omodel.HProdRate.ToString() +
                ",'" + omodel.HRemark + "'," + omodel.HMaker + ",'" + omodel.HMakeDate + "'," + omodel.HBillerID + ",'" + DBUtility.ClsPub.GetServerDate(-1) + "',0,0" +
                ",0," + omodel.HParentID.ToString() + ",null,0,null,'" + omodel.HJump + "'" +
                ") ");
                //插入子表
                foreach (Model.ClsGy_ICBomBillSub_K3 oSub in DetailColl)
                {
                    oK3Cn.RunProc("Insert into ICBomChild " +
                      " (FInterID,FEntryID,FBrNo,FItemID,FAuxPropID" +
                      ",FUnitID,FMaterielType,FMarshalType,FQty,FAuxQty,FBeginDay,FEndDay" +
                      ",FPercent,FScrap,FPositionNo,FItemSize,FItemSuite,FOperSN,FOperID" +
                      ",FMachinePos,FOffSetDay,FBackFlush,FStockID,FSPID,FHasChar" +
                      ",FNote,FNote1,FNote2,FNote3,FPDMImportDate,FDetailID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.HMaterID.ToString() + ",0" +
                      "," + oSub.HUnitID.ToString() + ",371,385," + oSub.HQty.ToString() + "," + oSub.HRelQty.ToString() + ",convert(varchar(10),getdate(),120),'2100-01-01'" +
                      ",100," + oSub.HWasteRate.ToString() + ",'','','',0," + oSub.HProcID.ToString() +
                      ",'',0,1059," + oSub.HWhID.ToString() + "," + oSub.HSPID.ToString() + ",0" +
                      ",'" + oSub.HRemark + "','" + oSub.HRemark2 + "','" + oSub.HRemark3 + "','" + oSub.HRemark4 + "',null,NEWID()" +
                      ") ");
                }
                oK3Cn.RunProc("INSERT INTO t_Log (FDate,FUserID,FFunctionID,FStatement,FDescription,FMachineName,FIPAddress) VALUES (getdate()," + omodel.HBillerID + ",'K810030',3,'编号为" + omodel.HBillNo + "的单据修改成功','CHINA-52B459496','127.0.0.1')");
                oK3Cn.RunProc("EXEC h_p_K3_Gy_ICBomCheckAndUsed " + omodel.HInterID.ToString() + "," + omodel.HBillerID + "");
                oK3Cn.RunProc("INSERT INTO t_Log (FDate,FUserID,FFunctionID,FStatement,FDescription,FMachineName,FIPAddress) VALUES (getdate()," + omodel.HBillerID + ",'K810030',3,'编号为" + omodel.HBillNo + "的单据使用成功','CHINA-52B459496','127.0.0.1')");
                sReturn = "修改单据成功!";
                oK3Cn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oK3Cn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                DataSet Ds;
                //得到mainid
                Ds = oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'ICBom', @InterID output, 1, 16394 select ltrim(@InterID)", "GetICMaxNum");
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 10000000;
                //若MAINDI重复则重新获取
                omodel.HBillerID = DBUtility.ClsPub.GetUser_K3(DBUtility.ClsPub.CurUserName);
                if (omodel.HBillerID == 0)
                {
                    sReturn = "错误用户,未在K3中设置用户!"; 
                    return false;
                }
                oK3Cn.BeginTran();
                //主表
                oK3Cn.RunProc("Insert Into ICBom " +
                "(FInterID,FBomNumber,FBrNo,FTranType,FCancellation" +
                ",FStatus,FVersion,FUseStatus,FItemID,FUnitID,FAuxPropID,FAuxQty,FYield" +
                ",FNote,FCheckID,FCheckDate,FOperatorID,FEntertime,FRoutingID,FBomType" +
                ",FCustID,FParentID,FAudDate,FImpMode,FPDMImportDate,FBOMSkip" +
                ") " +
                " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0" +
                ",0,'" + omodel.HVersion + "','1073'," + omodel.HMaterID.ToString() + "," + omodel.HUnitID.ToString() + ",0," + omodel.HQty.ToString() + "," + omodel.HProdRate.ToString() +
                ",'" + omodel.HRemark + "'," + omodel.HBillerID + ",'" + DBUtility.ClsPub.GetServerDate(-1) + "'," + omodel.HBillerID + ",'" + DBUtility.ClsPub.GetServerDate(-1) + "',0,0" +
                ",0," + omodel.HParentID.ToString() + ",null,0,null,'" + omodel.HJump + "'" +
                ") ");
                //插入子表
                foreach (Model.ClsGy_ICBomBillSub_K3 oSub in DetailColl)
                {
                    oK3Cn.RunProc("Insert into ICBomChild " +
                      " (FInterID,FEntryID,FBrNo,FItemID,FAuxPropID" +
                      ",FUnitID,FMaterielType,FMarshalType,FQty,FAuxQty,FBeginDay,FEndDay" +
                      ",FPercent,FScrap,FPositionNo,FItemSize,FItemSuite,FOperSN,FOperID" +
                      ",FMachinePos,FOffSetDay,FBackFlush,FStockID,FSPID,FHasChar" +
                      ",FNote,FNote1,FNote2,FNote3,FPDMImportDate,FDetailID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.HMaterID.ToString() + ",0" +
                      "," + oSub.HUnitID.ToString() + ",371,385," + oSub.HQty.ToString() + "," + oSub.HRelQty.ToString() + ",convert(varchar(10),getdate(),120),'2100-01-01'" +
                      ",100," + oSub.HWasteRate.ToString() + ",'','','',0," + oSub.HProcID.ToString() +
                      ",'',0,1059," + oSub.HWhID.ToString() + ","+ oSub.HSPID.ToString() +",0" +
                      ",'" + oSub.HRemark + "','" + oSub.HRemark2 + "','" + oSub.HRemark3 + "','" + oSub.HRemark4 + "',null,NEWID()" +
                      ") ");
                }
                oK3Cn.RunProc("INSERT INTO t_Log (FDate,FUserID,FFunctionID,FStatement,FDescription,FMachineName,FIPAddress) VALUES (getdate()," + omodel.HBillerID + ",'K810030',3,'编号为" + omodel.HBillNo + "的单据保存成功','CHINA-52B459496','127.0.0.1')");
                oK3Cn.RunProc("EXEC h_p_K3_Gy_ICBomCheckAndUsed " + omodel.HInterID.ToString() + "," + omodel.HBillerID + "");
                oK3Cn.RunProc("INSERT INTO t_Log (FDate,FUserID,FFunctionID,FStatement,FDescription,FMachineName,FIPAddress) VALUES (getdate()," + omodel.HBillerID + ",'K810030',3,'编号为" + omodel.HBillNo + "的单据使用成功','CHINA-52B459496','127.0.0.1')");
                sReturn = "新增单据成功!";
                oK3Cn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oK3Cn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oK3Cn.RunProcReturn("Select * from ICBom Where FInterID=" + lngBillKey.ToString(), "ICBom");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //赋值
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FInterID"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["FBOMNumber"].ToString().Trim();
                omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["FCheckDate"].ToString().Trim());
                omodel.HRemark = Ds.Tables[0].Rows[0]["FNote"].ToString().Trim();
                //
                omodel.HParentID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FParentID"]);
                omodel.HVersion = Ds.Tables[0].Rows[0]["FVersion"].ToString();
                //omodel.HMaterTypeID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterTypeID"]);
                omodel.HStatus = Ds.Tables[0].Rows[0]["FStatus"].ToString();
                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FItemID"]);
                
                //omodel.HPicNo = Ds.Tables[0].Rows[0]["FChartNumber"].ToString();
                omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FUnitID"]);
                omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["FAuxQty"]);
                omodel.HProdRate = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["FYield"]);
                omodel.HJump = Ds.Tables[0].Rows[0]["FBOMSkip"].ToString();
                //
                omodel.HMaker = Ds.Tables[0].Rows[0]["FCheckID"].ToString().Trim();
                omodel.HMakeDate = Ds.Tables[0].Rows[0]["FCheckDate"].ToString().Trim();
                omodel.HUpDater = Ds.Tables[0].Rows[0]["FOperatorID"].ToString().Trim();
                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["FEntertime"].ToString().Trim();
                //omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
                //omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
                omodel.HChecker = Ds.Tables[0].Rows[0]["FCheckerID"].ToString().Trim();
                omodel.HCheckDate = Ds.Tables[0].Rows[0]["FAudDate"].ToString().Trim();
                //omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                //omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                //omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                //omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //循环
                DataSet DsSub;
                DsSub = oK3Cn.RunProcReturn("Select * from ICBomChild Where FInterID=" + lngBillKey.ToString() + " order by HEntryID ", "ICBomChild");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsGy_ICBomBillSub_K3 oSub = new Model.ClsGy_ICBomBillSub_K3();
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FInterID"].ToString());
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FEntryID"].ToString());
                    oSub.HWhID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FStockID"].ToString());
                    oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FSPID"].ToString());
                    oSub.HWasteRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["FScrap"].ToString());
                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FItemID"].ToString());
                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FUnitID"].ToString());
                    oSub.HRelQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["FAuxQty"].ToString());
                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FQty"].ToString());
                    oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FOperID"].ToString());
                    //oSub.HCloseMan = DsSub.Tables[0].Rows[i]["HCloseMan"].ToString().Trim();
                    //oSub.HCloseType = (bool)DsSub.Tables[0].Rows[i]["HCloseType"];
                    oSub.HChildType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FMaterielType"]);
                    oSub.HRemark = DsSub.Tables[0].Rows[i]["FNote"].ToString().Trim();
                    oSub.HRemark2 = DsSub.Tables[0].Rows[i]["FNote1"].ToString().Trim();
                    oSub.HRemark3 = DsSub.Tables[0].Rows[i]["FNote2"].ToString().Trim();
                    oSub.HRemark4 = DsSub.Tables[0].Rows[i]["FNote3"].ToString().Trim();
                    //
                    //oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"].ToString());
                    //oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"].ToString());
                    //oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    //oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    //oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"].ToString());
                    //oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"].ToString());
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
 
        public bool Get_BOMIDByMaterID(long HMaterID,ref long HBOMID,ref string HBOMNumber)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCnK3.RunProcReturn("Select FInterID,FBOMNumber from icbom Where FItemID=" + HMaterID.ToString() + " and FUseStatus=1072", "icbom");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                //固定赋值===========================================
                //
                HBOMID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FInterID"]);
                HBOMNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBOMNumber"]);
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
 
        public bool CheckBomMater(long HInterID, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("exec h_p_Sc_ICBomBill_Tmp_MaterCheck " + HInterID.ToString(), "xt_xtgnb");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    return true;
                }
                //
                sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]);
                if (sReturn == "")
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
 
        public bool AddBomBill(long HInterID, ref string sReturn)
        {
            //查询主表
            DataSet Ds;
            long NewInterID = 0;
            string NewBillNo = "";
            Int64 K3UserID = DBUtility.ClsPub.GetUser_K3(DBUtility.ClsPub.CurUserName);
            if (K3UserID == 0)
            {
                sReturn = "当前用户无效,金蝶中未添加";
                return false;
            }
            Ds = oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'ICBom', @InterID output, 1, 16394 select ltrim(@InterID)", "GetICMaxNum");
            NewInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 10000000;
            Ds = oK3Cn.RunProcReturn("exec HX_GetICBillNo 1," + BillType, "t_billcodeby");
            NewBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]);
            long HBillerID = DBUtility.ClsPub.GetUser_K3(DBUtility.ClsPub.CurUserName);
            try
            {
                oCn.BeginTran();
                Ds = oCn.RunProcReturn("exec h_p_Sc_ICBomBill_Add " + HInterID.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "'," + K3UserID.ToString(), "xt_xtgnb");
                oCn.RunProc("EXEC h_p_K3_Gy_ICBomCheckAndUsed " + NewInterID.ToString() + "," + HBillerID + "");
                oCn.Commit();
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                sReturn = e.Message;
                throw (e);
            }
        }
 
        //判断 修改人和制单人 是否同一人
        public bool Fun_CheckMakerIsSame(Int64 iBomInterID)
        {
            try
            {
                DataSet Ds;
                Int64 K3UserID =DBUtility.ClsPub.GetUser_K3(DBUtility.ClsPub.CurUserName);
                if (K3UserID == 0)
                {
                    return false;
                }
                Ds = oCn.RunProcReturn("exec h_p_Sc_CheckMakerIsSame " + iBomInterID.ToString() + "," + K3UserID.ToString(), "h_p_Sc_CheckMakerIsSame");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                } 
                return false;
            }
            catch (Exception e)
            {  
                return false;
            }
        }
 
 
    }
}