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
  | using System; 
 |  using System.Collections.Generic; 
 |  using System.Linq; 
 |  using System.Web; 
 |    
 |  namespace WebAPI.DLL 
 |  { 
 |      public class ClsWW_EntrustProcessSendOutBill : DBUtility.ClsXt_BaseBill 
 |      { 
 |          public WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain omodel = new WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain(); 
 |          public List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillSub> DetailColl = new List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillSub>(); 
 |    
 |          public ClsWW_EntrustProcessSendOutBill() 
 |          { 
 |    
 |              base.MvarItemKeySub = "WW_EntrustProcessSendOutBillSub"; 
 |              base.MvarItemKeySub2 = ""; 
 |              base.MvarItemKeySub3 = ""; 
 |              base.MvarItemKeySub4 = ""; 
 |              base.MvarItemKey = "WW_EntrustProcessSendOutBillMain"; 
 |              base.MvarReportTitle = "委外工序计划转出单"; 
 |              base.BillType = "3741"; 
 |              base.HBillSubType = "3741"; 
 |          } 
 |    
 |          #region 固定代码 
 |    
 |          ~ClsWW_EntrustProcessSendOutBill() 
 |          { 
 |              DetailColl = null; 
 |          } 
 |    
 |          #endregion   自定义方法 
 |    
 |          //新增单据 
 |          public override bool AddBill(ref string sReturn) 
 |          { 
 |              try 
 |              { 
 |                  //得到mainid 
 |                  omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); 
 |                  //若MAINDI重复则重新获取 
 |                  oCn.BeginTran(); 
 |                  //主表 
 |                  oCn.RunProc("Insert Into WW_EntrustProcessSendOutBillMain   " + 
 |                  "(HYear, HPeriod, HBillType, HBillSubType, HInterID" + 
 |                  ",HDate, HBillNo, HBillStatus, HCheckItemNowID, HCheckItemNextID" + 
 |                  ",HCheckFlowID, HRemark, HBacker, HBackDate, HBackRemark" + 
 |                  ",HChecker, HCheckDate, HMaker, HMakeDate, HUpDater" + 
 |                  ",HUpDateDate, HCloseMan, HCloseDate, HCloseType,HDeleteMan" + 
 |                  ",HDeleteDate,HMainSourceBillType, HMainSourceInterID, HMainSourceEntryID, HMainSourceBillNo" + 
 |                  ",[HPrintQty], [HDeptID], [HSupID], [HEmpID], [HExplanation], [HInnerBillNo]" + 
 |                  ") " + 
 |                  " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + this.BillType + "','" + omodel.HBillSubType + "'," + omodel.HInterID.ToString() + 
 |                  ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() + 
 |                  "," + omodel.HCheckFlowID.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBacker + "','" + omodel.HBackDate + "','" + omodel.HBackRemark + "'" + 
 |                  ",'" + omodel.HChecker + "','" + omodel.HCheckDate + "','" + DBUtility.ClsPub.CurUserName + "',getdate(),'" + omodel.HUpDater + "'" + 
 |                  ",'" + omodel.HUpDateDate + "','" + omodel.HCloseMan + "','" + omodel.HCloseDate + "'," + Convert.ToString(omodel.HCloseType ? 1 : 0) + ",'" + omodel.HDeleteMan + "'" + 
 |                  ",'" + omodel.HDeleteDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "'" + 
 |                  "," + omodel.HPrintQty.ToString() + ",'" + omodel.HDeptID + "'," + omodel.HSupID.ToString() + "," + omodel.HEmpID.ToString()  + 
 |                  ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" + 
 |                  ") "); 
 |                  //插入子表 
 |                  foreach (Models.ClsWW_EntrustProcessSendOutBillSub oSub in DetailColl) 
 |                  { 
 |                      oCn.RunProc("Insert into WW_EntrustProcessSendOutBillSub " + 
 |  "([HInterID], [HBillNo_bak], [HEntryID], [HCloseMan], [HEntryCloseDate], [HCloseType], [HRemark], [HSourceInterID]" + 
 |  ",[HSourceEntryID], [HSourceBillNo], [HSourceBillType], [HRelationQty], [HRelationMoney], [HProcID]" + 
 |  ", [HSupFlag], [HMaterID], [HQty],[HPrice], [HMoney], [HBatchNo], [HPackType], [HProcPlanInterID]" + 
 |  ", [HProcPlanEntryID], [HProcPlanBillNo], [HICMOInterID], [HICMOEntryID], [HICMOBillNo], [HSeOrderInterID], [HSeOrderEntryID],[HSeOrderBillNo]" + 
 |  ") " + 
 |  "values(" + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + oSub.HEntryCloseDate.ToShortDateString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + 
 |                    "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + 
 |                    "," + oSub.HRelationMoney.ToString() + "," + oSub.HProcID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HMaterID.ToString() + "," + oSub.HQty.ToString() + 
 |                    ","  + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HPackType+"'" + 
 |                    "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo+ "'," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + 
 |                    ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo +"'"+ 
 |                     ") "); 
 |    
 |                  } 
 |                  sReturn = "新增单据成功!"; 
 |                  oCn.Commit(); 
 |                  return true; 
 |              } 
 |              catch (Exception e) 
 |              { 
 |                  sReturn = e.Message; 
 |                  oCn.RollBack(); 
 |                  throw (e); 
 |              } 
 |          } 
 |    
 |      } 
 |  } 
 |  
  |