Exemplo n.º 1
0
        public void Delete(FactoryArgs args, t_BigID ModifyBillHeaderID)
        {
            using (DataTable dtHeader = _DALModifyBillHeader.GetModifyBillHeader(args, ModifyBillHeaderID))
            {
                DataRow drHeader     = dtHeader.Rows[0];
                bool    bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]);
                bool    bolIsCancel  = LBConverter.ToBoolean(drHeader["IsCancel"]);
                if (bolIsApprove)
                {
                    throw new Exception("该调价单已审核,无法删除!");
                }

                if (bolIsCancel)
                {
                    throw new Exception("该调价单已作废,无法删除!");
                }
            }

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                using (DataTable dtDetail = _DALModifyBillDetail.GetModifyBillDetailByHeaderID(argsInTrans, ModifyBillHeaderID))
                {
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                    }
                }
                _DALModifyBillHeader.Delete(argsInTrans, ModifyBillHeaderID);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 2
0
        public void Customer_UpdateFromService(FactoryArgs args, t_BigID CustomerID, t_String CustomerName, t_String Contact, t_String Phone, t_String Address,
                                               t_Bool CarIsLimit, t_ID AmountType, t_String LicenceNum, t_String Description, t_Bool IsForbid, t_ID ReceiveType,
                                               t_Decimal CreditAmount, t_Bool IsDisplayPrice, t_Bool IsDisplayAmount, t_Bool IsPrintAmount, t_Bool IsAllowOverFul,
                                               t_Bool IsAllowEmptyIn, t_Decimal AmountNotEnough, t_Decimal TotalReceivedAmount, t_Decimal SalesReceivedAmount, t_String K3CustomerCode,
                                               t_BigID CustomerTypeID)
        {
            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                this.Customer_Update(argsInTrans, CustomerID, CustomerName, Contact, Phone, Address, CarIsLimit, AmountType, LicenceNum, Description,
                                     ReceiveType, CreditAmount, IsDisplayPrice, IsDisplayAmount, IsPrintAmount, IsAllowOverFul, IsAllowEmptyIn, AmountNotEnough,
                                     K3CustomerCode, CustomerTypeID);

                _DALDbCustomer.UpdateAmount(argsInTrans, CustomerID, TotalReceivedAmount, SalesReceivedAmount);

                IsForbid.IsNullToZero();
                if (IsForbid.Value == 1)
                {
                    _DALDbCustomer.Forbid(args, CustomerID);
                }
                else
                {
                    _DALDbCustomer.UnForbid(args, CustomerID);
                }
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 3
0
 public void ChargeType_Delete(FactoryArgs args, t_BigID ChargeTypeID)
 {
     DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
     {
         _DALDbChargeType.ChargeType_Delete(argsInTrans, ChargeTypeID);
     };
     DBHelper.ExecInTrans(args, exec);
 }
Exemplo n.º 4
0
 public void Bank_Delete(FactoryArgs args, t_BigID ReceiveBankID)
 {
     DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
     {
         _DALDbBank.Bank_Delete(argsInTrans, ReceiveBankID);
     };
     DBHelper.ExecInTrans(args, exec);
 }
Exemplo n.º 5
0
        public void Car_Delete(FactoryArgs args, t_BigID CarID)
        {
            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                //_DALDbCar.DeleteCustomerCarByCarID(argsInTrans, CarID);

                _DALDbCar.Customer_Delete(argsInTrans, CarID);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 6
0
        public void Car_Insert(FactoryArgs args, out t_BigID CarID, out t_String CarCode, t_String CarNum,
                               t_BigID SupplierID, t_BigID CardID, t_String Description, t_Decimal DefaultCarWeight)
        {
            CarCode = new t_String();
            CarID   = new t_BigID();
            DefaultCarWeight.IsNullToZero();
            CardID.NullIfZero();
            SupplierID.NullIfZero();
            using (DataTable dtCar = _DALDbCar.GetCarByName(args, CarID, CarNum))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该车牌号码已存在!");
                }
            }

            t_BigID  CarID_temp   = new t_BigID();
            t_String CarCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbCar.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null ? 0 : LBConverter.ToInt32(MaxCode.Value.Replace("C", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    CarCode_temp.SetValueWithObject("C000" + CodeIndex.ToString());
                }
                else if (CodeIndex < 100)
                {
                    CarCode_temp.SetValueWithObject("C00" + CodeIndex.ToString());
                }
                else if (CodeIndex < 1000)
                {
                    CarCode_temp.SetValueWithObject("C0" + CodeIndex.ToString());
                }
                else
                {
                    CarCode_temp.SetValueWithObject("C" + CodeIndex.ToString());
                }

                if (CardID.Value > 0)//取消卡片的车辆关联
                {
                    CancelRefCard(argsInTrans, CardID);
                }

                _DALDbCar.Car_Insert(argsInTrans, out CarID_temp, CarCode_temp, CarNum, Description, DefaultCarWeight, SupplierID, CardID);
            };
            DBHelper.ExecInTrans(args, exec);
            CarID.Value   = CarID_temp.Value;
            CarCode.Value = CarCode_temp.Value;
        }
Exemplo n.º 7
0
        public void Customer_Delete(FactoryArgs args, t_BigID CustomerID)
        {
            using (DataTable dtCar = _DALDbCustomer.GetCarByCustomer(args, CustomerID))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该客户已关联车辆,无法删除!");
                }
            }
            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                _DALDbCar.DeleteCustomerCarByCustomerID(argsInTrans, CustomerID);

                _DALDbCustomer.Customer_Delete(args, CustomerID);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 8
0
        public void InsertUpdateUserCnofig(FactoryArgs args,
                                           t_ID WeightDeviceType, t_String MachineName, t_ID DeviceBoTeLv, t_ID DeviceShuJuWei,
                                           t_ID DeviceTingZhiWei, t_ID DeviceZhenChangDu, t_ID DeviceZhenQiShiBiaoShi, t_ID DeviceZhenChuLiFangShi, t_ID DeviceChongFuWeiZhi,
                                           t_ID DeviceChongFuChangDu, t_ID DeviceXiaoShuWei, t_ID DeviceFuHaoKaiShi, t_String SerialName)
        {
            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_BigID WeightDeviceUserTypeID = new t_BigID();
                using (DataTable dtUserType = _DbWeightDeviceUserType.GetUserType(argsInTrans, MachineName))
                {
                    if (dtUserType.Rows.Count > 0)
                    {
                        DataRow drUserType = dtUserType.Rows[0];
                        WeightDeviceUserTypeID.SetValueWithObject(drUserType["WeightDeviceUserTypeID"]);

                        _DbWeightDeviceUserType.UpdateUserType(argsInTrans, WeightDeviceUserTypeID, WeightDeviceType, MachineName, SerialName);
                    }
                    else
                    {
                        _DbWeightDeviceUserType.InsertUserType(argsInTrans, out WeightDeviceUserTypeID, WeightDeviceType, MachineName, SerialName);
                    }
                }

                if (WeightDeviceType.Value == 0)
                {
                    using (DataTable dtUserConfig = _DbWeightDeviceUserType.GetUserConfig(argsInTrans, WeightDeviceUserTypeID))
                    {
                        if (dtUserConfig.Rows.Count == 0)
                        {
                            _DbWeightDeviceUserType.InsertUserCnofig(argsInTrans, WeightDeviceUserTypeID, DeviceBoTeLv, DeviceShuJuWei,
                                                                     DeviceTingZhiWei, DeviceZhenChangDu, DeviceZhenQiShiBiaoShi, DeviceZhenChuLiFangShi,
                                                                     DeviceChongFuWeiZhi, DeviceChongFuChangDu, DeviceXiaoShuWei, DeviceFuHaoKaiShi);
                        }
                        else
                        {
                            _DbWeightDeviceUserType.UpdateUserCnofig(argsInTrans, WeightDeviceUserTypeID, DeviceBoTeLv, DeviceShuJuWei,
                                                                     DeviceTingZhiWei, DeviceZhenChangDu, DeviceZhenQiShiBiaoShi, DeviceZhenChuLiFangShi,
                                                                     DeviceChongFuWeiZhi, DeviceChongFuChangDu, DeviceXiaoShuWei, DeviceFuHaoKaiShi);
                        }
                    }
                }
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 9
0
        public void UnApprove(FactoryArgs args, t_BigID ReceiveBillHeaderID)
        {
            t_Decimal ReceiveAmount            = new t_Decimal(0);
            t_BigID   CustomerID               = new t_BigID();
            t_Decimal SalesReceiveAmountAdd    = new t_Decimal(0);
            t_Decimal SalesReceiveAmountReduce = new t_Decimal(0);

            using (DataTable dtHeader = _DALRPReceiveBillHeader.GetRPReceiveBillHeader(args, ReceiveBillHeaderID))
            {
                if (dtHeader.Rows.Count > 0)
                {
                    DataRow drHeader     = dtHeader.Rows[0];
                    bool    bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]);
                    bool    bolIsCancel  = LBConverter.ToBoolean(drHeader["IsCancel"]);
                    ReceiveAmount.SetValueWithObject(drHeader["ReceiveAmount"]);
                    SalesReceiveAmountAdd.SetValueWithObject(drHeader["SalesReceiveAmountAdd"]);
                    SalesReceiveAmountReduce.SetValueWithObject(drHeader["SalesReceiveAmountReduce"]);
                    CustomerID.SetValueWithObject(drHeader["CustomerID"]);
                    if (!bolIsApprove)
                    {
                        throw new Exception("该充值单未审核,无法执行取消审核!");
                    }
                    if (bolIsCancel)
                    {
                        throw new Exception("该充值单已作废,无法执行取消审核!");
                    }
                }
                else
                {
                    throw new Exception("该充值单已删除,无法执行取消审核!");
                }
            }
            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                _DALRPReceiveBillHeader.UnApprove(argsInTrans, ReceiveBillHeaderID);
                //扣减客户收款金额
                ReceiveAmount.SetValueWithObject(-ReceiveAmount.Value);
                SalesReceiveAmountAdd.SetValueWithObject(-SalesReceiveAmountAdd.Value);
                SalesReceiveAmountReduce.SetValueWithObject(-SalesReceiveAmountReduce.Value);
                _DALRPReceiveBillHeader.UpdateCustomerReceiveAmount(argsInTrans, CustomerID, ReceiveAmount, SalesReceiveAmountAdd, SalesReceiveAmountReduce);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 10
0
        public void SaveUserPermission(FactoryArgs args, t_BigID UserID, t_Table DTUserPermission, t_Table DTUserPermissionData)
        {
            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                _DALUserPermission.DeleteUserPermission(argsInTrans, UserID);
                _DALUserPermission.DeleteUserPermissionData(argsInTrans, UserID);

                foreach (DataRow dr in DTUserPermissionData.Value.Rows)
                {
                    long lPermissionID = Convert.ToInt64(dr["PermissionID"]);

                    DTUserPermission.Value.DefaultView.RowFilter = "HasPermission=1 and PermissionID=" + lPermissionID;

                    if (DTUserPermission.Value.DefaultView.Count == 0)
                    {
                        bool bolHasPermission = dr["HasPermission"] == DBNull.Value ?
                                                false : Convert.ToBoolean(dr["HasPermission"]);
                        t_BigID PermissionDataID = new t_BigID(dr["PermissionDataID"]);
                        if (bolHasPermission)
                        {
                            _DALUserPermission.InsertUserPermissionData(argsInTrans, UserID, PermissionDataID);
                        }
                    }
                }

                foreach (DataRow dr in DTUserPermission.Value.Rows)
                {
                    long lPermissionID = Convert.ToInt64(dr["PermissionID"]);

                    bool bolHasPermission = dr["HasPermission"] == DBNull.Value ?
                                            false : Convert.ToBoolean(dr["HasPermission"]);
                    t_BigID PermissionID = new t_BigID(dr["PermissionID"]);
                    if (bolHasPermission)
                    {
                        _DALUserPermission.InsertUserPermission(argsInTrans, UserID, PermissionID);
                    }
                }
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 11
0
        public void Customer_InsertFromService(FactoryArgs args, out t_BigID CustomerID, out t_String CustomerCode, t_String CustomerName, t_String Contact, t_String Phone, t_String Address,
                                               t_Bool CarIsLimit, t_ID AmountType, t_String LicenceNum, t_String Description, t_Bool IsForbid, t_ID ReceiveType,
                                               t_Decimal CreditAmount, t_Bool IsDisplayPrice, t_Bool IsDisplayAmount, t_Bool IsPrintAmount, t_Bool IsAllowOverFul,
                                               t_Bool IsAllowEmptyIn, t_Decimal AmountNotEnough, t_Decimal TotalReceivedAmount, t_Decimal SalesReceivedAmount, t_String K3CustomerCode,
                                               t_BigID CustomerTypeID)
        {
            CustomerID   = new t_BigID();
            CustomerCode = new t_String();
            t_BigID  CustomerIDTemp   = new t_BigID();
            t_String CustomerCodeTemp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                this.Customer_Insert(argsInTrans, out CustomerIDTemp, out CustomerCodeTemp, CustomerName, Contact, Phone, Address, CarIsLimit, AmountType, LicenceNum, Description,
                                     ReceiveType, CreditAmount, IsDisplayPrice, IsDisplayAmount, IsPrintAmount, IsAllowOverFul, IsAllowEmptyIn, AmountNotEnough, K3CustomerCode, CustomerTypeID);

                _DALDbCustomer.UpdateAmount(argsInTrans, CustomerIDTemp, TotalReceivedAmount, SalesReceivedAmount);
            };
            DBHelper.ExecInTrans(args, exec);
            CustomerID.Value   = CustomerIDTemp.Value;
            CustomerCode.Value = CustomerCodeTemp.Value;
        }
Exemplo n.º 12
0
        public void Car_Update(FactoryArgs args, t_BigID CarID, t_String CarNum,
                               t_BigID CustomerID, t_String Description, t_Decimal DefaultCarWeight,
                               t_BigID SupplierID, t_BigID CardID)
        {
            DefaultCarWeight.IsNullToZero();
            using (DataTable dtCar = _DALDbCar.GetCarByName(args, CarID, CarNum))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该车牌号码已存在!");
                }
            }

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                if (CardID.Value > 0)//取消卡片的车辆关联
                {
                    CancelRefCard(argsInTrans, CardID);
                }
                _DALDbCar.Car_Update(argsInTrans, CarID, CarNum, Description, DefaultCarWeight, SupplierID, CardID);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 13
0
        public void ChargeType_Insert(FactoryArgs args, out t_BigID ChargeTypeID,
                                      out t_String ChargeTypeCode, t_String ChargeTypeName)
        {
            ChargeTypeCode = new t_String();
            ChargeTypeID   = new t_BigID();
            using (DataTable dtCar = _DALDbChargeType.GetChargeTypeByName(args, ChargeTypeID, ChargeTypeName))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该收款方式已存在!");
                }
            }

            t_BigID  ChargeTypeID_temp   = new t_BigID();
            t_String ChargeTypeCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbChargeType.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null?0: LBConverter.ToInt32(MaxCode.Value.Replace("F", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    ChargeTypeCode_temp.SetValueWithObject("F0" + CodeIndex.ToString());
                }
                else
                {
                    ChargeTypeCode_temp.SetValueWithObject("F" + CodeIndex.ToString());
                }

                _DALDbChargeType.ChargeType_Insert(argsInTrans, out ChargeTypeID_temp, ChargeTypeCode_temp, ChargeTypeName);
            };
            DBHelper.ExecInTrans(args, exec);
            ChargeTypeID.Value   = ChargeTypeID_temp.Value;
            ChargeTypeCode.Value = ChargeTypeCode_temp.Value;
        }
Exemplo n.º 14
0
        public void Bank_Insert(FactoryArgs args, out t_BigID ReceiveBankID, out t_String BankCode,
                                t_String BankName)
        {
            BankCode      = new t_String();
            ReceiveBankID = new t_BigID();
            using (DataTable dtCar = _DALDbBank.GetBankByName(args, ReceiveBankID, BankName))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该收款银行名称已存在!");
                }
            }

            t_BigID  BankID_temp   = new t_BigID();
            t_String BankCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbBank.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null?0: LBConverter.ToInt32(MaxCode.Value.Replace("C", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    BankCode_temp.SetValueWithObject("Y0" + CodeIndex.ToString());
                }
                else
                {
                    BankCode_temp.SetValueWithObject("Y" + CodeIndex.ToString());
                }

                _DALDbBank.Bank_Insert(argsInTrans, out BankID_temp, BankCode_temp, BankName);
            };
            DBHelper.ExecInTrans(args, exec);
            ReceiveBankID.Value = BankID_temp.Value;
            BankCode.Value      = BankCode_temp.Value;
        }
Exemplo n.º 15
0
        public void Supplier_Insert(FactoryArgs args, out t_BigID SupplierID, out t_String SupplierCode, t_String SupplierName, t_ID IsForbidden)
        {
            SupplierCode = new t_String();
            SupplierID   = new t_BigID();
            IsForbidden.IsNullToZero();
            using (DataTable dtSupplier = _DALDbSupplier.GetSupplierByName(args, SupplierID, SupplierName))
            {
                if (dtSupplier.Rows.Count > 0)
                {
                    throw new Exception("该供应商名称已存在!");
                }
            }

            t_BigID  SupplierID_temp   = new t_BigID();
            t_String SupplierCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbSupplier.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null ? 0 : LBConverter.ToInt32(MaxCode.Value.Replace("G", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    SupplierCode_temp.SetValueWithObject("G0" + CodeIndex.ToString());
                }
                else
                {
                    SupplierCode_temp.SetValueWithObject("G" + CodeIndex.ToString());
                }

                _DALDbSupplier.Supplier_Insert(argsInTrans, out SupplierID_temp, SupplierName, SupplierCode_temp, IsForbidden);
            };
            DBHelper.ExecInTrans(args, exec);
            SupplierID.Value   = SupplierID_temp.Value;
            SupplierCode.Value = SupplierCode_temp.Value;
        }
Exemplo n.º 16
0
        public void Update(FactoryArgs args, t_BigID SaleCarReturnBillID,
                           t_Decimal CarTare, t_Decimal SuttleWeight, t_ID ReturnType, t_String Description, t_ID ReturnReason,
                           out t_String NewSaleCarInBillCode, out t_String NewSaleCarOutBillCode,
                           out t_BigID NewSaleCarInBillID, out t_BigID NewSaleCarOutBillID)
        {
            NewSaleCarInBillCode  = new t_String();
            NewSaleCarOutBillCode = new t_String();
            t_String NewSaleCarInBillCode_temp  = new t_String();
            t_String NewSaleCarOutBillCode_temp = new t_String();

            NewSaleCarInBillID  = new t_BigID();
            NewSaleCarOutBillID = new t_BigID();
            t_BigID  NewSaleCarInBillID_temp  = new t_BigID();
            t_BigID  NewSaleCarOutBillID_temp = new t_BigID();
            t_String SaleCarReturnBilCode     = new t_String();
            t_BigID  SaleCarInBillID          = new t_BigID();

            using (DataTable dtReturnBill = _DALSaleCarReturnBill.GetReturnBill(args, SaleCarReturnBillID))
            {
                if (dtReturnBill.Rows.Count > 0)
                {
                    DataRow drReturn = dtReturnBill.Rows[0];
                    SaleCarReturnBilCode.SetValueWithObject(drReturn["SaleCarReturnBilCode"]);
                    SaleCarInBillID.Value = LBConverter.ToInt64(drReturn["SaleCarInBillID"]);
                    int iReturnStatus = LBConverter.ToInt32(drReturn["ReturnStatus"]);

                    if (iReturnStatus == 1)
                    {
                        throw new Exception("该退货记录已完成,无法重复退货!");
                    }
                }
            }

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                using (DataTable dtInBill = _DALSaleCarInOutBill.GetSaleCarInBill(argsInTrans, SaleCarInBillID))
                {
                    if (dtInBill.Rows.Count > 0)//校验是否已审核或者已作废
                    {
                        DataRow  drBill      = dtInBill.Rows[0];
                        int      iBillStatus = LBConverter.ToInt32(drBill["BillStatus"]);
                        bool     bolIsCancel = LBConverter.ToBoolean(drBill["IsCancel"]);
                        t_String ReturnReasonConstText;
                        _IBLLDbSystemConst.GetConstValue(argsInTrans, new t_String("ReturnReason"), new t_String(ReturnReason.Value.ToString()), out ReturnReasonConstText);

                        string strCancelDesc = (ReturnType.Value == 0 ? "完全退货作废" : "部分退货作废") + ",退货单号【" + SaleCarReturnBilCode.Value + "】,退货原因:" + ReturnReasonConstText.Value;
                        //先取消审核磅单
                        if (iBillStatus == 2)
                        {
                            _IBLLSaleCarInOutBill.UnApprove(argsInTrans, SaleCarInBillID);                           //取消审核
                            _IBLLSaleCarInOutBill.Cancel(argsInTrans, SaleCarInBillID, new t_String(strCancelDesc)); ////作废订单
                        }
                        else if (iBillStatus == 0)
                        {
                            //作废订单
                            _IBLLSaleCarInOutBill.Cancel(argsInTrans, SaleCarInBillID, new t_String(strCancelDesc));
                        }

                        if (ReturnType.Value == 0)//完全退货
                        {
                            //无需处理
                        }
                        else if (ReturnType.Value == 1)//部分退货
                        {
                            _IBLLSaleCarInOutBill.CopySaleBill(argsInTrans, SaleCarInBillID, CarTare, out NewSaleCarInBillID_temp, out NewSaleCarOutBillID_temp,
                                                               out NewSaleCarInBillCode_temp, out NewSaleCarOutBillCode_temp);
                            //_IBLLSaleCarInOutBill.Approve(argsInTrans, NewSaleCarInBillID);
                        }

                        if (bolIsCancel)
                        {
                            throw new Exception("该磅单已作废,无法退货!");
                        }

                        if (iBillStatus != 2)
                        {
                            throw new Exception("该磅单未审核或者未完成,无法退货!");
                        }

                        _DALSaleCarReturnBill.Update(argsInTrans, SaleCarReturnBillID, CarTare, SuttleWeight, ReturnType, Description, ReturnReason, NewSaleCarInBillID_temp);
                    }
                }
            };
            DBHelper.ExecInTrans(args, exec);
            //_DALSaleCarReturnBill.Insert(args, out SaleCarReturnBillID, SaleCarInBillID, TotalWeight);
            NewSaleCarInBillCode.Value  = NewSaleCarInBillCode_temp.Value;
            NewSaleCarOutBillCode.Value = NewSaleCarOutBillCode_temp.Value;
            NewSaleCarInBillID.Value    = NewSaleCarInBillID_temp.Value;
            NewSaleCarOutBillID.Value   = NewSaleCarOutBillID_temp.Value;
        }