Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void filePhoto_FileSelected(object sender, EventArgs e)
        {
            if (filePhoto.HasFile)
            {
                var fileSuffix = filePhoto.ShortFileName.Substring(filePhoto.ShortFileName.LastIndexOf('.'));

                var sequence = SequenceService.CreateSequence("LH", CurrentUser.AccountComId);

                var fileName = sequence + fileSuffix;

                var uploadpath = Config.GetUploadpath();

                var tempPath = (string.Format(@"{0}/temp/{1}/", uploadpath, DateTime.Now.ToString("yyyy-MM-dd"))); //

                if (!DirFile.XFileExists(Server.MapPath(tempPath)))
                {
                    DirFile.XCreateDir(Server.MapPath(tempPath));
                }

                filePhoto.SaveAs(Server.MapPath(tempPath + fileName));

                hfdImage.Text = tempPath + fileName;

                // 清空文件上传组件
                filePhoto.Reset();
            }
        }
Пример #2
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                Region1.Title = "添加盘盈单";

                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHStockIn
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //盘盈单
                    FType = Convert.ToInt32(GasEnumBill.Profit),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                StockInService.Add(temp);


                var summary = new JObject
                {
                    { "FItemCode", "合计" },
                    { "FQty", 0 },
                    { "FAmount", 0 }
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                Region1.Title = "编辑盘盈单";

                txtKeyId.Text = KeyId;
                if (StockIn != null)
                {
                    txtFMemo.Text          = StockIn.FMemo;
                    ddlFCate.SelectedValue = StockIn.FCate;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #3
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var order = FKOrderService.Where(p => p.keyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (order != null)
            {
                order.FCode = txtFCode.Text;
                order.FName = tbxFCustomer.Text;
                //--------------------------------------------------
                order.FDeleteFlag = 0;
                order.FMemo       = txtFMemo.Text.Trim();
                order.CreateBy    = CurrentUser.AccountName;
                order.FDate       = txtFDate.SelectedDate;

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

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

                order.FAmount = amt;

                FKOrderService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "NF", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "19");
                    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);
        }
Пример #4
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region3.Title = "调整客户代码期初占用钢瓶单";

                var temp = new LHInitMonth
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //调整客户代码期初占用钢瓶单
                    FType = Convert.ToInt32(GasEnumBill.ChangeAccount),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                InitMonthServie.Add(temp);

                //合计
                //var summary = new JObject
                //{
                //    {"FItemCode", "合计"},
                //    {"FQty", 0},
                //};

                //Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region3.Title = "编辑调整客户代码期初占用钢瓶单";

                if (StockOut != null)
                {
                    WebControlHandler.BindObjectToControls(StockOut, SimpleForm1);
                    txtFDate.SelectedDate = StockOut.FDate;
                    tbxFCustomer.Text     = StockOut.FName;
                    txtFAmount.Text       = StockOut.FAmount.ToString();

                    BindDataGrid();
                }
                break;
            }
        }
Пример #5
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region3.Title = "添加送货提成单";

                var temp = new LHDispatchCommission
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //送货提成单
                    FType = Convert.ToInt32(GasEnumBill.DispatchCommission),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                DispatchCommissionService.Add(temp);

                //合计
                var summary = new JObject
                {
                    { "FItemCode", "合计" },
                    { "FQty", 0 },
                    { "FAmount", 0 }
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region3.Title = "编辑送货提成单";

                if (StockOut != null)
                {
                    WebControlHandler.BindObjectToControls(StockOut, SimpleForm1);
                    txtFDate.SelectedDate = StockOut.FDate;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #6
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim()).FirstOrDefault();

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

                stock.FCompanyId         = CurrentUser.AccountComId;
                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_PurchaseAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount = amt;

                StockInService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PY", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "10");
                    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);
        }
Пример #7
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region1.Title = "添加一般费用单";
                var temp = new LHFKOrder
                {
                    keyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //一般费用单
                    FType = Convert.ToInt32(GasEnumBill.GeneralExpense),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FAmount = 0,

                    FCate = "内",

                    FCompanyId = CurrentUser.AccountComId
                };

                //临时写入单据
                FKOrderService.Add(temp);

                var summary = new JObject
                {
                    { "FCode", "合计" },
                    { "FAmt", 0 },
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region1.Title = "编辑一般费用单";
                if (SkOrder != null)
                {
                    txtFCode.Text     = SkOrder.FCode;
                    tbxFCustomer.Text = SkOrder.FName;
                    txtFMemo.Text     = SkOrder.FMemo;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #8
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region1.Title = "添加核销收单";

                var temp = new LHSKOrderChecked
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FAmount = 0,

                    FCate = "客户",

                    FCompanyId = CurrentUser.AccountComId,
                };

                //临时写入单据
                CheckedOrderService.Add(temp);


                //    var summary = new JObject
                //{
                //    {"FCode", "合计"},
                //    {"FAmt", 0},
                //};

                //    Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                Region1.Title = "编辑核销收单";
                txtKeyId.Text = KeyId;
                if (CheckedOrder != null)
                {
                    txtFCode.Text     = CheckedOrder.FCode;
                    tbxFCustomer.Text = CheckedOrder.FName;
                    txtFMemo.Text     = CheckedOrder.FMemo;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #9
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var dispatch = DispatchService.Where(p => p.KeyId == txtKeyId.Text.Trim() && //
                                                 p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (dispatch != null)
            {
                //dispatch.KeyId = txtKeyId.Text.Trim();
                //dispatch.FCompanyId = CurrentUser.AccountComId;

                dispatch.CreateBy        = CurrentUser.AccountName;
                dispatch.FAccidentQty    = Convert.ToInt32(txtFAccidentQty.Text.Trim());
                dispatch.FDate           = txtFDate.SelectedDate;
                dispatch.FDispatcher     = ddlDispatcher.SelectedValue;
                dispatch.FHeavyTruckQty  = Convert.ToDecimal(txtFHeavyTruckQty.Text.Trim());
                dispatch.FIDepartureTime = Convert.ToInt32(txtFIDepartureTime.Text.Trim());
                dispatch.FIQty           = Convert.ToDecimal(txtFIQty.Text.Trim());
                dispatch.FIRange         = Convert.ToDecimal(txtFIRange.Text.Trim());
                dispatch.FLogistics      = ddlLogistics.SelectedValue;
                dispatch.FLogisticsName  = ddlLogistics.SelectedText;

                dispatch.FMemo           = txtFMemo.Text.Trim();
                dispatch.FODepartureTime = Convert.ToInt32(txtFODepartureTime.Text.Trim());
                dispatch.FOQty           = Convert.ToDecimal(txtFOQty.Text.Trim());
                dispatch.FORange         = Convert.ToDecimal(txtFORange.Text.Trim());
                dispatch.FOtherQty       = Convert.ToInt32(txtFOtherQty.Text.Trim());
                dispatch.FRepairQty      = Convert.ToInt32(txtFRepairQty.Text.Trim());
                dispatch.FTransport      = Convert.ToDecimal(txtFTransport.Text.Trim());
                dispatch.FTurnover       = Convert.ToDecimal(txtFTurnover.Text.Trim());
                dispatch.FWorkQty        = Convert.ToInt32(txtFWorkQty.Text.Trim());
                dispatch.FDeleteFlag     = 0;
                dispatch.FType           = 52;

                DispatchService.SaveChanges();

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

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

                    return(true);
                }
            }
            return(false);
        }
Пример #10
0
        protected void fileUpload1_FileSelected(object sender, EventArgs e)
        {
            if (fileUpload1.HasFile)
            {
                var fileSuffix = fileUpload1.ShortFileName.Substring(fileUpload1.ShortFileName.LastIndexOf('.'));

                var sequence = SequenceService.CreateSequence("LH", CurrentUser.AccountComId);

                var fileName = sequence + fileSuffix;

                var uploadpath = Config.GetUploadpath();

                //该目录设定死,最好不要修改
                var fileTemp = (string.Format(@"{0}/temp/{1}/", uploadpath, DateTime.Now.ToString("yyyy-MM-dd"))); //

                if (!DirFile.XFileExists(Server.MapPath(fileTemp)))
                {
                    DirFile.XCreateDir(Server.MapPath(fileTemp));
                }

                var address = fileTemp + fileName;

                fileUpload1.SaveAs(Server.MapPath(address));

                //导入
                var connStr = string.Empty;//数据连接字符串
                if (fileSuffix == ".xls")
                {
                    connStr = "Provider=Microsoft.Jet.OleDb.4.0;" + "data source=" + Server.MapPath(address) + ";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";
                }
                else if (fileSuffix == ".xlsx")
                {
                    connStr = "Provider=Microsoft.ACE.OleDb.12.0;" + "data source=" + Server.MapPath(address) + ";Extended Properties='Excel 12.0; HDR=YES; IMEX=1'";
                }

                var conn = new OleDbConnection(connStr);
                conn.Open();

                var          data   = new DataTable();
                const string cmdSql = "select * from [Sheet1$]";
                var          da     = new OleDbDataAdapter(cmdSql, conn);
                da.Fill(data);

                ViewState["dtData"] = data;
                Grid1.DataSource    = data;
                Grid1.DataBind();
                Grid1.Visible = true;

                fileUpload1.Reset();
            }
        }
Пример #11
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = DispatchCommissionService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

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

                ModifiedGrid();
                /////////////////////////////////////////////////////////////////////////////
                stock.FDate = txtFDate.SelectedDate;
                stock.FMemo = txtFMemo.Text.Trim();

                DispatchCommissionService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "TC", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "14");
                    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);
        }
Пример #12
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                hiddevalue.Text = SequenceService.CreateSequence(DateTime.Now, "CC", CurrentUser.AccountComId);
                BindData();
                break;

            case WebAction.Edit:

                if (Contract != null)
                {
                    Customer = CustomerService.FirstOrDefault(p => p.FCode == Contract.FCustomer && p.FCompanyId == CurrentUser.AccountComId);
                    if (CurrentUser != null)
                    {
                        tbxFCustomer.Text = Customer.FName;
                    }
                    hiddevalue.Text              = Contract.FOrderCode;
                    txtFContractCode.Text        = Contract.FContractCode;
                    dpFContractDate.SelectedDate = Contract.FContractDate;
                    txtFContractName.Text        = Contract.FContractName;
                    ddlFCtroler.SelectedValue    = Contract.FCtroler;
                    //txtFContractName.Text = Contract.FContractName;
                    if (!string.IsNullOrEmpty(ddlFAccType.SelectedValue))
                    {
                        ddlFAccType.SelectedValue = Contract.FAccType;
                    }
                    if (!string.IsNullOrEmpty(ddlFBillType.SelectedValue))
                    {
                        ddlFBillType.SelectedValue = Contract.FBillType;
                    }
                    dpFBeginDate.SelectedDate = Contract.FBeginDate;
                    dpFEndDate.SelectedDate   = Contract.FEndDate;
                    this.txtFCustomer.Text    = Contract.FCustomer;

                    txtFContext.Text  = Contract.FContext;
                    txtFConacter.Text = Contract.FConacter;
                    txtFTel.Text      = Contract.FTel;
                    BindData();
                }
                break;
            }
        }
Пример #13
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var liquidPlan = new LHLiquidPlan();

            string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), //
                                                             "LP", CurrentUser.AccountComId);

            liquidPlan.FCompanyId  = CurrentUser.AccountComId;
            liquidPlan.KeyId       = newKeyId;
            liquidPlan.CreateBy    = CurrentUser.AccountName;
            liquidPlan.FDate       = txtFDate.SelectedDate;
            liquidPlan.FItemCode   = tbxFItemName.SelectedValue;
            liquidPlan.FItemName   = tbxFItemName.SelectedText;
            liquidPlan.FBill       = tbxFBill.SelectedValue;
            liquidPlan.FVehicleNum = tbxFVehicleNum.SelectedValue;
            liquidPlan.FDriver     = GasHelper.GetDropDownListArrayString(tbxFDriver.SelectedItemArray);
            liquidPlan.FSupercargo = tbxFSupercargo.SelectedValue;
            liquidPlan.FMargin     = Convert.ToDecimal(tbxFMargin.Text);
            liquidPlan.FMemo       = txtFMemo.Text;

            LiquidPlanService.Add(liquidPlan);

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

            parms.Clear();

            parms.Add("@keyId", newKeyId);
            parms.Add("@companyId", CurrentUser.AccountComId);
            parms.Add("@keyId1", Grid1SelectIds());
            parms.Add("@keyId2", Grid2SelectIds().ToList()[0]);
            parms.Add("@keyId3", Grid2SelectIds().ToList()[1]);
            parms.Add("@keyId4", Grid2SelectIds().ToList()[2]);

            SqlService.ExecuteProcedureCommand("proc_LiquidPlanMergeProc", parms);


            return(true);
        }
Пример #14
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = BottleDetectionService.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 : "";

                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;
                stock.FSalesman        = ddlFSalesman.SelectedValue;
                stock.FArea            = ddlFArea.SelectedValue;
                stock.FAmt             = 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 = txtFLogisticsNumber.Text;

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

                stock.FSubjectCode = ddlSubject.SelectedValue;
                stock.FSubjectName = ddlSubject.SelectedText;
                stock.FSKNum       = "";

                BottleDetectionService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "XS", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "1");
                    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);
        }
Пример #15
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region3.Title = "添加钢瓶检测";

                var temp = new LHBottleDetection
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //钢瓶检测
                    FType = Convert.ToInt32(GasEnumBill.BottleDetection),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),

                    FCate = "客户"
                };

                //临时写入单据
                BottleDetectionService.Add(temp);

                //合计
                var summary = new JObject
                {
                    { "FItemCode", "合计" },
                    { "FQty", 0 },
                    { "FAmount", 0 }
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region3.Title = "编辑钢瓶检测";

                if (StockOut != null)
                {
                    WebControlHandler.BindObjectToControls(StockOut, SimpleForm1);
                    txtFDate.SelectedDate = StockOut.FDate;
                    tbxFCustomer.Text     = StockOut.FName;

                    if (!string.IsNullOrEmpty(StockOut.FDriver))
                    {
                        ddlFDriver.SelectedValueArray = StockOut.FDriver.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockOut.FShipper))
                    {
                        ddlFShipper.SelectedValueArray = StockOut.FShipper.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockOut.FSupercargo))
                    {
                        ddlFSupercargo.SelectedValueArray = StockOut.FSupercargo.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockOut.FSalesman))
                    {
                        ddlFSalesman.SelectedValueArray = StockOut.FSalesman.Split(',');
                    }

                    ddlSubject.SelectedValue        = StockOut.FSubjectCode;
                    ddlFVehicleNum.SelectedValue    = StockOut.FVehicleNum;
                    ddlFArea.SelectedValue          = StockOut.FArea;
                    ddlDeliveryMethod.SelectedValue = StockOut.FDeliveryMethod;


                    if (Attachment != null)
                    {
                        lblfile.Text = string.Format(@"<a href='../../{0}' target='_blank'>附件</a>",    //
                                                     Attachment.FPath.Replace("~/", ""));
                    }
                    else
                    {
                        lblfile.Text = string.Empty;
                    }

                    BindDataGrid();
                }
                break;
            }
        }
Пример #16
0
        protected void fileUpload1_FileSelected(object sender, EventArgs e)
        {
            if (fileUpload1.HasFile)
            {
                string fileSuffix = fileUpload1.ShortFileName.Substring(fileUpload1.ShortFileName.LastIndexOf('.'));

                string sequence = SequenceService.CreateSequence("LH", CurrentUser.AccountComId);

                string fileName = sequence + fileSuffix;

                string uploadpath = Config.GetUploadpath();

                //该目录设定死,最好不要修改
                string fileTemp = (string.Format(@"{0}/temp/{1}/", uploadpath, DateTime.Now.ToString("yyyy-MM-dd"))); //

                if (!DirFile.XFileExists(Server.MapPath(fileTemp)))
                {
                    DirFile.XCreateDir(Server.MapPath(fileTemp));
                }

                string address = fileTemp + fileName;

                fileUpload1.SaveAs(Server.MapPath(address));

                //导入
                string connStr = string.Empty;//数据连接字符串
                if (fileSuffix == ".xls")
                {
                    connStr = "Provider=Microsoft.Jet.OleDb.4.0;" + "data source=" + Server.MapPath(address) + ";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";
                }
                else if (fileSuffix == ".xlsx")
                {
                    connStr = "Provider=Microsoft.ACE.OleDb.12.0;" + "data source=" + Server.MapPath(address) + ";Extended Properties='Excel 12.0; HDR=YES; IMEX=1'";
                }

                OleDbConnection conn = new OleDbConnection(connStr);
                conn.Open();

                DataTable        data   = new DataTable();
                const string     cmdSql = "select * from [Sheet1$]";
                OleDbDataAdapter da     = new OleDbDataAdapter(cmdSql, conn);
                da.Fill(data);
                conn.Close();

                DataTable table = new DataTable();
                table.Columns.Add("压力");
                table.Columns.Add("温度");
                table.Columns.Add("因子系数");
                for (int i = 1; i < data.Columns.Count; i++)
                {
                    for (int j = 0; j < data.Rows.Count; j++)
                    {
                        DataRow row = table.NewRow();
                        row[0] = data.Columns[i].ColumnName;
                        row[1] = data.Rows[j][0];
                        row[2] = data.Rows[j][i];
                        table.Rows.Add(row);
                    }
                }
                ViewState["dtData"] = table;
                Grid1.DataSource    = table;
                Grid1.DataBind();
                Grid1.Visible = true;

                fileUpload1.Reset();
            }
        }
Пример #17
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var order = FkOrderCheckedService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (order != null)
            {
                //核销主单据
                //--------------------------------------------------
                order.FCode = txtFCode.Text;
                order.FName = tbxFCustomer.Text;
                //--------------------------------------------------
                order.FDeleteFlag = 0;
                order.FMemo       = txtFMemo.Text.Trim();
                order.CreateBy    = CurrentUser.AccountName;
                order.FDate       = txtFDate.SelectedDate;

                //本次实际核销的金额
                decimal checkedAmt = 0.00M;

                //收款单
                decimal sksum = 0.00M;
                int[]   sks   = Grid1.SelectedRowIndexArray;

                for (int i = 0; i < sks.Length; i++)
                {
                    sksum += Convert.ToDecimal(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][2].ToString());
                }

                if (sksum <= 0)
                {
                    Alert.Show("要核销的收款单已核销完,暂无需核销单据。", MessageBoxIcon.Information);
                    return(false);
                }

                //销售金额
                decimal salesum = 0.00M;
                int[]   sales   = Grid2.SelectedRowIndexArray;

                for (int i = 0; i < sales.Length; i++)
                {
                    salesum += Convert.ToDecimal(Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][1].ToString());
                }

                if (sksum <= 0)
                {
                    Alert.Show("要核销的发货单已核销完,暂无需核销单据。", MessageBoxIcon.Information);
                    return(false);
                }

                if (sksum == salesum)
                {
                    //实际核销款
                    checkedAmt = sksum;

                    for (int i = 0; i < sks.Length; i++)
                    {
                        int    id    = Convert.ToInt32(Grid1.DataKeys[sks[i]][1].ToString());
                        string keyid = Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][0].ToString();
                        var    banks = new LHFKOrderCheckedBanks();
                        banks.KeyId      = txtKeyId.Text;
                        banks.CBankId    = id;
                        banks.FAmt       = Convert.ToDecimal(Grid1.DataKeys[sks[i]][2]);
                        banks.FCompanyId = CurrentUser.AccountComId;
                        var bank = FkOrderCheckedBanksService.Where(p => p.KeyId == txtKeyId.Text && p.CBankId == id && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();
                        if (bank != null)
                        {
                            FkOrderCheckedBanksService.SaveChanges();
                        }
                        else
                        {
                            FkOrderCheckedBanksService.Add(banks);
                        }
                    }
                    for (int i = 0; i < sales.Length; i++)
                    {
                        string keyid = Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][0].ToString();

                        var details = new LHFKOrderCheckedDetails();
                        details.KeyId      = txtKeyId.Text;
                        details.FSaleKeyId = keyid;
                        details.FAmount    = Convert.ToDecimal(Grid2.DataKeys[sks[i]][1]);
                        details.FCompanyId = CurrentUser.AccountComId;
                        var detail =
                            FkOrderCheckedDetailsService.Where(p => p.KeyId == txtKeyId.Text && p.FSaleKeyId == keyid && p.FCompanyId == CurrentUser.AccountComId)
                            .FirstOrDefault();

                        if (detail != null)
                        {
                            FkOrderCheckedDetailsService.SaveChanges();
                        }
                        else
                        {
                            FkOrderCheckedDetailsService.Add(details);
                        }
                    }
                }
                else if (sksum > salesum)
                {
                    //实际核销款
                    checkedAmt = salesum;

                    //分析
                    decimal kfpje = salesum;
                    for (int i = 0; i < sks.Length; i++)
                    {
                        int id = Convert.ToInt32(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][1].ToString());
                        //string keyid = Grid1.DataKeys[sks[i]][0].ToString();
                        /////////////////////////////////////////////////
                        var sk = Convert.ToDecimal(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][2]);

                        decimal hxje = 0.00M;
                        decimal yszj = sk;
                        if (kfpje == 0)
                        {
                            hxje = 0;
                        }
                        else
                        {
                            decimal kyje = kfpje - yszj;

                            if (kyje > 0)
                            {
                                hxje  = yszj;
                                kfpje = kyje;
                            }
                            else if (kyje == 0)
                            {
                                hxje  = kfpje;
                                kfpje = kyje;
                                //continue;
                            }
                            else
                            {
                                hxje  = kfpje;
                                kfpje = 0;
                                //continue;
                            }
                        }

                        /////////////////////////////////////////////////
                        var banks = new LHFKOrderCheckedBanks();
                        banks.KeyId      = txtKeyId.Text;
                        banks.CBankId    = id;
                        banks.FCompanyId = CurrentUser.AccountComId;

                        //本次核销款
                        banks.FAmt = hxje;

                        var bank =
                            FkOrderCheckedBanksService.Where(p => p.KeyId == txtKeyId.Text && p.CBankId == id && p.FCompanyId == CurrentUser.AccountComId)
                            .FirstOrDefault();
                        if (bank != null)
                        {
                            FkOrderCheckedBanksService.SaveChanges();
                        }
                        else
                        {
                            FkOrderCheckedBanksService.Add(banks);
                        }
                    }
                    /////////////////////////////////////////////////
                    decimal kfpje2 = salesum;
                    for (int i = 0; i < sales.Length; i++)
                    {
                        string keyid = Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][0].ToString();
                        //////////////////////////////////////////////////////////
                        var     sale = Convert.ToDecimal(Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][1]);
                        decimal hxje = 0.00M;
                        decimal yszj = sale;
                        if (kfpje2 == 0)
                        {
                            hxje = 0;
                        }
                        else
                        {
                            decimal kyje = kfpje2 - yszj;

                            if (kyje > 0)
                            {
                                hxje   = yszj;
                                kfpje2 = kyje;
                            }
                            else if (kyje == 0)
                            {
                                hxje   = kfpje2;
                                kfpje2 = kyje;
                                //continue;
                            }
                            else
                            {
                                hxje  = kfpje2;
                                kfpje = 0;
                                //continue;
                            }
                        }
                        /////////////////////////////////////////////////////////
                        var details = new LHFKOrderCheckedDetails();
                        details.KeyId      = txtKeyId.Text;
                        details.FSaleKeyId = keyid;
                        details.FAmount    = hxje;
                        details.FCompanyId = CurrentUser.AccountComId;
                        var detail =
                            FkOrderCheckedDetailsService.Where(p => p.KeyId == txtKeyId.Text && p.FSaleKeyId == keyid && p.FCompanyId == CurrentUser.AccountComId)
                            .FirstOrDefault();

                        if (detail != null)
                        {
                            FkOrderCheckedDetailsService.SaveChanges();
                        }
                        else
                        {
                            FkOrderCheckedDetailsService.Add(details);
                        }
                    }
                }
                else
                {
                    //实际核销款
                    checkedAmt = sksum;

                    //分析
                    decimal kfpje = sksum;
                    for (int i = 0; i < sks.Length; i++)
                    {
                        int id = Convert.ToInt32(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][1].ToString());
                        //string keyid = Grid1.DataKeys[sks[i]][0].ToString();
                        /////////////////////////////////////////////////
                        var sk = Convert.ToDecimal(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][2]);

                        decimal hxje = 0.00M;

                        decimal yszj = sk;

                        if (kfpje == 0)
                        {
                            hxje = 0;
                        }
                        else
                        {
                            decimal kyje = kfpje - yszj;

                            if (kyje > 0)
                            {
                                hxje  = yszj;
                                kfpje = kyje;
                            }
                            else if (kyje == 0)
                            {
                                hxje  = kfpje;
                                kfpje = kyje;
                                //continue;
                            }
                            else
                            {
                                hxje  = kfpje;
                                kfpje = 0;
                                //continue;
                            }
                        }

                        /////////////////////////////////////////////////
                        var banks = new LHFKOrderCheckedBanks();
                        banks.KeyId      = txtKeyId.Text;
                        banks.CBankId    = id;
                        banks.FCompanyId = CurrentUser.AccountComId;
                        //本次核销款
                        banks.FAmt = hxje;

                        var bank = FkOrderCheckedBanksService.Where(p => p.KeyId == txtKeyId.Text && p.CBankId == id && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();
                        if (bank != null)
                        {
                            FkOrderCheckedBanksService.SaveChanges();
                        }
                        else
                        {
                            FkOrderCheckedBanksService.Add(banks);
                        }
                    }


                    decimal kfpje2 = sksum;
                    for (int i = 0; i < sales.Length; i++)
                    {
                        string keyid = Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][0].ToString();
                        //////////////////////////////////////////////////////////
                        var     sale = Convert.ToDecimal(Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][1]);
                        decimal hxje = 0.00M;
                        decimal yszj = sale;
                        if (kfpje2 == 0)
                        {
                            hxje = 0;
                        }
                        else
                        {
                            decimal kyje = kfpje2 - yszj;

                            if (kyje > 0)
                            {
                                hxje   = yszj;
                                kfpje2 = kyje;
                            }
                            else if (kyje == 0)
                            {
                                hxje   = kfpje2;
                                kfpje2 = kyje;
                                //continue;
                            }
                            else
                            {
                                hxje  = kfpje2;
                                kfpje = 0;
                                //continue;
                            }
                        }

                        var details = new LHFKOrderCheckedDetails();
                        details.KeyId      = txtKeyId.Text;
                        details.FSaleKeyId = keyid;
                        details.FAmount    = hxje;
                        details.FCompanyId = CurrentUser.AccountComId;
                        var detail =
                            FkOrderCheckedDetailsService.Where(p => p.KeyId == txtKeyId.Text && p.FSaleKeyId == keyid && p.FCompanyId == CurrentUser.AccountComId)
                            .FirstOrDefault();

                        if (detail != null)
                        {
                            FkOrderCheckedDetailsService.SaveChanges();
                        }
                        else
                        {
                            FkOrderCheckedDetailsService.Add(details);
                        }
                    }
                }


                //-----------------------------------------------------
                //实际核销款
                order.FAmount = checkedAmt;

                FkOrderCheckedService.SaveChanges();

                //-----------------------------------------------------
                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "HF", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "18");
                    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);
        }
Пример #18
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region1.Title = "添加付款单";
                var temp = new LHFKOrder
                {
                    keyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    FType = Convert.ToInt32(GasEnumBill.Payment),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FAmount = 0,

                    FCate = "供应商",

                    FCompanyId = CurrentUser.AccountComId
                };

                //临时写入单据
                FKOrderService.Add(temp);


                var summary = new JObject
                {
                    { "FCode", "合计" },
                    { "FAmt", 0 },
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region1.Title = "编辑付款单";
                if (SkOrder != null)
                {
                    txtFCode.Text     = SkOrder.FCode;
                    tbxFCustomer.Text = SkOrder.FName;

                    //txtFAddress.Text = StockOut.FAddress;
                    //txtFFreight.Text = StockOut.FFreight.ToString();

                    //txtFLinkman.Text = StockOut.FLinkman;
                    txtFMemo.Text = SkOrder.FMemo;
                    //txtFPhone.Text = StockOut.FPhone;

                    //ddlFDriver.Text = StockOut.FDriver;
                    //ddlFShipper.SelectedValue = StockOut.FShipper;
                    //ddlFSupercargo.Text = StockOut.FSupercargo;
                    //ddlFVehicleNum.SelectedValue = StockOut.FVehicleNum;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #19
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                Region1.Title = "添加空瓶回收单";

                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHStockIn
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //空瓶回收单
                    FType = Convert.ToInt32(GasEnumBill.BottleReturn),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                StockInService.Add(temp);

                break;

            case WebAction.Edit:
                Region1.Title = "编辑空瓶回收单";
                txtKeyId.Text = KeyId;
                if (StockIn != null)
                {
                    WebControlHandler.BindObjectToControls(StockIn, SimpleForm1);
                    txtFDate.SelectedDate = StockIn.FDate;
                    tbxFCustomer.Text     = StockIn.FName;

                    if (!string.IsNullOrEmpty(StockIn.FDriver))
                    {
                        ddlFDriver.SelectedValueArray = StockIn.FDriver.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockIn.FShipper))
                    {
                        ddlFShipper.SelectedValueArray = StockIn.FShipper.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockIn.FSupercargo))
                    {
                        ddlFSupercargo.SelectedValueArray = StockIn.FSupercargo.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockIn.FSalesman))
                    {
                        ddlFSalesman.SelectedValueArray = StockIn.FSalesman.Split(',');
                    }

                    ddlFVehicleNum.SelectedValue    = StockIn.FVehicleNum;
                    ddlFArea.SelectedValue          = StockIn.FArea;
                    ddlDeliveryMethod.SelectedValue = StockIn.FDeliveryMethod;
                    ddlReturn.SelectedValue         = StockIn.FClass;
                    ddlDeliveryMethod.SelectedValue = StockIn.FDeliveryMethod;

                    ddlFDistributionPoint.SelectedValue = StockIn.FDistributionPoint;

                    hfdCate.Text = StockIn.FCate;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #20
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            //生成调度单
            LHDispatchCenter dispatch = new LHDispatchCenter();

            //调度单号生成
            string newKeyId = SequenceService.CreateSequence("PC", CurrentUser.AccountComId);

            dispatch.KeyId          = newKeyId; lblKeyId.Text = newKeyId;
            dispatch.FCompanyId     = CurrentUser.AccountComId;
            dispatch.FBeginDate     = dptBeginDate.SelectedDate;
            dispatch.FBeginTime     = dpBeginTime.Text.Trim();
            dispatch.FEndDate       = dptEnd.SelectedDate;
            dispatch.FEndTime       = dpEndTime.Text.Trim();
            dispatch.FDate          = DateTime.Now;
            dispatch.FVehicleNum    = ddlFVehicleNum.SelectedValue;
            dispatch.FDriver        = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
            dispatch.FSupercargo    = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
            dispatch.CreateBy       = CurrentUser.AccountName;
            dispatch.FFlag          = 1;
            dispatch.FLogistics     = ddlLogistics.SelectedText;
            dispatch.FLogisticsCode = ddlLogistics.SelectedValue;

            dispatch.FActual         = string.IsNullOrEmpty(txtFActual.Text.Trim()) ? 0M : Convert.ToDecimal(txtFActual.Text.Trim());
            dispatch.FTrailerPlate   = ddlFTrailerPlate.SelectedValue;
            dispatch.FFrom           = ddlFrom.SelectedValue;
            dispatch.FTo             = ddlTo.SelectedValue;
            dispatch.FDeliveryMethod = ddlDeliveryMethod.SelectedValue;
            dispatch.FAuditFlag      = 0;

            DispatchCenterService.Add(dispatch);


            string[] keys  = KeyId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] patch = patchid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string key in keys)
            {
                if (!string.IsNullOrEmpty(key))
                {
                    //状态
                    LHBillStatus flow = new LHBillStatus
                    {
                        KeyId      = key,
                        FCompanyId = CurrentUser.AccountComId,
                        FDeptId    = CurrentUser.AccountOrgId,
                        FOperator  = CurrentUser.AccountName,
                        FDate      = Convert.ToDateTime(dptBeginDate.SelectedDate),

                        FActionName = "配车",

                        FMemo = string.Format(@"单据号{0}被{1}作配车业务处理。", key, CurrentUser.AccountName)
                    };

                    BillStatusService.Add(flow);

                    LHStockOut info = new StockOutService().FirstOrDefault(p => p.KeyId == key && p.FCompanyId == CurrentUser.AccountComId);

                    if (info != null)
                    {
                        Dictionary <string, object> infoParms = new Dictionary <string, object>();
                        infoParms.Clear();

                        infoParms.Add("@keyid", info.FLogisticsNumber);
                        infoParms.Add("@companyId", CurrentUser.AccountComId);
                        infoParms.Add("@FVehicleNum", ddlFVehicleNum.SelectedValue);
                        infoParms.Add("@FDriver", GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray));
                        infoParms.Add("@FSupercargo", GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray));
                        infoParms.Add("@FDispatchNum", newKeyId); //调度单号

                        SqlService.ExecuteProcedureCommand("proc_DispatchCenter", infoParms);
                    }


                    //变更单据上的司机、押韵员、车牌号
                    Dictionary <string, object> parms = new Dictionary <string, object>();
                    parms.Clear();

                    parms.Add("@keyid", key);
                    parms.Add("@companyId", CurrentUser.AccountComId);
                    parms.Add("@FVehicleNum", ddlFVehicleNum.SelectedValue);
                    parms.Add("@FDriver", GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray));
                    parms.Add("@FSupercargo", GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray));
                    parms.Add("@FDispatchNum", newKeyId); //调度单号

                    SqlService.ExecuteProcedureCommand("proc_DispatchCenter", parms);

                    List <LHStockOut> outs  = new List <LHStockOut>();
                    List <LHPassCard> cards = new List <LHPassCard>();
                }
            }
            foreach (var item in patch)
            {
                LHStockOutDispatch dis = StockoutDispatchServices.Where(p => p.KeyId == item).FirstOrDefault();
                if (dis != null)
                {
                    dis.FState = 1;
                    StockoutDispatchServices.SaveChanges();
                }
            }

            return(true);
        }
Пример #21
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:

                Region1.Title = "添加生产单";
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHStockIn
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //发货单
                    FType = Convert.ToInt32(GasEnumBill.Production),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                StockInService.Add(temp);

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region1.Title = "编辑生产单";

                if (StockIn != null)
                {
                    txtFMemo.Text = StockIn.FMemo;
                    ddlFProducer.SelectedValue = StockIn.FProducer;
                    ddlFSurveyor.SelectedValue = StockIn.FSurveyor;
                    ddlWorkShop.SelectedValue  = StockIn.FProductionWorkshop;
                    var product =
                        StockInDetailsService.Where(
                            p => p.KeyId == KeyId && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

                    if (product != null)
                    {
                        txtFCode.Text            = product.FItemCode;
                        txtFQty.Text             = product.FQty.ToString();
                        tbxFBottle.SelectedValue = product.FBottle;
                        txtFBottleQty.Text       = product.FBottleQty.ToString();
                        txtFCostPrice.Text       = product.FCostPrice.ToString();
                        txtFBalance.Text         = product.FBalance.ToString();

                        //
                        var item =
                            new ItemsService().Where(
                                p => p.FCode == txtFCode.Text && p.FCompanyId == CurrentUser.AccountComId)
                            .FirstOrDefault();

                        if (item != null)
                        {
                            tbxFName.Text = item.FName;
                        }
                    }

                    BindDataGrid();
                }
                break;
            }
        }
Пример #22
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("MR", CurrentUser.AccountComId);
                Region3.Title = "添加领料单";

                var temp = new LHStockOut
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //发货单
                    FType = Convert.ToInt32(GasEnumBill.picking),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                StockOutService.Add(temp);

                //合计
                var summary = new JObject
                {
                    { "FItemCode", "合计" },
                    { "FQty", 0 },
                    { "FAmount", 0 }
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;

                Region3.Title = "编辑领料单";
                if (StockOut != null)
                {
                    WebControlHandler.BindObjectToControls(StockOut, SimpleForm1);
                    txtFDate.SelectedDate = StockOut.FDate;
                    //tbxFCustomer.Text = StockOut.FName;

                    //if (!string.IsNullOrEmpty(StockOut.FDriver))
                    //    ddlFDriver.SelectedValueArray = StockOut.FDriver.Split(',');
                    //if (!string.IsNullOrEmpty(StockOut.FShipper))
                    //    ddlFShipper.SelectedValueArray = StockOut.FShipper.Split(',');
                    //if (!string.IsNullOrEmpty(StockOut.FSupercargo))
                    //    ddlFSupercargo.SelectedValueArray = StockOut.FSupercargo.Split(',');
                    //if (!string.IsNullOrEmpty(StockOut.FSalesman))
                    //    ddlFSalesman.SelectedValueArray = StockOut.FSalesman.Split(',');

                    //ddlFVehicleNum.SelectedValue = StockOut.FVehicleNum;
                    //ddlFArea.SelectedValue = StockOut.FArea;
                    //ddlDeliveryMethod.SelectedValue = StockOut.FDeliveryMethod;

                    ddlFCate.SelectedValue = StockOut.FCate;

                    ddlOrgnization.SelectedValue = StockOut.FCode;

                    ddlFReceiver.SelectedValue = StockOut.FSalesman;

                    ddlFWarehouse.SelectedValue = StockOut.FT6Warehouse;

                    ddlT6ReceiveSendType.SelectedValue = StockOut.FT6ReceiveSendTypeNum;

                    ddlFGroup.SelectedValue = StockOut.FGroup;

                    ddlFDistributionPoint.SelectedValue = StockOut.FDistributionPoint;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #23
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);
        }
Пример #24
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                Region1.Title = "添加气瓶退租单";
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHLeaseReturn
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //租金收款单
                    FType = Convert.ToInt32(GasEnumBill.LeaseReturn),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                LeaseReturnService.Add(temp);

                break;

            case WebAction.Edit:
                Region1.Title = "编辑气瓶退租单";
                txtKeyId.Text = KeyId;
                if (LeaseReturn != null)
                {
                    txtFCode.Text     = LeaseReturn.FCode;
                    tbxFCustomer.Text = LeaseReturn.FName;

                    txtFAddress.Text = LeaseReturn.FAddress;
                    //txtFFreight.Text = LeaseReturn.FFreight.ToString();

                    txtFLinkman.Text = LeaseReturn.FLinkman;
                    txtFMemo.Text    = LeaseReturn.FMemo;
                    txtFPhone.Text   = LeaseReturn.FPhone;

                    ddlFDriver.Text              = LeaseReturn.FDriver;
                    ddlFShipper.SelectedValue    = LeaseReturn.FShipper;
                    ddlFSupercargo.Text          = LeaseReturn.FSupercargo;
                    ddlFVehicleNum.SelectedValue = LeaseReturn.FVehicleNum;
                    hfdClass.Text = LeaseReturn.FCate;

                    ddlSubjectIn.SelectedValue  = LeaseReturn.FSubjectCodeIn;
                    ddlSubjectOut.SelectedValue = LeaseReturn.FSubjectCodeOut;
                    txtFDepositSecurity.Text    = LeaseReturn.FDepositSecurity.ToString();
                    txtFPaymentRentals.Text     = LeaseReturn.FPaymentRentals.ToString();


                    BindDataGrid();
                }
                break;
            }
        }
Пример #25
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var leaseReturn = LeaseReturnService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

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

                leaseReturn.FCode            = txtFCode.Text;
                leaseReturn.FName            = tbxFCustomer.Text;
                leaseReturn.FAddress         = txtFAddress.Text.Trim();
                leaseReturn.FCompanyId       = CurrentUser.AccountComId;
                leaseReturn.FFlag            = 1;
                leaseReturn.FDeleteFlag      = 0;
                leaseReturn.FLinkman         = txtFLinkman.Text.Trim();
                leaseReturn.FMemo            = txtFMemo.Text.Trim();
                leaseReturn.FPhone           = txtFPhone.Text.Trim();
                leaseReturn.FShipper         = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                leaseReturn.FVehicleNum      = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : "";
                leaseReturn.FSupercargo      = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                leaseReturn.FDriver          = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
                leaseReturn.FPaymentRentals  = string.IsNullOrEmpty(txtFPaymentRentals.Text.Trim()) ? 0 : Convert.ToDecimal(txtFPaymentRentals.Text.Trim());
                leaseReturn.FDepositSecurity = string.IsNullOrEmpty(txtFDepositSecurity.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDepositSecurity.Text.Trim());

                leaseReturn.FSubjectCodeIn = ddlSubjectIn.SelectedValue;
                leaseReturn.FSubjectNameIn = ddlSubjectIn.SelectedText;

                leaseReturn.FSubjectCodeOut = ddlSubjectOut.SelectedValue;
                leaseReturn.FSubjectNameOut = ddlSubjectOut.SelectedText;
                leaseReturn.FSKNum          = "";
                leaseReturn.FCate           = hfdClass.Text;
                leaseReturn.FFKNum          = "";
                LeaseReturnService.SaveChanges();


                var parms = new Dictionary <string, object>();
                parms.Clear();
                parms.Add("@keyID", leaseReturn.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);
                var data = SqlService.ExecuteProcedureCommand("proc_LeaseReturnAmt", parms).Tables[0];

                for (int i = 0; i < data.Rows.Count; i++)
                {
                    int ids     = Convert.ToInt32(data.Rows[i]["FDetailsFId"]);
                    int qty     = Convert.ToInt32(data.Rows[i]["Qty"]);
                    var details = LeaseDetailsService.FirstOrDefault(p => p.FId == ids);
                    details.FReturnQty = details.FReturnQty + qty;
                    LeaseDetailsService.SaveChanges();
                }

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "TZ", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "8");
                    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", hfdClass.Text);
                    parmsAuto.Add("@date", Convert.ToDateTime(leaseReturn.FDate).ToString("yyyy-MM-dd"));
                    parmsAuto.Add("@FSKNum", leaseReturn.FSKNum);
                    parmsAuto.Add("@FAbstract", "退租");

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

                return(true);
            }


            return(false);
        }
Пример #26
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockInService.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;
                stock.FFreight    = 0;// Convert.ToDecimal(txtFFreight.Text.Trim());
                stock.FLinkman    = txtFLinkman.Text.Trim();
                stock.FMemo       = txtFMemo.Text.Trim();
                stock.FPhone      = txtFPhone.Text.Trim();

                //stock.FDriver = !ddlFDriver.SelectedValue.Equals("-1") ? ddlFDriver.SelectedText : "";
                stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                //stock.FSupercargo = !ddlFSupercargo.SelectedValue.Equals("-1") ? ddlFSupercargo.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_SalesReturnAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount          = amt;
                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.FClass = ddlReturn.SelectedValue;
                LHCustomer custmernodel = new CustomerService().FirstOrDefault(p => p.FCode == txtFCode.Text.Trim());
                if (custmernodel != null)
                {
                    hfdCate.Text = "客户";
                }
                else
                {
                    hfdCate.Text = "供应商";
                }
                stock.FCate = hfdCate.Text;
                stock.FDate = txtFDate.SelectedDate;
                stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue;
                stock.FTime1             = DateTime.Now;

                StockInService.SaveChanges();


                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "HK", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "13");
                    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);
        }
Пример #27
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

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

                var prod =
                    StockInDetailsService.FirstOrDefault(
                        p => p.KeyId == txtKeyId.Text && p.FCompanyId == CurrentUser.AccountComId);

                if (prod == null)
                {
                    //生产产品入库
                    var product = new LHStockInDetails
                    {
                        KeyId         = txtKeyId.Text,
                        FItemCode     = txtFCode.Text,
                        FPrice        = 0,
                        FAmount       = 0,
                        FQty          = Convert.ToDecimal(txtFQty.Text),
                        FBottle       = tbxFBottle.SelectedValue,
                        FBottleQty    = Convert.ToInt16(txtFBottleQty.Text),
                        FBottleOweQty = 0,
                        FCompanyId    = CurrentUser.AccountComId,
                        FCateId       = 2000,
                        FMemo         = "生产入库",
                        FCostPrice    = Convert.ToDecimal(txtFCostPrice.Text),
                        FBalance      = Convert.ToDecimal(txtFBalance.Text),
                    };

                    StockInDetailsService.Add(product);
                }
                else
                {
                    prod.FItemCode  = txtFCode.Text;
                    prod.FQty       = Convert.ToDecimal(txtFQty.Text);
                    prod.FBottle    = tbxFBottle.SelectedValue;
                    prod.FBottleQty = Convert.ToInt32(txtFBottleQty.Text);
                    prod.FCostPrice = Convert.ToDecimal(txtFCostPrice.Text);
                    prod.FBalance   = Convert.ToDecimal(txtFBalance.Text);

                    StockInDetailsService.SaveChanges();
                }
                //-------------------------------------------------------------------

                stock.FCompanyId  = CurrentUser.AccountComId;
                stock.FFlag       = 1;
                stock.FDeleteFlag = 0;
                stock.FMemo       = txtFMemo.Text.Trim();

                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_PurchaseAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount = amt;

                stock.FSurveyor = !ddlFSurveyor.SelectedValue.Equals("-1") ? ddlFSurveyor.SelectedText : "";
                stock.FProducer = !ddlFProducer.SelectedValue.Equals("-1") ? ddlFProducer.SelectedText : "";//GasHelper.GetDropDownListArrayString(ddlFProducer.SelectedItemArray);

                stock.FBatchNumber = txtFBatchNumber.Text.Trim();

                stock.FProductionWorkshop = ddlWorkShop.SelectedValue;

                stock.FCate = "内部";
                stock.FCode = CurrentUser.AccountComId.ToString(CultureInfo.InvariantCulture);
                stock.FName = "";
                stock.FDate = txtFDate.SelectedDate;


                StockInService.SaveChanges();


                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PR", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "6");
                    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}新增生产单据。", newKeyId, CurrentUser.AccountName)
                    };
                    GasHelper.AddBillStatus(billStatus);
                }

                return(true);
            }
            return(false);
        }
Пример #28
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text           = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region1.Title           = "添加采购单";
                txtFT6ExchangeRate.Text = "1";
                var temp = new LHStockIn
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //发货单
                    FType = Convert.ToInt32(GasEnumBill.Purchase),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),

                    FCate = "供应商"
                };

                //临时写入单据
                StockInService.Add(temp);

                //合计
                var summary = new JObject
                {
                    { "FItemCode", "合计" },
                    { "FQty", 0 },
                    { "FAmount", 0 }
                };
                Grid1.SummaryData = summary;
                break;

            case WebAction.Edit:
                Region1.Title = "编辑采购单";
                txtKeyId.Text = KeyId;
                if (StockIn != null)
                {
                    WebControlHandler.BindObjectToControls(StockIn, SimpleForm1);

                    txtFDate.SelectedDate = StockIn.FDate;
                    tbxFCustomer.Text     = StockIn.FName;

                    if (!string.IsNullOrEmpty(StockIn.FDriver))
                    {
                        ddlFDriver.SelectedValueArray = StockIn.FDriver.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockIn.FShipper))
                    {
                        ddlFShipper.SelectedValueArray = StockIn.FShipper.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockIn.FSupercargo))
                    {
                        ddlFSupercargo.SelectedValueArray = StockIn.FSupercargo.Split(',');
                    }
                    if (!string.IsNullOrEmpty(StockIn.FSalesman))
                    {
                        ddlFSalesman.SelectedValueArray = StockIn.FSalesman.Split(',');
                    }

                    ddlSubject.SelectedValue        = StockIn.FSubjectCode;
                    ddlFVehicleNum.SelectedValue    = StockIn.FVehicleNum;
                    ddlFArea.SelectedValue          = StockIn.FArea;
                    ddlDeliveryMethod.SelectedValue = StockIn.FDeliveryMethod;

                    ddlFT6PurchaseType.SelectedValue    = StockIn.FT6PurchaseTypeNum;
                    ddlFT6Currency.SelectedValue        = StockIn.FT6Currency;
                    ddlT6ReceiveSendType.SelectedValue  = StockIn.FT6ReceiveSendTypeNum;
                    tbxFLogisticsNumber.Text            = StockIn.FLogisticsNumber;
                    ddlWarehouse.SelectedValue          = StockIn.FT6Warehouse;
                    ddlFDistributionPoint.SelectedValue = StockIn.FDistributionPoint;

                    BindDataGrid();
                }
                break;
            }
        }
Пример #29
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

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


                //stock.FClass = ddlFCate.SelectedValue;
                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("@keyID", stock.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);
                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]);

                stock.FAmount          = amt;
                stock.FDate            = txtFDate.SelectedDate;
                stock.FReconciliation  = txtFReconciliation.Text;
                stock.FDeliveryMethod  = ddlDeliveryMethod.SelectedValue;
                stock.FLogisticsNumber = tbxFLogisticsNumber.Text;

                stock.FAmt = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim());

                stock.FSupercargo  = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                stock.FDriver      = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
                stock.FSubjectCode = ddlSubject.SelectedValue;
                stock.FSubjectName = ddlSubject.SelectedText;

                stock.FDate = txtFDate.SelectedDate;


                #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


                stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue;


                StockInService.SaveChanges();

                //订单出库
                var passCard = PassCardService.Where(p => p.KeyId == tbxFLogisticsNumber.Text.Trim()).FirstOrDefault();

                if (passCard != null)
                {
                    passCard.FOutFlag = "已出库";

                    PassCardService.SaveChanges();
                }


                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "WC", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "4");
                    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", string.IsNullOrEmpty(stock.FSKNum) ? "" : stock.FSKNum);

                    SqlService.ExecuteProcedureCommand("proc_FKOrderAuto", parmsAuto);
                }
                return(true);
            }
            return(false);
        }
Пример #30
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                Region1.Title = "添加收款单";
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHSKOrder
                {
                    keyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //发货单
                    //FType = Convert.ToInt32(GasEnumBill.Receipt),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FAmount = 0,

                    FCate = "客户",

                    FCompanyId = CurrentUser.AccountComId

                                 //F = CurrentUser.AccountComId,

                                 //FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                                 //FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                SKOrderService.Add(temp);


                var summary = new JObject
                {
                    { "FCode", "合计" },
                    { "FAmt", 0 },
                };

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region1.Title = "编辑收款单";
                if (SkOrder != null)
                {
                    txtFCode.Text              = SkOrder.FCode;
                    tbxFCustomer.Text          = SkOrder.FName;
                    ddlFAbstract.SelectedValue = SkOrder.FAbstract;
                    txtFMemo.Text              = SkOrder.FMemo;

                    BindDataGrid();
                }
                break;
            }
        }