Esempio n. 1
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (stock != null)
            {
                ModifiedGrid();
                /////////////////////////////////////////////////////////////////////////////
                stock.FCode = txtFCode.Text;
                stock.FName = tbxFCustomer.Text;
                //--------------------------------------------------

                stock.FAddress    = txtFAddress.Text.Trim();
                stock.FFlag       = 1;
                stock.FDeleteFlag = 0;
                stock.FFreight    = Convert.ToDecimal(txtFFreight.Text.Trim());
                stock.FLinkman    = txtFLinkman.Text.Trim();
                stock.FMemo       = txtFMemo.Text.Trim();
                stock.FPhone      = txtFPhone.Text.Trim();

                stock.FShipper    = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : "";

                stock.FOutFlag = "未出库";
                //var parms = new Dictionary<string, object>();
                //parms.Clear();

                //parms.Add("@keyID", stock.KeyId);
                //parms.Add("@companyId", CurrentUser.AccountComId);

                //var amt =
                //    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount = 0;


                //stock.f

                stock.FDate     = txtFDate.SelectedDate;
                stock.FSalesman = ddlFSalesman.SelectedValue;
                stock.FArea     = ddlFArea.SelectedValue;
                stock.FAmt      = 0;// string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim());
                //stock.FDiscountAmount = string.IsNullOrEmpty(txtFDiscountAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDiscountAmount.Text.Trim());
                stock.FReconciliation  = txtFReconciliation.Text;
                stock.FDeliveryMethod  = ddlDeliveryMethod.SelectedValue;
                stock.FLogisticsNumber = ddlFCate.SelectedValue;//txtFLogisticsNumber.Text;

                stock.FSupercargo        = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                stock.FDriver            = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
                stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue;
                //stock.FSubjectCode = ddlSubject.SelectedValue;
                //stock.FSubjectName = ddlSubject.SelectedText;
                stock.FSKNum = "";

                stock.FAuditFlag = 1;

                StockOutService.SaveChanges();


                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PI", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "45");
                    orderParms.Add("@companyId", CurrentUser.AccountComId);

                    SqlService.ExecuteProcedureCommand("proc_num", orderParms);
                    txtKeyId.Text = newKeyId;

                    ////新增日志
                    //var billStatus = new LHBillStatus
                    //{
                    //    KeyId = newKeyId,
                    //    FCompanyId = CurrentUser.AccountComId,
                    //    FActionName = "新增",
                    //    FDate = DateTime.Now,
                    //    FDeptId = CurrentUser.AccountOrgId,
                    //    FOperator = CurrentUser.AccountName,
                    //    FMemo = String.Format("单据号{0},{1}新增出门证据。", newKeyId, CurrentUser.AccountName)
                    //};

                    //GasHelper.AddBillStatus(billStatus);

                    //var bottles = new Dictionary<string, object>();
                    //bottles.Clear();

                    //bottles.Add("@SalesKeyId", newKeyId);
                    //bottles.Add("@companyid", CurrentUser.AccountComId);
                    //bottles.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd"));

                    //SqlService.ExecuteProcedureCommand("proc_SalesReturnBottle", bottles);


                    //收款部分
                    //var parmsAuto = new Dictionary<string, object>();
                    //parmsAuto.Clear();

                    //parmsAuto.Add("@KeyId", newKeyId);
                    //parmsAuto.Add("@companyId", CurrentUser.AccountComId);
                    //parmsAuto.Add("@FCate", "客户");
                    //parmsAuto.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd"));
                    //parmsAuto.Add("@FSKNum", stock.FSKNum);

                    //SqlService.ExecuteProcedureCommand("proc_SKOrderAuto", parmsAuto);
                }


                if (!string.IsNullOrEmpty(hfdImage.Text))
                {
                    var attachment = new LHAttachment();
                    attachment.FCompanyId = CurrentUser.AccountComId;
                    attachment.FPath      = hfdImage.Text;
                    attachment.KeyId      = txtKeyId.Text;

                    AttachmentService.Add(attachment);
                }


                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (stock != null)
            {
                ModifiedGrid();


                stock.FCompanyId         = CurrentUser.AccountComId;
                stock.FFlag              = 1;
                stock.FDeleteFlag        = 0;
                stock.FMemo              = txtFMemo.Text.Trim();
                stock.FDate              = txtFDate.SelectedDate;
                stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue;

                var parms = new Dictionary <string, object>();
                parms.Clear();

                parms.Add("@keyID", stock.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);
                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount = amt;
                stock.FDate   = txtFDate.SelectedDate;

                StockOutService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PK", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "9");
                    orderParms.Add("@companyId", CurrentUser.AccountComId);
                    SqlService.ExecuteProcedureCommand("proc_num", orderParms);
                    txtKeyId.Text = newKeyId;

                    //新增日志
                    var billStatus = new LHBillStatus
                    {
                        KeyId       = newKeyId,
                        FCompanyId  = CurrentUser.AccountComId,
                        FActionName = "新增",
                        FDate       = DateTime.Now,
                        FDeptId     = CurrentUser.AccountOrgId,
                        FOperator   = CurrentUser.AccountName,
                        FMemo       = String.Format("单据号{0},{1}新增盘亏单据。", newKeyId, CurrentUser.AccountName)
                    };
                    GasHelper.AddBillStatus(billStatus);
                }

                return(true);
            }


            return(false);
        }
Esempio n. 3
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();


            if (stock != null)
            {
                ModifiedGrid();

                stock.FOrgId   = int.Parse(ddlOrgnization.SelectedValue);
                stock.FOrgName = ddlOrgnization.SelectedText;
                stock.FCode    = ddlOrgnization.SelectedValue;
                stock.FName    = ddlOrgnization.SelectedText.Trim();
                //--------------------------------------------------
                stock.FAuditFlag = 0;
                //stock.FAddress = txtFAddress.Text.Trim();
                stock.FCompanyId  = CurrentUser.AccountComId;
                stock.FFlag       = 1;
                stock.FDeleteFlag = 0;
                //stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                stock.FLinkman              = txtFLinkman.Text.Trim();
                stock.FReceiver             = ddlFReceiver.SelectedValue;
                stock.FT6ReceiveSendType    = ddlT6ReceiveSendType.SelectedText;
                stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue;
                stock.FMemo        = txtFMemo.Text.Trim();
                stock.FT6Warehouse = ddlFWarehouse.SelectedValue;
                stock.FT6Status    = "未同步";
                //stock.FPhone = txtFPhone.Text.Trim();

                //stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                //stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : "";

                var parms = new Dictionary <string, object>();
                parms.Clear();

                parms.Add("@keyID", stock.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);
                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount = amt;
                stock.FTime1  = DateTime.Now;
                stock.FDate   = txtFDate.SelectedDate;
                //stock.FSalesman = ddlFSalesman.SelectedValue;
                //stock.FArea = ddlFArea.SelectedValue;
                //stock.FAmt = Convert.ToDecimal(txtFAmt.Text.Trim());
                //stock.FReconciliation = txtFReconciliation.Text;
                //stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue;
                //stock.FLogisticsNumber = txtFLogisticsNumber.Text;

                //stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                //stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);

                stock.FCate = ddlFCate.SelectedValue;

                stock.FGroup = ddlFGroup.SelectedValue;

                stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue;

                StockOutService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "OT", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "20");
                    orderParms.Add("@companyId", CurrentUser.AccountComId);
                    SqlService.ExecuteProcedureCommand("proc_num", orderParms);
                    txtKeyId.Text = newKeyId;
                    //--------------------------------------------------------------
                    //var orders = new Dictionary<string, object>();
                    //orders.Clear();
                    //orders.Add("@KeyId",newKeyId);
                    //orders.Add("@companyId", CurrentUser.AccountComId);
                    //SqlService.ExecuteProcedureCommand("proc_ProuctOrder", orders);

                    //新增日志
                    var billStatus = new LHBillStatus
                    {
                        KeyId       = newKeyId,
                        FCompanyId  = CurrentUser.AccountComId,
                        FActionName = "新增",
                        FDate       = DateTime.Now,
                        FDeptId     = CurrentUser.AccountOrgId,
                        FOperator   = CurrentUser.AccountName,
                        FMemo       = String.Format("单据号{0},{1}新增{2}单据。", newKeyId, CurrentUser.AccountName, ddlFCate.SelectedValue)
                    };
                    GasHelper.AddBillStatus(billStatus);
                }

                return(true);
            }


            return(false);
        }
Esempio n. 4
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (stock != null)
            {
                ModifiedGrid();

                stock.FCode       = txtFCode.Text;
                stock.FName       = tbxFCustomer.Text;
                stock.FAddress    = txtFAddress.Text.Trim();
                stock.FCompanyId  = CurrentUser.AccountComId;
                stock.FFlag       = 1;
                stock.FDeleteFlag = 0;

                if (!string.IsNullOrEmpty(txtFFreight.Text.Trim()))
                {
                    stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                }

                stock.FLinkman = txtFLinkman.Text.Trim();
                stock.FMemo    = txtFMemo.Text.Trim();
                stock.FPhone   = txtFPhone.Text.Trim();

                stock.FShipper    = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : "";


                var parms = new Dictionary <string, object>();
                parms.Clear();
                parms.Add("@companyId", CurrentUser.AccountComId);
                parms.Add("@keyID", stock.KeyId);
                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount = amt;

                stock.FSalesman        = ddlFSalesman.SelectedValue;
                stock.FArea            = ddlFArea.SelectedValue;
                stock.FAmt             = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim());
                stock.FReconciliation  = txtFReconciliation.Text;
                stock.FDeliveryMethod  = ddlDeliveryMethod.SelectedValue;
                stock.FLogisticsNumber = txtFLogisticsNumber.Text;
                stock.FDate            = txtFDate.SelectedDate;
                stock.FSupercargo      = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                stock.FDriver          = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
                stock.FSubjectCode     = ddlSubject.SelectedValue;
                stock.FSubjectName     = ddlSubject.SelectedText;
                stock.FSKNum           = "";



                #region T6 对接接口
                //---------------------------------------------------------
                //收发类型
                stock.FT6ReceiveSendType    = ddlT6ReceiveSendType.SelectedText;
                stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue;
                //部门名称
                stock.FT6Department = "";
                //部门代码
                stock.FT6DepartmentNum = "";
                //业务员代码
                stock.FT6SalesmanNum = "";
                //币种
                stock.FT6Currency = ddlFT6Currency.SelectedValue;
                //汇率
                stock.FT6ExchangeRate = Convert.ToDecimal(txtFT6ExchangeRate.Text);
                //销售类型
                stock.FT6PurchaseType    = ddlFT6PurchaseType.SelectedText;
                stock.FT6PurchaseTypeNum = ddlFT6PurchaseType.SelectedValue;
                //T6同步
                stock.FT6Status    = "未同步";
                stock.FT6Warehouse = ddlWarehouse.SelectedValue;
                //---------------------------------------------------------
                #endregion


                StockOutService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "CT", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "5");
                    orderParms.Add("@companyId", CurrentUser.AccountComId);
                    SqlService.ExecuteProcedureCommand("proc_num", orderParms);
                    txtKeyId.Text = newKeyId;

                    //新增日志
                    var billStatus = new LHBillStatus
                    {
                        KeyId       = newKeyId,
                        FCompanyId  = CurrentUser.AccountComId,
                        FActionName = "新增",
                        FDate       = DateTime.Now,
                        FDeptId     = CurrentUser.AccountOrgId,
                        FOperator   = CurrentUser.AccountName,
                        FMemo       = String.Format("单据号{0},{1}新增采购退货单据。", newKeyId, CurrentUser.AccountName)
                    };
                    GasHelper.AddBillStatus(billStatus);


                    //收款部分
                    var parmsAuto = new Dictionary <string, object>();
                    parmsAuto.Clear();

                    parmsAuto.Add("@KeyId", newKeyId);
                    parmsAuto.Add("@companyId", CurrentUser.AccountComId);
                    parmsAuto.Add("@FCate", "供应商");
                    parmsAuto.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd"));
                    parmsAuto.Add("@FSKNum", stock.FSKNum);

                    SqlService.ExecuteProcedureCommand("proc_SKOrderAuto", parmsAuto);
                }

                return(true);
            }
            return(false);
        }