Exemple #1
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (StockOut != null)
            {
                ModifiedGrid();

                StockOut.FCompanyId = CurrentUser.AccountComId;

                StockOut.FMemo = txtFMemo.Text.Trim();
                StockOut.FDate = txtFDate.SelectedDate;

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

                parms.Add("@keyID", StockOut.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);
                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]);
                StockOut.FDistributionPoint = ddlFDistributionPoint.SelectedValue;
                StockOut.FAmount            = amt;
                StockOut.FDate    = txtFDate.SelectedDate;
                StockOut.CreateBy = CurrentUser.AccountName;


                return(StockOutService.SaveChanges() >= 0);
            }
            return(false);
        }
Exemple #2
0
 public delegateController(IManageRepository _manageRepository, IBomRepository _bomrepository, IPurchaseRepository _bomRepository, IStockInRepository _stockinrepository, IStockOutRepository _stockoutrepository)
 {
     manageService   = new ManageService(_manageRepository);
     bomService      = new BomService(_bomrepository);
     stockoutService = new StockOutService(_stockoutrepository);
     stockinService  = new StockInService(_stockinrepository);
     purchaseService = new PurchaseService(_bomRepository);
 }
Exemple #3
0
 public mainController(IAccountRepository _accountRepository, IManageRepository _manageRepository, IPurchaseRepository _purchaseRepository, IStockInRepository _stockinrepository, IStockOutRepository _stockoutrepository, IBomRepository _bomrepository)
 {
     accountService  = new AccountService(_accountRepository);
     purchaseService = new PurchaseService(_purchaseRepository);
     stockinService  = new StockInService(_stockinrepository);
     stockoutService = new StockOutService(_stockoutrepository);
     manageService   = new ManageService(_manageRepository);
     bomService      = new BomService(_bomrepository);
 }
Exemple #4
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (StockOut != null)
            {
                ModifiedGrid();

                StockOut.FCode = txtFCode.Text;
                StockOut.FName = tbxFCustomer.Text;
                //------------------------------------------------------

                StockOut.FAddress   = txtFAddress.Text.Trim();
                StockOut.FCompanyId = CurrentUser.AccountComId;

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

                //StockOut.FFlag = 1;

                //StockOut.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                StockOut.FLinkman = txtFLinkman.Text.Trim();
                StockOut.FMemo    = txtFMemo.Text.Trim();
                StockOut.FPhone   = txtFPhone.Text.Trim();

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

                //parms.Add("@keyID", StockOut.KeyId);
                //parms.Add("@companyId", CurrentUser.ToString());

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

                StockOut.FAmount            = 0;
                StockOut.FDistributionPoint = ddlFDistributionPoint.SelectedValue;


                StockOut.FSalesman       = ddlFSalesman.SelectedValue;
                StockOut.FArea           = ddlFArea.SelectedValue;
                StockOut.FAmt            = 0;// Convert.ToDecimal(txtFAmt.Text.Trim());
                StockOut.FReconciliation = txtFReconciliation.Text;

                StockOut.FDeliveryMethod  = ddlDeliveryMethod.SelectedValue;
                StockOut.FLogisticsNumber = txtFLogisticsNumber.Text;

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

                StockOut.FCate    = hfdCate.Text;
                StockOut.FDate    = txtFDate.SelectedDate;
                StockOut.CreateBy = CurrentUser.AccountName;

                return(StockOutService.SaveChanges() >= 0);
            }
            return(false);
        }
Exemple #5
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region1.Title = "添加盘亏单";
                var temp = new LHStockOut
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

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

                    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:
                Region1.Title = "编辑盘亏单";
                txtKeyId.Text = KeyId;
                if (StockOut != null)
                {
                    txtFMemo.Text          = StockOut.FMemo;
                    ddlFCate.SelectedValue = StockOut.FCate;
                    BindDataGrid();
                }
                break;
            }
        }
Exemple #6
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;
            }
        }
 public StockOutManager(int connectorId)
 {
     service = base.CreateService(typeof(StockOutService), connectorId) as StockOutService;
 }
Exemple #8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string backouts = context.Request["params"];

            TmsReturnModel         returnModel    = new TmsReturnModel();
            StockOutDetailsService service        = new StockOutDetailsService();
            DispatchCenterService  centerService  = new DispatchCenterService();
            StockInDetailsService  stockInDetails = new StockInDetailsService();

            try
            {
                using (TransactionScope trans = new TransactionScope())
                {
                    tmsModel outs = JsonConvert.DeserializeObject <tmsModel>(backouts);
                    if (outs.stockOutDetailsList != null)
                    {
                        foreach (LHStockOutDetails items in outs.stockOutDetailsList)
                        {
                            LHStockOutDetails details = service.Where(p => p.KeyId == items.KeyId && p.FId == items.FId).FirstOrDefault();

                            if (details != null)
                            {
                                details.FRecycleQty = items.FRecycleQty;
                                details.FReturnQty  = items.FReturnQty;

                                details.FDevice = items.FDevice;

                                details.FDeviceValue = string.IsNullOrEmpty(items.FDeviceValue.ToString()) ? 0 : Convert.ToDecimal(items.FDeviceValue);

                                details.FInTemperature = string.IsNullOrEmpty(items.FInTemperature.ToString()) //
                                    ? 0 : Convert.ToDecimal(items.FInTemperature.ToString());
                                details.FInPressure = string.IsNullOrEmpty(items.FInPressure.ToString())       //
                                    ? 0 : Convert.ToDecimal(items.FInPressure.ToString());

                                details.FOutTemperature = string.IsNullOrEmpty(items.FOutTemperature.ToString()) //
                                    ? 0 : Convert.ToDecimal(items.FOutTemperature.ToString());
                                details.FOutPressure = string.IsNullOrEmpty(items.FOutPressure.ToString())       //
                                    ? 0 : Convert.ToDecimal(items.FOutPressure.ToString());

                                details.FPayTemperature = string.IsNullOrEmpty(items.FPayTemperature.ToString()) //
                                    ? 0 : Convert.ToDecimal(items.FPayTemperature.ToString());
                                details.FPayPressure = string.IsNullOrEmpty(items.FPayPressure.ToString())       //
                                    ? 0 : Convert.ToDecimal(items.FPayPressure.ToString());

                                details.FReceiveTemperature = string.IsNullOrEmpty(items.FReceiveTemperature.ToString()) //
                                                    ? 0 : Convert.ToDecimal(items.FReceiveTemperature.ToString());
                                details.FReceivePressure = string.IsNullOrEmpty(items.FReceivePressure.ToString())       //
                                    ? 0 : Convert.ToDecimal(items.FReceivePressure.ToString());

                                //数量计算
                                LHStockOut StockOut = new StockOutService().Where(p => p.KeyId == items.KeyId).FirstOrDefault();
                                string     FCode    = StockOut.FCode;
                                //计算公式
                                LHTubePrice v1 = new TubePriceService().Where(p => p.FBill == "销售" &&//
                                                                              p.FCode == FCode &&//
                                                                              p.FItemCode == details.FItemCode).FirstOrDefault();

                                if (v1 != null)
                                {
                                    //< font color = "red" >$W1:进厂温度、$W2:出厂温度、$W3: 交付温度、$W4: 接收温度、$V: 水容积 </ font >< br />
                                    //< font color = "red" >$Y1:进厂压力、$Y2:出厂压力、$Y3: 交付压力、$Y4: 接收压力 </ font >< br />

                                    string inW = Convert.ToDecimal(details.FInTemperature).ToString(CultureInfo.InvariantCulture);
                                    string inY = Convert.ToDecimal(details.FInPressure).ToString(CultureInfo.InvariantCulture);

                                    string outW = Convert.ToDecimal(details.FOutTemperature).ToString(CultureInfo.InvariantCulture);
                                    string outY = Convert.ToDecimal(details.FOutPressure).ToString(CultureInfo.InvariantCulture);;

                                    string payW = Convert.ToDecimal(details.FPayTemperature).ToString(CultureInfo.InvariantCulture);
                                    string payY = Convert.ToDecimal(details.FPayPressure).ToString(CultureInfo.InvariantCulture);

                                    string recW = Convert.ToDecimal(details.FReceiveTemperature).ToString(CultureInfo.InvariantCulture);
                                    string recY = Convert.ToDecimal(details.FReceivePressure).ToString(CultureInfo.InvariantCulture);

                                    //水溶积
                                    string v = Convert.ToDecimal(details.FDeviceValue).ToString(CultureInfo.InvariantCulture);

                                    //数量
                                    string s1 = v1.FFormula.Replace("$W1", inW) //
                                                .Replace("$W2", outW)
                                                .Replace("$W3", payW)           //
                                                .Replace("$W4", recW)           //
                                                .Replace("$Y1", inY)            //
                                                .Replace("$Y2", outY)           //
                                                .Replace("$Y3", payY)           //
                                                .Replace("$Y4", recY)           //
                                                .Replace("$V", v);

                                    //数量
                                    details.FQty = Convert.ToDecimal(FormulaCalculator.Eval(s1));
                                    //金额
                                    details.FAmount = details.FQty * details.FPrice;
                                }


                                service.SaveChanges();
                            }
                        }
                    }
                    if (outs.dispatchCenterList != null)
                    {
                        foreach (LHDispatchCenter item in outs.dispatchCenterList)
                        {
                            LHDispatchCenter lH = centerService.Where(p => p.KeyId == item.KeyId & p.FAuditFlag == 0).FirstOrDefault();
                            if (lH != null)
                            {
                                lH.FDriver     = item.FDriver;
                                lH.FSupercargo = item.FSupercargo;
                                lH.FMileage    = item.FMileage;
                            }

                            centerService.SaveChanges();
                        }
                    }
                    trans.Complete();
                }

                returnModel.code = "200";
                returnModel.msg  = "成功";
            }
            catch (Exception ex)
            {
                returnModel.code = "500";
                returnModel.msg  = "失败";
                returnModel.msg  = ex.Message;
            }



            context.Response.Write(JsonConvert.SerializeObject(returnModel));
        }
Exemple #9
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

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

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

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

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

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

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

                stock.FAmount = 0;


                //stock.f

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

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

                stock.FAuditFlag = 1;

                StockOutService.SaveChanges();


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

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

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

                    //GasHelper.AddBillStatus(billStatus);

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

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

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


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

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

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


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

                    AttachmentService.Add(attachment);
                }


                return(true);
            }

            return(false);
        }
Exemple #10
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (StockOut != null)
            {
                ModifiedGrid();
                /////////////////////////////////////////////////////////////////////////////

                StockOut.FCode = txtFCode.Text;
                StockOut.FName = tbxFCustomer.Text;
                //------------------------------------------------------
                StockOut.FAddress = txtFAddress.Text.Trim();

                StockOut.FDate = txtFDate.SelectedDate;

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

                StockOut.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                StockOut.FLinkman = txtFLinkman.Text.Trim();
                StockOut.FMemo    = txtFMemo.Text.Trim();
                StockOut.FPhone   = txtFPhone.Text.Trim();

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

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

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

                StockOut.FAmount = 0;

                StockOut.FSalesman = ddlFSalesman.SelectedValue;
                StockOut.FArea     = ddlFArea.SelectedValue;
                StockOut.FAmt      = 0;// string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim());//
                //StockOut.FDiscountAmount = string.IsNullOrEmpty(txtFDiscountAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDiscountAmount.Text.Trim());
                StockOut.FReconciliation = txtFReconciliation.Text;
                StockOut.FDeliveryMethod = ddlDeliveryMethod.SelectedValue;

                StockOut.FLogisticsNumber = ddlFCate.SelectedValue;;

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

                StockOut.CreateBy           = CurrentUser.AccountName;
                StockOut.FDistributionPoint = ddlFDistributionPoint.SelectedValue;
                StockOut.FStatus            = 10;
                StockOut.FAuditFlag         = 1;

                StockOutService.SaveChanges();


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

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

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

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

                //parmsAuto.Add("@KeyId", StockOut.KeyId);
                //parmsAuto.Add("@companyId", CurrentUser.AccountComId);
                //parmsAuto.Add("@FCate", "客户");
                //parmsAuto.Add("@date", Convert.ToDateTime(StockOut.FDate).ToShortDateString());
                //parmsAuto.Add("@FSKNum", string.IsNullOrEmpty(StockOut.FSKNum) ? "" : StockOut.FSKNum);

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

                return(true);
            }
            return(false);
        }
Exemple #11
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region3.Title = "添加采购申请单";

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

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //采购申请单
                    FType = Convert.ToInt32(GasEnumBill.PurchaseApp),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),

                    FCate = "供应商"
                };

                //临时写入单据
                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;
                    txtFCode.Text         = StockOut.FCode;

                    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;
                    ddlFCate.SelectedValue              = StockOut.FLogisticsNumber;
                    ddlFDistributionPoint.SelectedValue = StockOut.FDistributionPoint;

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

                    BindDataGrid();
                }
                break;
            }
        }
Exemple #12
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);
        }
Exemple #13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool isSucceed = false;

            try
            {
                switch (Actions)
                {
                case WebAction.Add:
                    isSucceed = SubmintAdd();
                    break;

                case WebAction.Edit:
                    isSucceed = SubmintEdit();
                    break;
                }

                tmsModel t = new tmsModel();
                try
                {
                    IQueryable <LHDispatchCenter> center = DispatchCenterService.Where(p => p.KeyId == lblKeyId.Text);
                    if (center.Count() > 0)
                    {
                        t.dispatchCenterList = center.ToList();
                    }
                    IQueryable <LHStockOut> iP = new StockOutService().Where(p => p.FDispatchNum == lblKeyId.Text);
                    t.stockOutList        = iP.ToList <LHStockOut>();
                    t.stockOutDetailsList = new List <LHStockOutDetails>();
                    foreach (LHStockOut item in iP)
                    {
                        IQueryable <LHStockOutDetails> li = new StockOutDetailsService().Where(p => p.KeyId == item.KeyId);
                        foreach (LHStockOutDetails outDetails in li)
                        {
                            t.stockOutDetailsList.Add(outDetails);
                        }
                    }
                    IQueryable <LHPassCard> lHPasses = PassCardService.Where(p => p.FDispatchNum == lblKeyId.Text);
                    if (lHPasses != null)
                    {
                        t.passCardList = lHPasses.ToList();
                    }

                    t.passCardDetailsList = new List <LHPassCardDetails>();
                    foreach (LHPassCard item in t.passCardList)
                    {
                        IQueryable <LHPassCardDetails> cardDetails = new PassCardDetailsService().Where(p => p.KeyId == item.KeyId);
                        foreach (LHPassCardDetails details in cardDetails)
                        {
                            t.passCardDetailsList.Add(details);
                        }
                    }

                    IQueryable <LHStockIn> skin = new StockInService().Where(p => p.FDispatchNum == lblKeyId.Text);
                    if (skin != null && skin.Count() > 0)
                    {
                        t.stockInList        = skin.ToList();
                        t.stockInDetailsList = new List <LHStockInDetails>();
                        foreach (LHStockIn item in skin)
                        {
                            IQueryable <LHStockInDetails> inDetails = new StockInDetailsService().Where(p => p.KeyId == item.KeyId);
                            foreach (LHStockInDetails inDetail in inDetails)
                            {
                                t.stockInDetailsList.Add(inDetail);
                            }
                        }
                    }
                    new HttpRequest().httpRequest(t, "open/dbo/dboData");
                }
                catch (Exception)
                {
                }
            }
            catch (DbEntityValidationException ex)
            {
                string msg = string.Empty;
                List <ICollection <DbValidationError> > errors = (from u in ex.EntityValidationErrors select u.ValidationErrors).ToList();
                foreach (ICollection <DbValidationError> item in errors)
                {
                    msg += item.FirstOrDefault().ErrorMessage;
                }
                isSucceed = false;
            }
            finally
            {
                if (isSucceed)
                {
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else
                {
                    Alert.Show("提交失败!", MessageBoxIcon.Error);
                }
            }
        }
Exemple #14
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

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


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

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

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

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

                StockOutService.SaveChanges();

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

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

                return(true);
            }


            return(false);
        }
Exemple #15
0
        /// <summary>
        ///     Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //初始化控件数据
                InitData();

                //加载数据
                LoadData();
            }
            else
            {
                #region reloadGrid
                if (GetRequestEventArgument().Contains("reloadGrid:"))
                {
                    //查找所选商品代码,查访产品集合
                    string keys = GetRequestEventArgument().Split(':')[1];

                    var values = keys.Split(',');

                    string codes = String.Empty;
                    for (int i = 0; i < values.Count(); i++)
                    {
                        codes += string.Format("'{0}',", values[i]);
                    }

                    var value = codes.Substring(0, codes.Length - 1);

                    var data = SqlService.Where(string.Format("SELECT * FROM dbo.vm_SalesItem a WHERE a.FItemCode IN ({0}) and FCompanyId={1}", value, CurrentUser.AccountComId));

                    if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
                    {
                        var table = data.Tables[0];
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            var details = new LHLeaseDetails();

                            decimal price = GasHelper.GeCustomerPrice(txtFCode.Text, //
                                                                      table.Rows[i]["FItemCode"].ToString(), CurrentUser.AccountComId);

                            details.FBottle    = table.Rows[i]["FItemCode"].ToString();
                            details.FPrice     = price;
                            details.FBottleQty = 1;
                            details.FAmount    = price;
                            details.FBottleQty = 1;
                            //details.FBottleOweQty = 0;
                            details.FCompanyId = CurrentUser.AccountComId;
                            details.KeyId      = txtKeyId.Text.Trim();
                            details.FCateId    = Convert.ToInt32(table.Rows[i]["FId"].ToString());
                            //每天租赁费
                            details.FRentDay = 0;
                            //押金
                            details.FAmount = price;

                            //已归还量
                            details.FReturnQty = 0;

                            LeaseDetailsService.AddEntity(details);

                            //日志
                            switch (Actions)
                            {
                            case WebAction.Add:
                                break;

                            case WebAction.Edit:
                                //记录一下当前新增人操作内容
                                var detailslog = new LHLeaseDetails_Log
                                {
                                    FUpdateBy   = CurrentUser.AccountName,
                                    FUpdateDate = DateTime.Now,
                                    FBottle     = details.FBottle,
                                    FPrice      = price,
                                    FBottleQty  = 1,
                                    FAmount     = price,
                                    FCompanyId  = CurrentUser.AccountComId,
                                    KeyId       = txtKeyId.Text.Trim(),
                                    FStatus     = "新增",
                                };

                                LeaseDetailsLogService.Add(detailslog);

                                break;
                            }
                        }

                        LeaseDetailsService.SaveChanges();

                        //重新绑定值
                        BindDataGrid();
                    }
                }
                else if (GetRequestEventArgument().Contains("reloadSalesGrid:"))
                {
                    string key = GetRequestEventArgument().Split(':')[1];

                    tbxFSalesNum.Text = key;

                    var sales = new StockOutService().Where(p => p.KeyId == key && p.FCompanyId == CurrentUser.AccountComId
                                                            ).FirstOrDefault();
                    if (sales != null)
                    {
                        txtFCode.Text     = sales.FCode;
                        tbxFCustomer.Text = sales.FName;
                        txtFAddress.Text  = sales.FAddress;
                        txtFPhone.Text    = sales.FPhone;
                        txtFLinkman.Text  = sales.FLinkman;
                    }

                    var data = SqlService.Where(string.Format(@"SELECT * FROM dbo.vm_SalesDetails WHERE FCateId =2000 AND keyId='{0}' and FCompanyId={1}", tbxFSalesNum.Text, CurrentUser.AccountComId));

                    if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
                    {
                        var table = data.Tables[0];
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            var details = new LHLeaseDetails();

                            decimal price = GasHelper.GeCustomerPrice(txtFCode.Text, //
                                                                      table.Rows[i]["FBottleCode"].ToString(), CurrentUser.AccountComId);

                            details.FBottle    = table.Rows[i]["FBottleCode"].ToString();
                            details.FPrice     = price;
                            details.FAmount    = price;
                            details.FBottleQty = Convert.ToInt32(table.Rows[i]["FBottleQty"]);
                            details.FCompanyId = CurrentUser.AccountComId;
                            details.KeyId      = txtKeyId.Text.Trim();

                            //钢瓶
                            details.FCateId = Convert.ToInt32(table.Rows[i]["FCateId"].ToString());
                            //每天租赁费
                            details.FRentDay = 0;
                            //押金
                            details.FAmount = price;

                            //已归还量
                            details.FReturnQty = 0;

                            LeaseDetailsService.AddEntity(details);

                            //日志
                            switch (Actions)
                            {
                            case WebAction.Add:
                                break;

                            case WebAction.Edit:
                                //记录一下当前新增人操作内容
                                var detailslog = new LHLeaseDetails_Log
                                {
                                    FUpdateBy   = CurrentUser.AccountName,
                                    FUpdateDate = DateTime.Now,
                                    FBottle     = details.FBottle,
                                    FPrice      = price,
                                    FBottleQty  = 1,
                                    FAmount     = price,
                                    KeyId       = txtKeyId.Text.Trim(),
                                    FCompanyId  = CurrentUser.AccountComId,
                                    FStatus     = "新增",
                                };

                                LeaseDetailsLogService.Add(detailslog);

                                break;
                            }
                        }

                        LeaseDetailsService.SaveChanges();

                        //重新绑定值
                        BindDataGrid();
                    }
                }

                #endregion


                #region 更新合计

                //if (Grid1.Rows.Count > 0)
                //{
                //    if (GetRequestEventArgument() == "UPDATE_SUMMARY")
                //    {
                // 页面要求重新计算合计行的值
                OutputSummaryData();

                //写入
                ModifiedGrid();

                // 为了保持前后台上传,回发更新合计行值后,必须进行数据绑定或者提交更改
                Grid1.CommitChanges();
                //    }
                //}

                #endregion
            }
        }
Exemple #16
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (StockOut != null)
            {
                ModifiedGrid();
                /////////////////////////////////////////////////////////////////////////////

                StockOut.FCode = txtFCode.Text;
                StockOut.FName = tbxFCustomer.Text;
                //------------------------------------------------------
                StockOut.FAddress = txtFAddress.Text.Trim();
                //StockOut.FCompanyId = CurrentUser.AccountComId;

                StockOut.FDate = txtFDate.SelectedDate;

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

                StockOut.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                StockOut.FLinkman = txtFLinkman.Text.Trim();
                StockOut.FMemo    = txtFMemo.Text.Trim();
                StockOut.FPhone   = txtFPhone.Text.Trim();

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

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

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

                StockOut.FAmount = amt;

                StockOut.FSalesman        = ddlFSalesman.SelectedValue;
                StockOut.FArea            = ddlFArea.SelectedValue;
                StockOut.FAmt             = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim());//
                StockOut.FDiscountAmount  = string.IsNullOrEmpty(txtFDiscountAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDiscountAmount.Text.Trim());
                StockOut.FReconciliation  = txtFReconciliation.Text;
                StockOut.FDeliveryMethod  = ddlDeliveryMethod.SelectedValue;
                StockOut.FLogisticsNumber = txtFLogisticsNumber.Text;
                StockOut.FSupercargo      = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                StockOut.FDriver          = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
                StockOut.FSubjectCode     = ddlSubject.SelectedValue;
                StockOut.FSubjectName     = ddlSubject.SelectedText;

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

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

                SqlService.ExecuteProcedureCommand("proc_SalesReturnBottle", bottles);


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

                parmsAuto.Add("@KeyId", StockOut.KeyId);
                parmsAuto.Add("@companyId", CurrentUser.AccountComId);
                parmsAuto.Add("@FCate", "客户");
                parmsAuto.Add("@date", Convert.ToDateTime(StockOut.FDate).ToShortDateString());
                parmsAuto.Add("@FSKNum", string.IsNullOrEmpty(StockOut.FSKNum) ? "" : StockOut.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);
                }


                //---------------------------------------------------------
                //收发类型
                StockOut.FT6ReceiveSendType    = ddlT6ReceiveSendType.SelectedText;
                StockOut.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue;
                //部门名称
                StockOut.FT6Department = "";
                //部门代码
                StockOut.FT6DepartmentNum = "";
                //业务员代码
                StockOut.FT6SalesmanNum = "";
                //币种
                StockOut.FT6Currency = ddlFT6Currency.SelectedValue;
                //汇率
                StockOut.FT6ExchangeRate = Convert.ToDecimal(txtFT6ExchangeRate.Text);
                //销售类型
                StockOut.FT6SaleType    = ddlFT6SaleType.SelectedText;
                StockOut.FT6SaleTypeNum = ddlFT6SaleType.SelectedValue;
                //T6同步
                //StockOut.FT6Status = "未同步";

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

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

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

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

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

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


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

                stock.FAmount = amt;

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



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


                StockOutService.SaveChanges();

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

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


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

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

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

                return(true);
            }
            return(false);
        }
Exemple #18
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                Region1.Title = "添加采购退货单";
                var temp = new LHStockOut
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //采购退货
                    FType = Convert.ToInt32(GasEnumBill.PurchaseReturn),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),

                    FCate = "供应商"
                };

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

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

                Grid1.SummaryData = summary;

                break;

            case WebAction.Edit:
                txtKeyId.Text = KeyId;
                Region1.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;

                    ddlFT6PurchaseType.SelectedValue   = StockOut.FT6PurchaseTypeNum;
                    ddlFT6Currency.SelectedValue       = StockOut.FT6Currency;
                    ddlT6ReceiveSendType.SelectedValue = StockOut.FT6ReceiveSendTypeNum;
                    ddlWarehouse.SelectedValue         = StockOut.FT6Warehouse;

                    BindDataGrid();
                }


                break;
            }
        }
Exemple #19
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);
        }
Exemple #20
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                Region1.Title = "添加钢瓶出库单";
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHStockOut
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //空瓶出库单
                    FType = Convert.ToInt32(GasEnumBill.BottleTo),

                    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:
                Region1.Title = "编辑钢瓶出库单";
                txtKeyId.Text = KeyId;
                if (StockOut != null)
                {
                    txtFCode.Text     = StockOut.FCode;
                    tbxFCustomer.Text = StockOut.FName;

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

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

                    ddlFDriver.Text                     = StockOut.FDriver;
                    ddlFShipper.SelectedValue           = StockOut.FShipper;
                    ddlFSupercargo.Text                 = StockOut.FSupercargo;
                    ddlFVehicleNum.SelectedValue        = StockOut.FVehicleNum;
                    ddlDeliveryMethod.SelectedValue     = StockOut.FDeliveryMethod;
                    ddlFDistributionPoint.SelectedValue = StockOut.FDistributionPoint;

                    hfdCate.Text = StockOut.FCate;

                    BindDataGrid();
                }
                break;
            }
        }