yangle
2023-05-24 b129762a4bb5ec2cde5edf16bc9cbda57c73587d
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
using System;
using System.Collections.Generic;
using System.Text;
 
namespace DAL
{
    public class K3_BaseFun
    {
 
        #region 产品入库
        /// <summary>
        /// 返回产品入库单 新增主表SQL
        /// </summary>
        /// <returns></returns>
        public static string Fun_GetAddBillMainSQL_ProdIn(Model.ClsKf_ProductInBillMain_K3 omodel, string VNum)
        {
            string RSql="";
            switch (VNum )
            {
                case "12.2":
                    RSql = "INSERT INTO ICStockBill(" +
                    "FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus," +
                    "FUpStockWhenSave,FROB,FHookStatus,Fdate,FDeptID,FCheckDate," +
                    "FFManagerID,FSManagerID,FBillerID,FMultiCheckDate1," +
                    "FMultiCheckDate2,FMultiCheckDate3,FMultiCheckDate4," +
                    "FMultiCheckDate5,FMultiCheckDate6,FVchInterID,FSelTranType," +
                    "FManageType,FPrintCount,FNote" +
                    ") Values (" +
                    omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + omodel.HBillType + "',0,0" +
                    ",0,1,0,'" + omodel.HDate.ToString() + "'," + omodel.FDeptID.ToString() + ",null" +
                    "," + omodel.FFManagerID.ToString() + "," + omodel.FSManagerID.ToString() + "," + omodel.HBillerID + ",null" +
                    ",null,null,null" +
                    ",null,null,0," + omodel.FSelTranType.ToString() +
                    ",0,0,'" + omodel.HRemark + "'" +
                    ")";
                   break;
               case "12.1":
                   RSql = "INSERT INTO ICStockBill(" +
                   "FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus," +
                   "FUpStockWhenSave,FROB,FHookStatus,Fdate,FDeptID,FCheckDate," +
                   "FFManagerID,FSManagerID,FBillerID,FMultiCheckDate1," +
                   "FMultiCheckDate2,FMultiCheckDate3,FMultiCheckDate4," +
                   "FMultiCheckDate5,FMultiCheckDate6,FVchInterID,FSelTranType," +
                   "FManageType,FPrintCount,FNote,FHeadSelfA0228" +
                   ") Values (" +
                   omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + omodel.HBillType + "',0,0" +
                   ",0,1,0,'" + omodel.HDate.ToString() + "'," + omodel.FDeptID.ToString() + ",null" +
                   "," + omodel.FFManagerID.ToString() + "," + omodel.FSManagerID.ToString() + "," + omodel.HBillerID + ",null" +
                   ",null,null,null" +
                   ",null,null,0," + omodel.FSelTranType.ToString() +
                   ",0,0,'" + omodel.HRemark + "'," +omodel.HGroupID.ToString() +
                   ")";
                   break;
                default:
                    RSql = "INSERT INTO ICStockBill(" +
                   "FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus," +
                   "FUpStockWhenSave,FROB,FHookStatus,Fdate,FDeptID,FCheckDate," +
                   "FFManagerID,FSManagerID,FBillerID,FMultiCheckDate1," +
                   "FMultiCheckDate2,FMultiCheckDate3,FMultiCheckDate4," +
                   "FMultiCheckDate5,FMultiCheckDate6,FVchInterID,FSelTranType," +
                   "FManageType,FPrintCount,FNote,FHeadSelfA0228" +
                   ") Values (" +
                   omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + omodel.HBillType + "',0,0" +
                   ",0,1,0,'" + omodel.HDate.ToString() + "'," + omodel.FDeptID.ToString() + ",null" +
                   "," + omodel.FFManagerID.ToString() + "," + omodel.FSManagerID.ToString() + "," + omodel.HBillerID + ",null" +
                   ",null,null,null" +
                   ",null,null,0," + omodel.FSelTranType.ToString() +
                   ",0,0,'" + omodel.HRemark + "'," + omodel.HGroupID.ToString() +
                   ")";
                    break;
            }
            return RSql;
        }
 
 
        public static string Fun_GetAddBillSubSQL_ProdIn(Model.ClsKf_ProductInBillSub_K3 oSub, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "INSERT INTO ICStockBillEntry (" +
                     "FInterID,FEntryID,FBrNo,FItemID,FAuxPropID," +
                     "FBatchNo,FQtyMust,FQty,FUnitID,FAuxQtyMust," +
                     "Fauxqty,FSecCoefficient,FSecQty,FAuxPlanPrice," +
                     "FPlanAmount,Fauxprice,Famount,Fnote,FKFDate," +
                     "FKFPeriod,FPeriodDate,FDCStockID,FDCSPID,FSNListID," +
                     "FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID," +
                     "FSecUnitID,FEntrySelfA0236," +
                     "FICMOBillNo,FICMOInterID,FPPBomEntryID,FPlanMode,FMTONo,FChkPassItem" +
                     ") Values (" +
                     oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.FItemID.ToString() + "," + oSub.HPropertyID.ToString() + "" +
                     ",'" + oSub.FBatchNo + "'," + oSub.Fauxqty.ToString() + "," + oSub.Fauxqty.ToString() + "," + oSub.FUnitID.ToString() + "," + oSub.Fauxqty.ToString() +
                     "," + oSub.Fauxqty.ToString() + ",0,0,0" +
                     ",0," + oSub.Fauxprice.ToString() + "," + oSub.Famount.ToString() + ",'" + oSub.Fnote + "',null" +
                     ",0,null," + oSub.FDCStockID.ToString() + "," + oSub.HSPID.ToString() + ",0" +
                     "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitQty.ToString() + "" +
                     ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
                     ",'" + oSub.FICMOBillNo + "'," + oSub.FICMOInterID.ToString() + ",0,14036,'',0" +
                     ")";
                    break;
                case "12.1":
                    RSql = "INSERT INTO ICStockBillEntry (" +
                     "FInterID,FEntryID,FBrNo,FItemID,FAuxPropID," +
                     "FBatchNo,FQtyMust,FQty,FUnitID,FAuxQtyMust," +
                     "Fauxqty,FSecCoefficient,FSecQty,FAuxPlanPrice," +
                     "FPlanAmount,Fauxprice,Famount,Fnote,FKFDate," +
                     "FKFPeriod,FPeriodDate,FDCStockID,FDCSPID,FSNListID," +
                     "FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID," +
                     "FEntrySelfA0236," +
                     "FICMOBillNo,FICMOInterID,FPPBomEntryID,FPlanMode,FMTONo,FChkPassItem" +
                     ") Values (" +
                     oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.FItemID.ToString() + "," + oSub.HPropertyID.ToString() + "" +
                     ",'" + oSub.FBatchNo + "'," + oSub.Fauxqty.ToString() + "," + oSub.Fauxqty.ToString() + "," + oSub.FUnitID.ToString() + "," + oSub.Fauxqty.ToString() +
                     "," + oSub.Fauxqty.ToString() + ",0,0,0" +
                     ",0," + oSub.Fauxprice.ToString() + "," + oSub.Famount.ToString() + ",'" + oSub.Fnote + "',null" +
                     ",0,null," + oSub.FDCStockID.ToString() + "," + oSub.HSPID.ToString() + ",0" +
                     ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
                     "," + oSub.HSecUnitQty.ToString() + "" +
                     ",'" + oSub.FICMOBillNo + "'," + oSub.FICMOInterID.ToString() + ",0,'14036','',1058" +
                     ")";
                    break;
                case "14.0":
                    RSql = "INSERT INTO ICStockBillEntry (" +
                     "FInterID,FEntryID,FBrNo,FItemID,FAuxPropID," +
                     "FBatchNo,FQtyMust,FQty,FUnitID,FAuxQtyMust," +
                     "Fauxqty,FSecCoefficient,FSecQty,FAuxPlanPrice," +
                     "FPlanAmount,Fauxprice,Famount,Fnote,FKFDate," +
                     "FKFPeriod,FPeriodDate,FDCStockID,FDCSPID,FSNListID," +
                     "FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID," +
                     "FEntrySelfA0236," +
                     "FICMOBillNo,FICMOInterID,FPPBomEntryID,FPlanMode,FMTONo,FChkPassItem" +
                     ") Values (" +
                     oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.FItemID.ToString() + "," + oSub.HPropertyID.ToString() + "" +
                     ",'" + oSub.FBatchNo + "'," + oSub.Fauxqty.ToString() + "," + oSub.Fauxqty.ToString() + "," + oSub.FUnitID.ToString() + "," + oSub.Fauxqty.ToString() +
                     "," + oSub.Fauxqty.ToString() + ",0,0,0" +
                     ",0," + oSub.Fauxprice.ToString() + "," + oSub.Famount.ToString() + ",'" + oSub.Fnote + "',null" +
                     ",0,null," + oSub.FDCStockID.ToString() + "," + oSub.HSPID.ToString() + ",0" +
                     ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
                     "," + oSub.HSecUnitQty.ToString() + "" +
                     ",'" + oSub.FICMOBillNo + "'," + oSub.FICMOInterID.ToString() + ",0,'14036','',1058" +
                     ")";
                    break;
                default:
                    RSql = "INSERT INTO ICStockBillEntry (" +
                     "FInterID,FEntryID,FBrNo,FItemID,FAuxPropID," +
                     "FBatchNo,FQtyMust,FQty,FUnitID,FAuxQtyMust," +
                     "Fauxqty,FSecCoefficient,FSecQty,FAuxPlanPrice," +
                     "FPlanAmount,Fauxprice,Famount,Fnote,FKFDate," +
                     "FKFPeriod,FPeriodDate,FDCStockID,FDCSPID,FSNListID," +
                     "FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID," +
                     "FEntrySelfA0236," +
                     "FICMOBillNo,FICMOInterID,FPPBomEntryID,FPlanMode,FMTONo,FChkPassItem" +
                     ") Values (" +
                     oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.FItemID.ToString() + "," + oSub.HPropertyID.ToString() + "" +
                     ",'" + oSub.FBatchNo + "'," + oSub.Fauxqty.ToString() + "," + oSub.Fauxqty.ToString() + "," + oSub.FUnitID.ToString() + "," + oSub.Fauxqty.ToString() +
                     "," + oSub.Fauxqty.ToString() + ",0,0,0" +
                     ",0," + oSub.Fauxprice.ToString() + "," + oSub.Famount.ToString() + ",'" + oSub.Fnote + "',null" +
                     ",0,null," + oSub.FDCStockID.ToString() + "," + oSub.HSPID.ToString() + ",0" +
                     ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
                     "," + oSub.HSecUnitQty.ToString() + "" +
                     ",'" + oSub.FICMOBillNo + "'," + oSub.FICMOInterID.ToString() + ",0,'14036','',1058" +
                     ")";
                    break;
            }
            return RSql;
        }
 
        #endregion
 
 
 
        #region 外购入库
        /// <summary>
        /// 返回外购入库单 新增主表SQL
        /// </summary>
        /// <returns></returns>
        public static string Fun_GetAddBillMainSQL_POStockIn(Model.ClsKf_POStockInBillMain_K3 omodel, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "Insert Into ICStockBill " +
                    "(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" +
                    ",FUpStockWhenSave,FVchInterID,FROB,FHookStatus,Fdate,FSupplyID" +
                    ",FCheckDate,FFManagerID,FSManagerID,FBillerID,FPOStyle,FMultiCheckLevel1" +
                    ",FMultiCheckDate1,FMultiCheckLevel2,FMultiCheckDate2,FMultiCheckLevel3,FMultiCheckDate3,FMultiCheckLevel4" +
                    ",FMultiCheckDate4,FMultiCheckLevel5,FMultiCheckDate5,FMultiCheckLevel6,FMultiCheckDate6" +
                    ",FPOOrdBillNo,FRelateBrID,FOrgBillInterID,FSelTranType" +
                    ",FBrID,FExplanation,FDeptID,FManagerID,FEmpID,FCussentAcctID" +
                    ") " +
                    " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + omodel.HBillType + "',0,0" +
                    ",0,0," + omodel.HRedBlueFlag.ToString() + ",0,'" + omodel.HDate.ToShortDateString() + "'," + omodel.HSupID.ToString() +
                    ",null," + omodel.HSecManagerID.ToString() + "," + omodel.HKeeperID.ToString() + "," + omodel.HBillerID + "," + omodel.HPOStyle.ToString() + ",null" +
                    ",null,null,null,null,null,null" +
                    ",null,null,null,null,null" +
                    ",'',0,0,0" +
                    ",0,'" + omodel.HExplanation + "'," + omodel.HDeptID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HCussentAcctID.ToString() +
                    ") ";
                    break;
                case "12.1":
                    RSql = "Insert Into ICStockBill " +
                    "(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" +
                    ",FUpStockWhenSave,FVchInterID,FROB,FHookStatus,Fdate,FSupplyID" +
                    ",FCheckDate,FFManagerID,FSManagerID,FBillerID,FPOStyle,FMultiCheckLevel1" +
                    ",FMultiCheckDate1,FMultiCheckLevel2,FMultiCheckDate2,FMultiCheckLevel3,FMultiCheckDate3,FMultiCheckLevel4" +
                    ",FMultiCheckDate4,FMultiCheckLevel5,FMultiCheckDate5,FMultiCheckLevel6,FMultiCheckDate6" +
                    ",FPOOrdBillNo,FRelateBrID,FOrgBillInterID,FSelTranType,FPOMode,FOrderAffirm,FPayCondition" +
                    ",FBrID,FExplanation,FDeptID,FManagerID,FEmpID,FCussentAcctID,FManageType,FSettleDate,FPrintCount" +
                    ") " +
                    " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + omodel.HBillType + "',0,0" +
                    ",0,0," + omodel.HRedBlueFlag.ToString() + ",0,'" + omodel.HDate.ToShortDateString() + "'," + omodel.HSupID.ToString() +
                    ",null," + omodel.HSecManagerID.ToString() + "," + omodel.HKeeperID.ToString() + "," + omodel.HBillerID + "," + omodel.HPOStyle.ToString() + ",null" +
                    ",null,null,null,null,null,null" +
                    ",null,null,null,null,null" +
                    ",'',0,0,72,36680,0,0" +
                    ",0,'" + omodel.HExplanation + "'," + omodel.HDeptID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HCussentAcctID.ToString() +
                    ",0,'" + omodel.HDate.ToShortDateString() + "',0) ";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
 
        public static string Fun_GetAddBillSubSQL_POStockIn(Model.ClsKf_POStockInBillSub_K3 oSub, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "Insert into ICStockBillEntry " +
                        " (FInterID,FEntryID,FBrNo,FMapNumber,FMapName" +
                        ",FItemID,FAuxPropID,FBatchNo,FQtyMust,FQty" +
                        ",FUnitID,FAuxQtyMust,Fauxqty,FSecCoefficient,FSecQty" +
                        ",FAuxPlanPrice,FPlanAmount,Fauxprice,Famount,Fnote" +
                        ",FKFDate,FKFPeriod,FPeriodDate,FDCStockID,FDCSPID" +
                        ",FOrgBillEntryID,FSNListID,FSourceBillNo,FSourceTranType,FSourceInterId" +
                        ",FSourceEntryID,FContractBillNo,FContractInterID,FContractEntryID,FOrderBillNo" +
                        ",FOrderInterID,FOrderEntryID,FAllHookQTY,FAllHookAmount,FCurrentHookQTY" +
                        ",FCurrentHookAmount,FAuxQtyInvoice,FQtyInvoice,FChkPassItem" +
                        ") values("
                       + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''" +
                       "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + ",'" + oSub.HBatchNo.ToString() + "'," + oSub.HQtyMust.ToString() + "," + oSub.HQty.ToString() +
                       "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + "," + oSub.HAuxQty.ToString() + ",0,0" +
                       ",0,0," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HRemark + "'" +
                       ",null,0,null," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() +
                       ",0,0,'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() +
                       "," + oSub.HSourceEntryID.ToString() + ",'',0,0,'" + oSub.HPOOrderBillNo + "'" +
                       "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",0,0,0" +
                       ",0,0,0,1058)";
                    break;
                case "12.1":
                    RSql = "Insert into ICStockBillEntry " +
                        " (FInterID,FEntryID,FBrNo,FMapNumber,FMapName" +
                        ",FItemID,FAuxPropID,FBatchNo,FQtyMust,FQty" +
                        ",FUnitID,FAuxQtyMust,Fauxqty,FSecCoefficient,FSecQty" +
                        ",FAuxPlanPrice,FPlanAmount,Fauxprice,Famount,Fnote" +
                        ",FKFDate,FKFPeriod,FPeriodDate,FDCStockID,FDCSPID" +
                        ",FOrgBillEntryID,FSNListID,FSourceBillNo,FSourceTranType,FSourceInterId" +
                        ",FSourceEntryID,FContractBillNo,FContractInterID,FContractEntryID,FOrderBillNo" +
                        ",FOrderInterID,FOrderEntryID,FAllHookQTY,FAllHookAmount,FCurrentHookQTY" +
                        ",FCurrentHookAmount,FAuxQtyInvoice,FQtyInvoice,FSecInvoiceQty,FPlanMode,FMTONo,FChkPassItem" +
                        ") values("
                       + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''" +
                       "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + ",'" + oSub.HBatchNo.ToString() + "'," + oSub.HQtyMust.ToString() + "," + oSub.HQty.ToString() +
                       "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + "," + oSub.HAuxQty.ToString() + ",0,0" +
                       ",0,0," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HRemark + "'" +
                       ",null,0,null," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() +
                       ",0,0,'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() +
                       "," + oSub.HSourceEntryID.ToString() + ",'',0,0,'" + oSub.HPOOrderBillNo + "'" +
                       "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",0,0,0" +
                       ",0,0,0,0,14036,'',1058)";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
        #endregion
 
 
 
        #region 其他入库
        /// <summary>
        /// 返回其他入库单 新增主表SQL
        /// </summary>
        /// <returns></returns>
        public static string Fun_GetAddBillMainSQL_OtherIn(Model.ClsKf_OtherInBillMain_K3 omodel, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "INSERT INTO ICStockBill" +
                           "(FInterID,FBillNo,FBrNo,FTranType,FCancellation" +
                           ",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate" +
                           ",FSupplyID,FCheckDate,FFManagerID,FSManagerID" +
                           ",FBillerID,FDeptID,FBillTypeID,FMultiCheckDate1" +
                           ",FMultiCheckDate2,FMultiCheckDate3,FMultiCheckDate4" +
                           ",FMultiCheckDate5,FVchInterID,FMultiCheckDate6" +
                           ",FPOOrdBillNo,FRelateBrID,FSelTranType,FBrID" +
                           ",FManagerID,FEmpID,FExplanation,FNote) " +
                           "VALUES " +
                           "(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + omodel.HBillType + ",0" +
                           ",0,0,1,0,'" + omodel.HDate.ToShortDateString() + "'" +
                           "," + omodel.HSupplyID + ",Null," + omodel.HFManagerID + "," + omodel.HManagerID + "" +
                           "," + omodel.HBillerID.ToString() + "," + omodel.HDeptID.ToString() + ",0,Null" +
                           ",Null,Null,Null" +
                           ",Null,0,Null" +
                           ",'',0,0,0" +
                           "," + omodel.HManagerID + "," + omodel.HEmpID + ",'" + omodel.HExplanation + "','" + omodel.HRemark +
                           "') ";
                    break;
                case "12.1":
                    RSql = "INSERT INTO ICStockBill" +
                           "(FInterID,FBillNo,FBrNo,FTranType,FCancellation" +
                           ",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate" +
                           ",FSupplyID,FCheckDate,FFManagerID,FSManagerID" +
                           ",FBillerID,FDeptID,FBillTypeID,FMultiCheckDate1" +
                           ",FMultiCheckDate2,FMultiCheckDate3,FMultiCheckDate4" +
                           ",FMultiCheckDate5,FVchInterID,FMultiCheckDate6" +
                           ",FPOOrdBillNo,FRelateBrID,FSelTranType,FBrID" +
                           ",FManagerID,FEmpID,FExplanation,FNote,FManageType) " +
                           "VALUES " +
                           "(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + omodel.HBillType + ",0" +
                           ",0,0,1,0,'" + omodel.HDate.ToShortDateString() + "'" +
                           "," + omodel.HSupplyID + ",Null," + omodel.HFManagerID + "," + omodel.HSManagerID + "" +
                           "," + omodel.HBillerID.ToString() + "," + omodel.HDeptID.ToString() + ",0,Null" +
                           ",Null,Null,Null" +
                           ",Null,0,Null" +
                           ",'',0,0,0" +
                           "," + omodel.HManagerID + "," + omodel.HEmpID + ",'" + omodel.HExplanation + "','" + omodel.HRemark +
                           "',0) ";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
 
        public static string Fun_GetAddBillSubSQL_OtherIn(Model.ClsKf_OtherInBillSub_K3 oSub, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "INSERT INTO ICStockBillEntry " +
                           "(FInterID,FEntryID,FBrNo,FMapNumber,FMapName" +
                           ",FItemID,FAuxPropID,FBatchNo,FQtyMust,FQty" +
                           ",FUnitID,FAuxQtyMust,Fauxqty,FSecCoefficient" +
                           ",FSecQty,FAuxPlanPrice,FPlanAmount,Fauxprice" +
                           ",Famount,Fnote,FKFDate,FKFPeriod,FPeriodDate" +
                           ",FDCStockID,FDCSPID,FSNListID" +
                           ",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
                           ",FOrderBillNo,FOrderInterID,FOrderEntryID,FChkPassItem)" +
                           "VALUES " +
                           "(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''" +
                           "," + oSub.HMaterID + "," + oSub.HPropertyID + ",'" + oSub.HBatchNo + "'," + oSub.HQtyMust + "," + oSub.HQty + "" +
                           "," + oSub.HUnitID + "," + oSub.HAuxQtyMust + "," + oSub.HAuxqty + ",0" +
                           ",0," + oSub.HAuxPlanPrice + ",0," + oSub.HAuxprice + "" +
                           "," + oSub.HAmount + ",'" + oSub.HRemark + "',Null,0,Null" +
                           "," + oSub.HDCStockID + "," + oSub.HDCSPID + ",0" +
                           ",'',0,0,0" +
                           ",'',0,0,1058)";
                    break;
                case "12.1":
                    RSql = "INSERT INTO ICStockBillEntry " +
                           "(FInterID,FEntryID,FBrNo,FMapNumber,FMapName" +
                           ",FItemID,FAuxPropID,FBatchNo,FQtyMust,FQty" +
                           ",FUnitID,FAuxQtyMust,Fauxqty,FSecCoefficient" +
                           ",FSecQty,FAuxPlanPrice,FPlanAmount,Fauxprice" +
                           ",Famount,Fnote,FKFDate,FKFPeriod,FPeriodDate" +
                           ",FDCStockID,FDCSPID,FSNListID" +
                           ",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
                           ",FOrderBillNo,FOrderInterID,FOrderEntryID,FPlanMode,FMTONo,FCostPercentage,FChkPassItem)" +
                           "VALUES " +
                           "(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''" +
                           "," + oSub.HMaterID + "," + oSub.HPropertyID + ",'" + oSub.HBatchNo + "'," + oSub.HQtyMust + "," + oSub.HQty + "" +
                           "," + oSub.HUnitID + "," + oSub.HAuxQtyMust + "," + oSub.HAuxqty + ",0" +
                           ",0," + oSub.HAuxPlanPrice + ",0," + oSub.HAuxprice + "" +
                           "," + oSub.HAmount + ",'" + oSub.HRemark + "',Null,0,Null" +
                           "," + oSub.HDCStockID + "," + oSub.HDCSPID + ",0" +
                           ",'',0,0,0" +
                           ",'',0,0,14036,'',0,1058)";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
        #endregion
 
 
 
        #region 调拨单
        /// <summary>
        /// 返回调拨单 新增主表SQL
        /// </summary>
        /// <returns></returns>
        public static string Fun_GetAddBillMainSQL_MoveStock(Model.ClsKf_MoveStockBillMain_K3 omodel, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "Insert Into ICStockBill " +
                    "(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
                    ",FStatus,FUpStockWhenSave,FHookStatus,Fdate,FCheckDate " +
                    ",FFManagerID,FSManagerID,FBillerID,FMultiCheckDate1,FMultiCheckDate2 " +
                    ",FMultiCheckDate3,FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " +
                    ",FSelTranType,FBrID,FDeptID,FEmpID,FRefType" +
                    ") " +
                    " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + omodel.HBillType + ",0" +
                    ",0,0,0,'" + omodel.HDate.ToShortDateString() + "',null" +
                    "," + omodel.HSecManagerID.ToString() + "," + omodel.HKeeperID.ToString() + "," + omodel.HBillerID.ToString() + ",null,null" +
                    ",null,null,null,null" +
                    ",0,0," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",12561" +
                    ") ";
                    break;
                case "12.1":
                    RSql = "Insert Into ICStockBill " +
                    "(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
                    ",FStatus,FUpStockWhenSave,FHookStatus,Fdate,FCheckDate " +
                    ",FFManagerID,FSManagerID,FBillerID,FMultiCheckDate1,FMultiCheckDate2 " +
                    ",FMultiCheckDate3,FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " +
                    ",FSelTranType,FBrID,FDeptID,FEmpID,FRefType" +
                    ") " +
                    " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + omodel.HBillType + ",0" +
                    ",0,0,0,'" + omodel.HDate.ToShortDateString() + "',null" +
                    "," + omodel.HSecManagerID.ToString() + "," + omodel.HKeeperID.ToString() + "," + omodel.HBillerID.ToString() + ",null,null" +
                    ",null,null,null,null" +
                    ",0,0," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",12561" +
                    ") ";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
 
        public static string Fun_GetAddBillSubSQL_MoveStock(Model.ClsKf_MoveStockBillSub_K3 oSub, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "12.2":
                    RSql = "Insert into ICStockBillEntry " +
                        " (FInterID,FEntryID,FBrNo,FItemID,FAuxPropID " +
                        ",FBatchNo,FQty,FUnitID,Fauxqty,FSecCoefficient" +
                        ",FSecQty,FAuxPlanPrice,FPlanAmount,Fauxprice,Famount" +
                        ",FAuxPriceRef,FAmtRef,Fnote,FKFDate,FKFPeriod,FPeriodDate" +
                        ",FSCStockID,FSCSPID,FDCStockID,FDCSPID" +
                        ",FSNListID,FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
                        ",FICMOBillNo,FICMOInterID,FPPBomEntryID,FOrderBillNo,FOrderInterID" +
                        ",FOrderEntryID,FChkPassItem" + 
                        ") values("
                       + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "" +
                       ",'" + oSub.HBatchNo.ToString() + "'," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0" +
                       ",0,0,0" + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",0" +
                       ",0,0,'" + oSub.HRemark + "',null,0,null" +
                       "," + oSub.HSCWHID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() +
                       ",0,'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
                       ",'',0,0,'',0" +
                       ",0,1058" + 
                       ")";
                    break;
                case "12.1":
                    RSql = "Insert into ICStockBillEntry " +
                        " (FInterID,FEntryID,FBrNo,FItemID,FAuxPropID " +
                        ",FBatchNo,FQty,FUnitID,Fauxqty,FSecCoefficient" +
                        ",FSecQty,FAuxPlanPrice,FPlanAmount,Fauxprice,Famount" +
                        ",FAuxPriceRef,FAmtRef,Fnote,FKFDate,FKFPeriod,FPeriodDate" +
                        ",FSCStockID,FSCSPID,FDCStockID,FDCSPID" +
                        ",FSNListID,FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
                        ",FICMOBillNo,FICMOInterID,FPPBomEntryID,FOrderBillNo,FOrderInterID" +
                        ",FOrderEntryID,FPlanMode,FMTONo,FChkPassItem" +
                        ") values("
                       + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0'," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "" +
                       ",'" + oSub.HBatchNo.ToString() + "'," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0" +
                       ",0,0,0" + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",0" +
                       ",0,0,'" + oSub.HRemark + "',null,0,null" +
                       "," + oSub.HSCWHID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() +
                       ",0,'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
                       ",'',0,0,'',0" +
                       ",0,14036,'',1058" +
                       ")";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
        #endregion
 
 
 
 
        #region 生产任务单
        /// <summary>
        /// 返回生产任务单 新增主表SQL
        /// </summary>
        /// <returns></returns>
        public static string Fun_GetAddBillMainSQL_ICMO(Model.ClsSc_ICMOBillMain_K3 omodel, string VNum)
        {
            string RSql = "";
            switch (VNum)
            {
                case "13.0":
                    RSql = "";
                    break;
                case "12.2":
                    RSql = "";
                    break;
                case "12.1":
                    RSql = "INSERT INTO ICMO(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
                          ",FCheckDate,Fstatus,FMRP,FItemID,FCostObjID " +
                          ",FBomInterID,FRoutingID,FWorkShop,FSupplyID,FWorktypeID " +
                          ",FUnitID,Fauxqty,FPlanCommitDate,FPlanFinishDate,Fnote " +
                          ",FCommitDate,FBillerID,FOrderInterID,FParentInterID,FPPOrderInterID,FType " +
                          ",FSourceEntryID,FProcessPrice,FProcessFee,FPlanOrderInterID,FScheduleID " +
                          ",FCustID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3 " +
                          ",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FConfirmDate " +
                          ",FInHighLimit,FAuxInHighLimitQty,FInLowLimit,FAuxInLowLimitQty,FGMPBatchNo " +
                          ",FChangeTimes,FMrpLockFlag,FCloseDate,FPlanMode,FMtoNo " +
                          ",FHeadSelfJ0196,FHeadSelfJ0197,FHeadSelfJ0198,FHeadSelfJ0199 " +
                          ",FHeadSelfJ01100,FHeadSelfJ01101,FHeadSelfJ01102,FHeadSelfJ01103,FHeadSelfJ01104 " +
                          ",FPlanConfirmed,FPrintCount,FCardClosed,FHRReadyTime,FFinClosed " +
                          ",FFinCloseer,FFinClosedate,FStockFlag) " +
                          "VALUES (" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + omodel.HBillType + "',0" +
                          ",getdate(),0,1052," + omodel.HMaterID.ToString() + "," + omodel.HCostObjID.ToString() +
                          "," + omodel.HBomID.ToString() + "," + omodel.HRoutingInterID.ToString() + "," + omodel.HDeptID.ToString() + ",0,56" +
                          "," + omodel.HUnitID.ToString() + "," + omodel.HPlanQty.ToString() + ",'" + omodel.HPlanBeginDate.ToShortDateString() + "','" + omodel.HPlanEndDate.ToShortDateString() + "','" + omodel.HRemark + "'" +
                          ",Null," + omodel.HBillerID.ToString() + "," + omodel.HSeOrderInterID.ToString() + ",0,0,'" + DBUtility.ClsPub.isStrNull(omodel.HType) + "'" +
                          "," + omodel.HSeOrderEntryID.ToString() + ",0,0,0,0" +
                          "," + omodel.HCusID.ToString() + ",Null,Null,Null" +
                          ",Null,Null,Null,Null" +
                           ",0," + omodel.HPlanQty.ToString() + ",0," + omodel.HPlanQty.ToString() + ",'" + omodel.HBatchNo + "'" +
                           ",0,0,Null,14036,''" +
                           "," + omodel.HAreaID.ToString() + "," + omodel.HRoutingID.ToString() + ",'" + omodel.HDiameter1.ToString() + "','" + omodel.HDiameter2.ToString() +
                           "','" + omodel.HDiameter3.ToString() + "'," + omodel.HWhID.ToString() + "," + omodel.HBillingID.ToString() + "," + omodel.HFormulaID.ToString() + "," + omodel.HBillingID.ToString() + 
                           ",0,0,1059,0,0" +
                           ",0,Null,14215  )";
                    break;
                default:
                    break;
            }
            return RSql;
        }
 
 
        #endregion
 
 
    }
}