丰州同步程序(已移交给金睿)
ch
2021-09-14 8b2ca4dfd8a581378ce2759ddd7c3420cc42d151
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
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
 
namespace EDI
{
    public  class clsEnvelopS
    {
        public clsZOCT_EnvelopS omodel = new clsZOCT_EnvelopS();
        public List<clsZOCT_Detail856> DetailColl = new List<clsZOCT_Detail856>();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
 
 
        public string DateIsNull(string s)
        {
            if (s == "" || s.Trim().Length == 0)
            {
                return " null ";
            }
            else
            {
                return "'" + s + "'";
            }
        }
 
        public string IntIsNull(Int64 s)
        {
            if (s == 0  )
            {
                return " null ";
            }
            else
            {
                return s.ToString();
            }
        }
 
        //ÐÂÔö 856
        public bool AddBill(ref string sReturn,ref Int64 sBackID)
        {
            try
            { 
                //
                oCn.BeginTran();
                //Ö÷±í
                DataSet ds= oCn.RunProcReturn("Insert Into ZOCT_EnvelopS   " +
                "(EnvelopSCompleted,EnvelopSFile,MessageTypeCode,MessageType" +
                ",ReleaseVersion,ReceiverID,SenderID" +
                ") " +
                " values(" + DBUtility.ClsPub.BoolToString(omodel.EnvelopSCompleted) + ",'" + omodel.EnvelopSFile + "','" + omodel.MessageTypeCode + "','" + omodel.MessageType + "'" +
                ",'" + omodel.ReleaseVersion + "','" + omodel.ReceiverID + "','" + omodel.SenderID + "'" +
                ") select sid=@@IDENTITY", "ZOCT_EnvelopS");
                //
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "дÈëÖ÷±íʧ°Ü£¡";
                    oCn.RollBack();
                    return false;
                }
                Int64 IEnvelopSID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]);
                
                if (IEnvelopSID <= 0)
                {
                    sReturn = "дÈëÖ÷±íʧ°Ü2£¡";
                    oCn.RollBack();
                    return false;
                }
                //²åÈë×Ó±í
                foreach (clsZOCT_Detail856 oSub in DetailColl)
                {
                    oCn.RunProc("Insert into ZOCT_Detail856 " +
                        " (EnvelopSID,GenerateID,InterchangeControlNum,ASNCreationDateTime" +
                        ",ShipToGSDBCode,ShipFromGSDBCode,IntermediateConsignee,MessagePurpose" +
                        ",ShipmentID,ShippedDateTime,GrossWeight,NetWeight" +
                        ",UOM1,PackagingTypeCode,LadingQty,CarrierSCACCode" +
                        ",TransportationMethodCode,EquipmentDescCode,EquipmentNum,BillOfLadingNum" +
                        ",PartNum,PurchaseOrderNum,ShippedQty,CumShippedQty" +
                        ",UOM2,NumberOfLoad,QtyPerLoad,PackagingCode" +
                        ",AirportCode" +
                        ") values("
                        + IEnvelopSID.ToString() + ",null,'" + oSub.InterchangeControlNum + "'," + DateIsNull(oSub.ASNCreationDateTime) + 
                        ",'" + oSub.ShipToGSDBCode + "','" + oSub.ShipFromGSDBCode + "','" + oSub.IntermediateConsignee + "','" + oSub.MessagePurpose + "'" +
                        ",'" + oSub.ShipmentID + "'," + DateIsNull(oSub.ShippedDateTime) + "," + oSub.GrossWeight.ToString() + "," + oSub.NetWeight.ToString() +
                        ",'" + oSub.UOM1 + "','" + oSub.PackagingTypeCode + "'," + oSub.LadingQty.ToString() + ",'" + oSub.CarrierSCACCode + "'" +
                        ",'" + oSub.TransportationMethodCode + "','" + oSub.EquipmentDescCode + "','" + oSub.EquipmentNum + "','" + oSub.BillOfLadingNum + "'" +
                        ",'" + oSub.PartNum + "','" + oSub.PurchaseOrderNum + "'," + oSub.ShippedQty.ToString() + "," + oSub.CumShippedQty.ToString() +
                        ",'" + oSub.UOM2 + "'," + oSub.NumberOfLoad.ToString() + "," + oSub.QtyPerLoad.ToString() + ",'" + oSub.PackagingCode + "'" +
                        ",'" + oSub.AirportCode + "'" +
                        ") ");
                } 
                //
                sReturn = "ÐÂÔöµ¥¾Ý³É¹¦£¡";
                oCn.Commit();
                sBackID = IEnvelopSID;
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                return false;
            }
        }
 
        //ÐÂÔö 830
 
         
 
 
 
    }
}