Beispiel #1
0
        public RMAOutBoundInfo Load(int sysno)
        {
            string  sql = "select * from rma_outbound (NOLOCK) where sysno = " + sysno;
            DataSet ds  = SqlHelper.ExecuteDataSet(sql);

            if (!Util.HasMoreRow(ds))
            {
                return(null);
            }

            RMAOutBoundInfo oOut = new RMAOutBoundInfo();

            map(oOut, ds.Tables[0].Rows[0]);

            string  sql_item = "select registersysno from rma_outbound_item (NOLOCK) where outboundsysno = " + sysno;
            DataSet ds_item  = SqlHelper.ExecuteDataSet(sql_item);

            foreach (DataRow dr in ds_item.Tables[0].Rows)
            {
                oOut.itemHash.Add(Util.TrimIntNull(dr["registerSysNo"]), null);
            }
            RMARegisterManager.GetInstance().ConvertRegisterBoundleHash(oOut.itemHash);

            return(oOut);
        }
Beispiel #2
0
 private void map(RMAOutBoundInfo oParam, DataRow tempdr)
 {
     oParam.SysNo              = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.OutBoundID         = Util.TrimNull(tempdr["OutBoundID"]);
     oParam.VendorSysNo        = Util.TrimIntNull(tempdr["VendorSysNo"]);
     oParam.CreateTime         = Util.TrimDateNull(tempdr["CreateTime"]);
     oParam.CreateUserSysNo    = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.VendorName         = Util.TrimNull(tempdr["VendorName"]);
     oParam.ZIP                = Util.TrimNull(tempdr["Zip"]);
     oParam.Address            = Util.TrimNull(tempdr["Address"]);
     oParam.Contact            = Util.TrimNull(tempdr["Contact"]);
     oParam.Phone              = Util.TrimNull(tempdr["Phone"]);
     oParam.OutTime            = Util.TrimDateNull(tempdr["OutTime"]);
     oParam.OutUserSysNo       = Util.TrimIntNull(tempdr["OutUserSysNo"]);
     oParam.Note               = Util.TrimNull(tempdr["Note"]);
     oParam.Status             = Util.TrimIntNull(tempdr["Status"]);
     oParam.EOutBoundDate      = Util.TrimDateNull(tempdr["EOutBoundDate"]);
     oParam.EResponseDate      = Util.TrimDateNull(tempdr["EResponseDate"]);
     oParam.AreaSysNo          = Util.TrimIntNull(tempdr["AreaSysNo"]);
     oParam.OutBoundInvoiceQty = Util.TrimIntNull(tempdr["OutBoundInvoiceQty"]);
     oParam.ShipType           = Util.TrimIntNull(tempdr["ShipType"]);
     oParam.PackageID          = Util.TrimNull(tempdr["PackageID"]);
     oParam.CheckQtyUserSysNo  = Util.TrimIntNull(tempdr["CheckQtyUserSysNo"]);
     oParam.CheckQtyTime       = Util.TrimDateNull(tempdr["CheckQtyTime"]);
     oParam.FreightUserSysNo   = Util.TrimIntNull(tempdr["FreightUserSysNo"]);
     oParam.SetDeliveryManTime = Util.TrimDateNull(tempdr["SetDeliveryManTime"]);
 }
Beispiel #3
0
        public void Create(RMAOutBoundInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                oParam.SysNo      = SequenceDac.GetInstance().Create("RMA_OutBound_Sequence");
                oParam.OutBoundID = getOutBoundID(oParam.SysNo);

                new RMAOutBoundDac().InsertMaster(oParam);
                int OutBoundInvoiceQty = 0;
                foreach (int registerSysNo in oParam.itemHash.Keys)
                {
                    object item = oParam.itemHash[registerSysNo];
                    this.InsertItem(oParam.SysNo, registerSysNo);
                    Hashtable htRegister = new Hashtable();
                    htRegister.Add("SysNo", registerSysNo);
                    htRegister.Add("OutBoundWithInvoice", Util.TrimIntNull(item.ToString()));

                    RMARegisterManager.GetInstance().UpdateRegister(htRegister);
                    if (Util.TrimIntNull(item.ToString()) == (int)AppEnum.OutBoundWithInvoice.SendWithInvoice)
                    {
                        OutBoundInvoiceQty = OutBoundInvoiceQty + 1;
                    }
                    else
                    {
                        OutBoundInvoiceQty = OutBoundInvoiceQty + 0;
                    }
                }
                Hashtable htOutBound = new Hashtable();
                htOutBound.Add("SysNo", oParam.SysNo);
                htOutBound.Add("OutBoundInvoiceQty", OutBoundInvoiceQty);
                RMAOutBoundManager.GetInstance().UpdateMaster(htOutBound);
                scope.Complete();
            }
        }
Beispiel #4
0
        public int InsertMaster(RMAOutBoundInfo oParam)
        {
            string     sql = @"INSERT INTO RMA_OutBound
                            (
                            SysNo, OutBoundID, VendorSysNo, CreateTime, 
                            CreateUserSysNo, VendorName, Zip, Address, 
                            Contact, Phone, OutTime, OutUserSysNo, 
                            Note, Status, EOutBoundDate, EResponseDate, 
                            AreaSysNo, OutBoundInvoiceQty, ShipType, PackageID, 
                            CheckQtyUserSysNo, CheckQtyTime, FreightUserSysNo, SetDeliveryManTime
                            )
                            VALUES (
                            @SysNo, @OutBoundID, @VendorSysNo, @CreateTime, 
                            @CreateUserSysNo, @VendorName, @Zip, @Address, 
                            @Contact, @Phone, @OutTime, @OutUserSysNo, 
                            @Note, @Status, @EOutBoundDate, @EResponseDate, 
                            @AreaSysNo, @OutBoundInvoiceQty, @ShipType, @PackageID, 
                            @CheckQtyUserSysNo, @CheckQtyTime, @FreightUserSysNo, @SetDeliveryManTime
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo              = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramOutBoundID         = new SqlParameter("@OutBoundID", SqlDbType.NVarChar, 20);
            SqlParameter paramVendorSysNo        = new SqlParameter("@VendorSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime         = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramCreateUserSysNo    = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramVendorName         = new SqlParameter("@VendorName", SqlDbType.NVarChar, 100);
            SqlParameter paramZip                = new SqlParameter("@Zip", SqlDbType.NVarChar, 10);
            SqlParameter paramAddress            = new SqlParameter("@Address", SqlDbType.NVarChar, 200);
            SqlParameter paramContact            = new SqlParameter("@Contact", SqlDbType.NVarChar, 50);
            SqlParameter paramPhone              = new SqlParameter("@Phone", SqlDbType.NVarChar, 50);
            SqlParameter paramOutTime            = new SqlParameter("@OutTime", SqlDbType.DateTime);
            SqlParameter paramOutUserSysNo       = new SqlParameter("@OutUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramNote               = new SqlParameter("@Note", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus             = new SqlParameter("@Status", SqlDbType.Int, 4);
            SqlParameter paramEOutBoundDate      = new SqlParameter("@EOutBoundDate", SqlDbType.DateTime);
            SqlParameter paramEResponseDate      = new SqlParameter("@EResponseDate", SqlDbType.DateTime);
            SqlParameter paramAreaSysNo          = new SqlParameter("@AreaSysNo", SqlDbType.Int, 4);
            SqlParameter paramOutBoundInvoiceQty = new SqlParameter("@OutBoundInvoiceQty", SqlDbType.Int, 4);
            SqlParameter paramShipType           = new SqlParameter("@ShipType", SqlDbType.Int, 4);
            SqlParameter paramPackageID          = new SqlParameter("@PackageID", SqlDbType.NVarChar, 50);
            SqlParameter paramCheckQtyUserSysNo  = new SqlParameter("@CheckQtyUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCheckQtyTime       = new SqlParameter("@CheckQtyTime", SqlDbType.DateTime);
            SqlParameter paramFreightUserSysNo   = new SqlParameter("@FreightUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramSetDeliveryManTime = new SqlParameter("@SetDeliveryManTime", SqlDbType.DateTime);

            if (oParam.SysNo != AppConst.IntNull)
            {
                paramSysNo.Value = oParam.SysNo;
            }
            else
            {
                paramSysNo.Value = System.DBNull.Value;
            }
            if (oParam.OutBoundID != AppConst.StringNull)
            {
                paramOutBoundID.Value = oParam.OutBoundID;
            }
            else
            {
                paramOutBoundID.Value = System.DBNull.Value;
            }
            if (oParam.VendorSysNo != AppConst.IntNull)
            {
                paramVendorSysNo.Value = oParam.VendorSysNo;
            }
            else
            {
                paramVendorSysNo.Value = System.DBNull.Value;
            }
            if (oParam.CreateTime != AppConst.DateTimeNull)
            {
                paramCreateTime.Value = oParam.CreateTime;
            }
            else
            {
                paramCreateTime.Value = System.DBNull.Value;
            }
            if (oParam.CreateUserSysNo != AppConst.IntNull)
            {
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            }
            else
            {
                paramCreateUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.VendorName != AppConst.StringNull)
            {
                paramVendorName.Value = oParam.VendorName;
            }
            else
            {
                paramVendorName.Value = System.DBNull.Value;
            }
            if (oParam.ZIP != AppConst.StringNull)
            {
                paramZip.Value = oParam.ZIP;
            }
            else
            {
                paramZip.Value = System.DBNull.Value;
            }
            if (oParam.Address != AppConst.StringNull)
            {
                paramAddress.Value = oParam.Address;
            }
            else
            {
                paramAddress.Value = System.DBNull.Value;
            }
            if (oParam.Contact != AppConst.StringNull)
            {
                paramContact.Value = oParam.Contact;
            }
            else
            {
                paramContact.Value = System.DBNull.Value;
            }
            if (oParam.Phone != AppConst.StringNull)
            {
                paramPhone.Value = oParam.Phone;
            }
            else
            {
                paramPhone.Value = System.DBNull.Value;
            }
            if (oParam.OutTime != AppConst.DateTimeNull)
            {
                paramOutTime.Value = oParam.OutTime;
            }
            else
            {
                paramOutTime.Value = System.DBNull.Value;
            }
            if (oParam.OutUserSysNo != AppConst.IntNull)
            {
                paramOutUserSysNo.Value = oParam.OutUserSysNo;
            }
            else
            {
                paramOutUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.Note != AppConst.StringNull)
            {
                paramNote.Value = oParam.Note;
            }
            else
            {
                paramNote.Value = System.DBNull.Value;
            }
            if (oParam.Status != AppConst.IntNull)
            {
                paramStatus.Value = oParam.Status;
            }
            else
            {
                paramStatus.Value = System.DBNull.Value;
            }
            if (oParam.EOutBoundDate != AppConst.DateTimeNull)
            {
                paramEOutBoundDate.Value = oParam.EOutBoundDate;
            }
            else
            {
                paramEOutBoundDate.Value = System.DBNull.Value;
            }
            if (oParam.EResponseDate != AppConst.DateTimeNull)
            {
                paramEResponseDate.Value = oParam.EResponseDate;
            }
            else
            {
                paramEResponseDate.Value = System.DBNull.Value;
            }
            if (oParam.AreaSysNo != AppConst.IntNull)
            {
                paramAreaSysNo.Value = oParam.AreaSysNo;
            }
            else
            {
                paramAreaSysNo.Value = System.DBNull.Value;
            }
            if (oParam.OutBoundInvoiceQty != AppConst.IntNull)
            {
                paramOutBoundInvoiceQty.Value = oParam.OutBoundInvoiceQty;
            }
            else
            {
                paramOutBoundInvoiceQty.Value = System.DBNull.Value;
            }
            if (oParam.ShipType != AppConst.IntNull)
            {
                paramShipType.Value = oParam.ShipType;
            }
            else
            {
                paramShipType.Value = System.DBNull.Value;
            }
            if (oParam.PackageID != AppConst.StringNull)
            {
                paramPackageID.Value = oParam.PackageID;
            }
            else
            {
                paramPackageID.Value = System.DBNull.Value;
            }
            if (oParam.CheckQtyUserSysNo != AppConst.IntNull)
            {
                paramCheckQtyUserSysNo.Value = oParam.CheckQtyUserSysNo;
            }
            else
            {
                paramCheckQtyUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.CheckQtyTime != AppConst.DateTimeNull)
            {
                paramCheckQtyTime.Value = oParam.CheckQtyTime;
            }
            else
            {
                paramCheckQtyTime.Value = System.DBNull.Value;
            }
            if (oParam.FreightUserSysNo != AppConst.IntNull)
            {
                paramFreightUserSysNo.Value = oParam.FreightUserSysNo;
            }
            else
            {
                paramFreightUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.SetDeliveryManTime != AppConst.DateTimeNull)
            {
                paramSetDeliveryManTime.Value = oParam.SetDeliveryManTime;
            }
            else
            {
                paramSetDeliveryManTime.Value = System.DBNull.Value;
            }

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramOutBoundID);
            cmd.Parameters.Add(paramVendorSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramVendorName);
            cmd.Parameters.Add(paramZip);
            cmd.Parameters.Add(paramAddress);
            cmd.Parameters.Add(paramContact);
            cmd.Parameters.Add(paramPhone);
            cmd.Parameters.Add(paramOutTime);
            cmd.Parameters.Add(paramOutUserSysNo);
            cmd.Parameters.Add(paramNote);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramEOutBoundDate);
            cmd.Parameters.Add(paramEResponseDate);
            cmd.Parameters.Add(paramAreaSysNo);
            cmd.Parameters.Add(paramOutBoundInvoiceQty);
            cmd.Parameters.Add(paramShipType);
            cmd.Parameters.Add(paramPackageID);
            cmd.Parameters.Add(paramCheckQtyUserSysNo);
            cmd.Parameters.Add(paramCheckQtyTime);
            cmd.Parameters.Add(paramFreightUserSysNo);
            cmd.Parameters.Add(paramSetDeliveryManTime);

            return(SqlHelper.ExecuteNonQuery(cmd));
        }