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
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
 
namespace DAL
{
    public class ClsK3_MatePriceSup_Ctl:DBUtility.ClsGy_Base_Ctl 
    {
        SQLHelper.ClsCNK3 oK3Cn = new SQLHelper.ClsCNK3();
 
        public Model.ClsK3_MatePriceSup_Model oModel ;
 
        //K3单据新增
        public bool AddNew_K3()
        {
            try
            {
                oK3Cn.BeginTran();
                DataSet Ds;
                //得到mainid
                Ds = oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 't_Supply', @InterID output, 1, 16394 select ltrim(@InterID)", "GetICMaxNum");
                oModel.HEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                oK3Cn.RunProc("Insert into " + MvarItemKey + " " +
                    " (FEntryID,FBrNo,FSupID,FItemID,FUnitID" +
                    ",FStartQty,FEndQty,FPrice,FCyID,FDiscount" +
                    ",FLeadTime,FQuoteTime,FUsed,FDisableDate,FRemark" +
                    ",FPType,FLastModifiedDate,FLastModifiedBy) " +
                    " Values(" + oModel.HEntryID.ToString() + ",0," + oModel.HSupID.ToString() + "," + oModel.HMaterID.ToString() + "," + oModel.HUnitID.ToString() +
                      "," + oModel.HStartQty.ToString() + "," + oModel.HEndQty.ToString() + "," + oModel.HPrice.ToString() + "," + oModel.HCurID.ToString() + "," + oModel.HDiscount.ToString() +
                      ",0,'" + oModel.HQuoteTime.ToShortDateString() + "'," + DBUtility.ClsPub.BoolToString(oModel.HUsed) + ",'" + oModel.HDisableDate.ToShortDateString() + "','" + oModel.HRemark + "'" +
                      ",1,getdate(),16394" +
                    ")", ref DBUtility.ClsPub.sExeReturnInfo);
                oK3Cn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oK3Cn.RollBack();
                throw (e);
            }
        }
         
        //构造函数
        public ClsK3_MatePriceSup_Ctl()
        {
            MvarItemKey = "t_SupplyEntry";
            MvarReportTitle = "采购价格表设置";
            oModel = new Model.ClsK3_MatePriceSup_Model();
        } 
    }
}