Exemplo n.º 1
0
        private void CreateOrderInfo()
        {
            dpStartDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            GoodsOrder order = new GoodsOrder();

            order.Operator        = User.Identity.Name;
            order.OrderAmount     = 0;
            order.OrderDate       = DateTime.Now;
            order.OrderNO         = string.Format("JH{0}", DateTime.Now.ToString("yyyyMMddHHmmss"));
            order.OrderNumber     = 0;
            order.OrderPayType    = 1;
            order.OrderType       = 1;
            order.OriginalOrderNO = "";
            order.Remark          = "";
            order.SuplierID       = 0;
            order.WareHouseID     = 0;
            order.IsTemp          = 1;
            Core.Container.Instance.Resolve <IServiceGoodsOrder>().Create(order);

            OrderNO = order.OrderNO;

            //初始化页面数据
            lblOrderNo.Text = OrderNO;
        }
        private void CreationChart()
        {
            MemberChart.Clear();
            var         mgArray = new decimal[12];
            IGoodsOrder order   = new GoodsOrder(GlobalConfig.DB.FromType.Read);
            var         memberShopingChartList = order.GetQueryOrderByFinancial(Year, (OrderState)OrderState, PayMode, CountryId, ProvinceId, CityId, GlobalConfig.KeepYear, SaleFilialeID, SalePlatformID);

            if (memberShopingChartList.Count > 0)
            {
                decimal count = memberShopingChartList.Aggregate <KeyValuePair <int, decimal>, decimal>(0, (current, t) => current + t.Value);

                foreach (var keyValuePair in memberShopingChartList)
                {
                    mgArray[keyValuePair.Key - 1] = WebControl.CurrencyValue(keyValuePair.Value);
                }
                MemberChart.DataSource = mgArray;
                MemberChart.DataBind();
                MemberChart.ChartTitle.TextBlock.Text = "当前条件订单总金额" + WebControl.CurrencyValue(count) + ",详细如下:";
                //ChartSeries memberChart = MemberChart.Series.GetSeries(0);
                //ChartSeries nullChare = MemberChart.Series.GetSeries(1);
                //memberChart.Name = "订单发生额";
                //nullChare.Name = "";
            }
            else
            {
                MemberChart.ChartTitle.TextBlock.Text = "无发生数据";
            }
        }
Exemplo n.º 3
0
        protected override async void Run(Session session, C2G_AddGoodsOrder message, Action <G2C_AddGoodsOrder> reply)
        {
            G2C_AddGoodsOrder response = new G2C_AddGoodsOrder();

            try
            {
                DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                GoodsOrder GoodsOrder = ComponentFactory.Create <GoodsOrder>();
                GoodsOrder._InvAccountID = message.InvAccountID;
                GoodsOrder._GoodsID      = message.GoodsID;
                GoodsOrder._GoodsDataID  = message.GoodsDataID;
                GoodsOrder._Price        = message.Price;
                GoodsOrder._Intrduce     = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.Intrduce);
                GoodsOrder._PublicTime   = message.PublicTime;

                await dBProxyComponent.Save(GoodsOrder);

                await dBProxyComponent.SaveLog(GoodsOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
        private void CreationChart()
        {
            MemberChart.Clear();
            var         mgArray = new decimal[48];
            IGoodsOrder order   = new GoodsOrder(GlobalConfig.DB.FromType.Read);
            IList <KeyValuePair <int, int> > memberShopingChartList = order.GetOrderHalfHour(StartTime, OrderStates, SaleFilialeID, SalePlatformID);

            if (memberShopingChartList.Count > 0)
            {
                int count = 0;
                for (int i = 0; i < memberShopingChartList.Count; i++)
                {
                    count = count + memberShopingChartList[i].Key;
                }

                foreach (KeyValuePair <int, int> keyValuePair in memberShopingChartList)
                {
                    mgArray[keyValuePair.Value] = WebControl.CurrencyValue(keyValuePair.Key);
                }


                MemberChart.DataSource = mgArray;
                MemberChart.DataBind();

                MemberChart.ChartTitle.TextBlock.Text = StartTime.ToShortDateString() + "发生选择状态单总数为" + count + ",详细如下:";
            }
            else
            {
                MemberChart.ChartTitle.TextBlock.Text = "无发生数据";
            }
        }
Exemplo n.º 5
0
        protected void Grid1_PreRowDataBound(object sender, GridPreRowEventArgs e)
        {
            GoodsOrder      row           = e.DataItem as GoodsOrder;
            int             isTemp        = Convert.ToInt32(row.IsTemp);
            LinkButtonField lbtnEditField = Grid1.FindColumn("lbtnEditField") as LinkButtonField;
            LinkButtonField deleteField   = Grid1.FindColumn("deleteField") as LinkButtonField;

            lbtnEditField.Enabled = isTemp > 0;
            deleteField.Enabled   = isTemp > 0;
        }
Exemplo n.º 6
0
        public async Task <IActionResult> GoodsOrderCreate(GoodsOrderViewModel goodsorder)
        {
            var good       = _context.Goodss.Single(x => x.Id == goodsorder.goodid);
            var goodorders = new GoodsOrder {
                Goods = good, Name = goodsorder.Name, Number = goodsorder.Number, Remarks = goodsorder.Remarks, State = goodsorder.GoodState, GoodsId = good.Id, OrderStatus = true
            };

            _context.GoodsOrders.Add(goodorders);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 7
0
        private void GetOrderInfo()
        {
            GoodsOrder order = Core.Container.Instance.Resolve <IServiceGoodsOrder>().GetEntity(OrderID);

            OrderNO = order.OrderNO;

            //初始化页面数据
            dpStartDate.Text         = order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss");
            txtRemark.Text           = order.Remark;
            ddlSuplier.SelectedValue = order.SuplierID.ToString();
            ddlWH.SelectedValue      = order.WareHouseID.ToString();
            ddlPay.SelectedValue     = order.OrderPayType.ToString();
            lblOrderNo.Text          = OrderNO;
        }
Exemplo n.º 8
0
        protected override async void Run(Session session, C2G_QueryGoodsOrder message, Action <G2C_QueryGoodsOrder> reply)
        {
            G2C_QueryGoodsOrder response   = new G2C_QueryGoodsOrder();
            GoodsOrder          GoodsOrder = null;

            try
            {
                DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                var acounts = await dBProxyComponent.Query <GoodsOrder>("{ '_AccountID': " + message.AccountID + "}");

                if (acounts.Count <= 0)
                {
                    GoodsOrder Info = ComponentFactory.Create <GoodsOrder>();

                    Info._InvAccountID = message.AccountID;
                    Info._GoodsID      = 0;
                    Info._GoodsDataID  = 0;
                    Info._Price        = 0;
                    Info._Intrduce     = new List <string>();
                    Info._PublicTime   = "";


                    await dBProxyComponent.Save(Info);

                    await dBProxyComponent.SaveLog(Info);
                }
                else
                {
                    GoodsOrder = acounts[0] as GoodsOrder;

                    response.GoodsID     = GoodsOrder._GoodsID;
                    response.GoodsDataID = GoodsOrder._GoodsDataID;
                    response.Price       = GoodsOrder._Price;
                    response.Intrduce    = RepeatedFieldAndListChangeTool.ListToRepeatedField(GoodsOrder._Intrduce);
                    response.PublicTime  = GoodsOrder._PublicTime;
                }

                await dBProxyComponent.Save(GoodsOrder);

                await dBProxyComponent.SaveLog(GoodsOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Exemplo n.º 9
0
        protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
        {
            int ID = GetSelectedDataKeyID(Grid1);
            //获取当前选中记录信息
            GoodsOrder orderInfo = Core.Container.Instance.Resolve <IServiceGoodsOrder>().GetEntity(ID);

            if (e.CommandName == "Delete")
            {
                if (orderInfo != null)
                {
                    if (orderInfo.IsTemp == 1)
                    {
                        //删除临时订单商品信息
                        IList <ICriterion> qryList = new List <ICriterion>();
                        qryList.Add(Expression.Eq("OrderNO", orderInfo.OrderNO));
                        IList <GoodsOrderDetail> goodsList = Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().GetAllByKeys(qryList);
                        foreach (GoodsOrderDetail goods in goodsList)
                        {
                            Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().Delete(goods);
                        }
                        //删除临时订单信息
                        Core.Container.Instance.Resolve <IServiceGoodsOrder>().Delete(orderInfo);
                        BindGrid();
                    }
                    else
                    {
                        Alert.Show("正式订单不能删除!");
                    }
                }
            }
            if (e.CommandName == "editField")
            {
                if (orderInfo != null)
                {
                    if (orderInfo.IsTemp == 1)
                    {
                        PageContext.Redirect(string.Format("~/Inventory/GoodsOrderEdit.aspx?id={0}", ID));
                    }
                    else
                    {
                        Alert.Show("正式订单不能修改!");
                    }
                }
            }
            if (e.CommandName == "viewField")
            {
                PageContext.Redirect(string.Format("~/Inventory/GoodsOrderView.aspx?id={0}", ID));
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取订单信息
        /// </summary>
        private void GetOrderInfo()
        {
            GoodsOrder orderInfo = Core.Container.Instance.Resolve <IServiceGoodsOrder>().GetEntity(OrderID);

            lblAmount.Text           = orderInfo.OrderAmount.ToString();
            lblCount.Text            = orderInfo.OrderNumber.ToString();
            lblOrderNo.Text          = orderInfo.OrderNO;
            lblStartDate.Text        = orderInfo.OrderDate.ToString();
            ddlPay.SelectedValue     = orderInfo.OrderType.ToString();
            ddlSuplier.SelectedValue = orderInfo.SuplierID.ToString();
            ddlWH.SelectedValue      = orderInfo.WareHouseID.ToString();
            txtRemark.Text           = orderInfo.Remark;
            //绑定商品明细
            BindDetailGrid(orderInfo.OrderNO);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 按时间搜索所有订单
        /// </summary>
        /// <param name="starTime">起始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns></returns>
        public List <GoodsOrder> getALLGoodsOrder(DateTime starTime, DateTime endTime)
        {
            List <GoodsOrder> returnVal = new List <GoodsOrder>();

            string ConnString = ConfigurationManager.AppSettings["Sngoo"];
            //string inputPs, readPS;

            string        ConnQuery  = "  select * from yl_GoodsOrder where (PayTime between '" + starTime + "' and '" + endTime + "') and (OrderState=1 and ShoppingState=0 and PayState=2)  ";
            SqlConnection connection = new SqlConnection(ConnString);

            connection.Open();
            SqlCommand    lo_cmd = new SqlCommand(ConnQuery, connection);
            SqlDataReader reader = lo_cmd.ExecuteReader();

            while (reader.Read())
            {
                GoodsOrder item = new GoodsOrder();
                item.OrderNo       = reader["OrderNo"].ToString();
                item.PayTime       = Convert.ToDateTime(reader["PayTime"]);
                item.PickPointName = reader["PickPointName"].ToString();
                item.ReceiveTel    = reader["ReceiveTel"].ToString();
                item.RecevieName   = reader["RecevieName"].ToString();
                if (reader["CheckerCode"].ToString() == "1")
                {
                    item.AddvanceSub = 1;
                }
                else if (reader["CheckerCode"].ToString() == "0" || reader["CheckerCode"].ToString() == "")
                {
                    item.AddvanceSub = 0;
                }
                if (item.AddvanceSub == 0)
                {
                    returnVal.Add(item);
                }
            }



            reader.Close();
            connection.Close();
            connection.Dispose();

            //ConnString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=sngoo712;Data Source=(local)";
            return(returnVal);
        }
Exemplo n.º 12
0
        private void CreationChart()
        {
            MemberChart.Clear();
            IGoodsOrder goodsOrder = new GoodsOrder(GlobalConfig.DB.FromType.Read);
            IList <KeyValuePair <int, double> > memberShopingChartList = goodsOrder.GetOrderAmountRecord(ProvinceId, CityId, StartTime, Endtime, PayMode, OrderState, 1, ShowMode, GlobalConfig.KeepYear, SaleFilialeId, SalePlatformId);

            if (memberShopingChartList.Count > 0)
            {
                var count = memberShopingChartList.Aggregate(0, (current, t) => current + t.Key);
                MemberChart.DataSource = memberShopingChartList;
                MemberChart.ChartTitle.TextBlock.Text = StartTime.ToShortDateString() + "到" + Endtime.ToShortDateString() + "订单总数为" + count + ",详细如下:";
                MemberChart.DataBind();
            }
            else
            {
                MemberChart.ChartTitle.TextBlock.Text = "无发生数据";
            }
        }
Exemplo n.º 13
0
        public static bool IsEntityShopByOrderId(string orderId)
        {
            var oId = orderId.ToGuid();

            if (oId != Guid.Empty)
            {
                IGoodsOrder goodsOrder = new GoodsOrder(GlobalConfig.DB.FromType.Read);
                var         orderInfo  = goodsOrder.GetGoodsOrder(oId);
                if (orderInfo != null)
                {
                    var saleFilialeId = orderInfo.SaleFilialeId;
                    var filialeInfo   = CacheCollection.Filiale.GetList().FirstOrDefault(ent => ent.ID == saleFilialeId);
                    if (filialeInfo != null)
                    {
                        return(filialeInfo.FilialeTypes.Contains((int)FilialeType.EntityShop));
                    }
                }
            }
            return(false);
        }
Exemplo n.º 14
0
        protected override async void Run(Session session, C2G_UpdateGoodsOrder message, Action <G2C_UpdateGoodsOrder> reply)
        {
            G2C_UpdateGoodsOrder response   = new G2C_UpdateGoodsOrder();
            GoodsOrder           GoodsOrder = null;

            try
            {
                DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                var acounts = await dBProxyComponent.Query <GoodsOrder>("{ '_AccountID': " + message.InvAccountID + "}");

                if (acounts.Count <= 0)
                {
                    //修改的时候查询不到说明数据库有问题
                }
                else
                {
                    GoodsOrder = acounts[0] as GoodsOrder;

                    GoodsOrder._InvAccountID = message.InvAccountID;
                    GoodsOrder._GoodsID      = message.GoodsID;
                    GoodsOrder._GoodsDataID  = message.GoodsDataID;
                    GoodsOrder._Price        = message.Price;
                    GoodsOrder._Intrduce     = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.Intrduce);
                    GoodsOrder._PublicTime   = message.PublicTime;
                }

                await dBProxyComponent.Save(GoodsOrder);

                await dBProxyComponent.SaveLog(GoodsOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Exemplo n.º 15
0
        public void btnReturn_Click(object sender, EventArgs e)
        {
            IList <ICriterion> qryList = new List <ICriterion>();

            qryList.Add(Expression.Eq("OrderNO", OrderNO));
            //获取当前订单信息
            GoodsOrder orderInfo = Core.Container.Instance.Resolve <IServiceGoodsOrder>().GetEntityByFields(qryList);

            //删除临时订单商品信息
            if (orderInfo != null && orderInfo.IsTemp == 1)
            {
                IList <GoodsOrderDetail> goodsList = Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().GetAllByKeys(qryList);
                foreach (GoodsOrderDetail goods in goodsList)
                {
                    Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().Delete(goods);
                }
                //删除临时订单信息
                Core.Container.Instance.Resolve <IServiceGoodsOrder>().Delete(orderInfo);
            }
            //返回订单管理页面
            PageContext.Redirect("~/Inventory/GoodsOrderManage.aspx");
        }
Exemplo n.º 16
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            txtRemark.Focus();
            gridView1.UpdateCurrentRow();

            if (txtIncomeDepot.Text == "")
            {
                this.ShowAlertMessage("必须输入收货仓库!");
                return;
            }

            if (dtpGoodsOrderDate.Text == "")
            {
                this.ShowAlertMessage("必须输入开单日期!");
                return;
            }

            if (gridView1.RowCount <= 0)
            {
                this.ShowAlertMessage("必须增加明细数据!");
                return;
            }

            if (txtBatchNO.Text.Trim().Length != 8)
            {
                this.ShowAlertMessage("批号请输入8位日期型,例 yyyyMMdd[20110101]!");
                return;
            }
            else
            {
                string strDate = txtBatchNO.Text.Substring(0, 4) + "-" + txtBatchNO.Text.Substring(4, 2) + "-" + txtBatchNO.Text.Substring(6, 2);
                if (IsDate(strDate) != true)
                {
                    this.ShowAlertMessage("批号输入格式不对,应该为8位日期型,例 yyyyMMdd[20110101]!");
                    return;
                }
            }
            //if (bm.IsExistBillID(txtBillID.Text) == true && this.Tag.ToString() == "add")
            //{
            //    this.ShowAlertMessage("订单号已经存在,请重新输入!");
            //    return;
            //}


            GoodsOrder GoodsOrder = new GoodsOrder();

            GoodsOrder.GoodsOrderGuid = txtGoodsOrderGuid.Text;
            GoodsOrder.GoodsOrderID   = txtGoodsOrderID.Text;
            GoodsOrder.GoodsOrderDate = DateTime.Parse(dtpGoodsOrderDate.Text);
            if (txtIncomeDepot.Tag != null)
            {
                GoodsOrder.IncomeDepot = txtIncomeDepot.Tag.ToString();
            }
            if (txtPlant.Tag != null)
            {
                GoodsOrder.Plant = txtPlant.Tag.ToString();
            }
            if (txtQualityPerson.Tag != null)
            {
                GoodsOrder.QualityPerson = txtQualityPerson.Tag.ToString();
            }
            if (txtSatrapPerson.Tag != null)
            {
                GoodsOrder.SatrapPerson = txtSatrapPerson.Tag.ToString();
            }
            if (txtTransactorPerson.Tag != null)
            {
                GoodsOrder.TransactorPerson = txtTransactorPerson.Tag.ToString();
            }
            if (txtIncomeDepot.Tag != null)
            {
                GoodsOrder.IncomeDepot = txtIncomeDepot.Tag.ToString();
            }

            if (txtDepotPerson.Tag != null)
            {
                GoodsOrder.DepotPerson = txtDepotPerson.Tag.ToString();
            }

            GoodsOrder.BatchNo = txtBatchNO.Text;
            GoodsOrder.Remark  = txtRemark.Text;

            GoodsOrder.CreateGuid = txtCreateGuid.Tag.ToString();
            GoodsOrder.CreateDate = DateTime.Now;
            GoodsOrder.CheckGuid  = "";
            GoodsOrder.CheckDate  = DateTime.Parse("1900-01-01");



            List <GoodsOrderDetail> list             = new List <GoodsOrderDetail>();
            GoodsOrderDetail        GoodsOrderDetail = new GoodsOrderDetail();

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                DataRowView dr = (DataRowView)(gridView1.GetRow(i));

                GoodsOrderDetail = new GoodsOrderDetail();
                GoodsOrderDetail.GoodsOrderGuid = txtGoodsOrderGuid.Text;
                GoodsOrderDetail.MaterialGuID   = dr["MaterialGuID"].ToString();
                if (dr["MaterialSum"].ToString().Trim() != "")
                {
                    GoodsOrderDetail.MaterialSum = decimal.Parse(dr["MaterialSum"].ToString());
                }
                else
                {
                    GoodsOrderDetail.MaterialSum = 0;
                }
                GoodsOrderDetail.Determinant = dr["Determinant"].ToString();

                GoodsOrderDetail.SortID = i;
                list.Add(GoodsOrderDetail);
            }



            //保存
            GoodsOrderManage.SaveBill(GoodsOrder, list);

            tsbCheck.Enabled   = true;
            tsbUnCheck.Enabled = false;

            SetRight();


            //写日志
            SysLog.AddOperateLog(SysParams.UserName, "成品入库单保存", "保存", SysParams.UserName + "用户保存成品入库单,唯一号:" + txtGoodsOrderGuid.Text + ",成品入库单号:" + txtGoodsOrderID.Text);


            //用于打印
            DataTable dtl3 = base.GetDataTable((DataView)gridView1.DataSource);

            ds.Tables.Clear();
            ds.Tables.Add(dtl3.Copy());
            ds.Tables[0].TableName = "GoodsOrderDetail";

            this.Tag = "edit";
            this.ShowMessage("保存成功");

            frmGoodsOrder.frmgoodsorder.LoadData();
        }
        protected void Rad_invoce_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var                    dataItem  = e.Item as GridDataItem;
                var                    invoiceid = new Guid(dataItem.GetDataKeyValue("InvoiceId").ToString());
                IGoodsOrder            order     = new GoodsOrder(GlobalConfig.DB.FromType.Read);
                IList <GoodsOrderInfo> infos     = order.GetInvoiceGoodsOrderList(invoiceid);
                if (infos == null || infos.Count == 0)
                {
                    throw new NotImplementedException("invoiceid" + invoiceid + "--方法GetInvoiceGoodsOrderList(invoiceid)为空");
                }
                if ("delete" == e.CommandName)
                {
                    //ibll.SetInvoiceState(invoiceid, InvoiceState.Cancel, "该发票存在重复,因此取消该发票![" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    Invoice.WriteInstance.SetInvoiceState(invoiceid, InvoiceState.Cancel, CurrentSession.Personnel.Get().RealName);
                    sync.SyncSetInvoiceState(infos[0].SaleFilialeId, invoiceid, InvoiceState.Cancel, true, "该发票存在重复,因此取消该发票![" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]");
                }
                else if ("waste" == e.CommandName)
                {
                    //var success = ibll.SetInvoiceState(invoiceid, InvoiceState.Waste, "该发票财务确认作废.[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    var success = Invoice.WriteInstance.SetInvoiceState(invoiceid, InvoiceState.Waste, CurrentSession.Personnel.Get().RealName);
                    if (success)
                    {
                        var personnelInfo = CurrentSession.Personnel.Get();
                        //发票汇总允许作废操作记录添加
                        var invoiceInfo = Invoice.WriteInstance.GetInvoice(invoiceid);
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceid, invoiceInfo == null ? "" : invoiceInfo.InvoiceNo.ToMendString(8),
                                                   OperationPoint.InvoiceStatistics.AllowScrap.GetBusinessInfo(), string.Empty);

                        sync.SyncSetInvoiceState(infos[0].SaleFilialeId, invoiceid, InvoiceState.Waste, true,
                                                 "该发票财务确认作废.[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]");
                    }
                    else
                    {
                        RAM.Alert("发票拒绝作废,有可能发票已经报送税务!");
                    }
                }
                else if ("return" == e.CommandName)
                {
                    //ibll.SetInvoiceState(invoiceid, InvoiceState.Success, "该发票财务拒绝作废.状态返回已开[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    Invoice.WriteInstance.UpdateSetInvoiceState(invoiceid, InvoiceState.Success, CurrentSession.Personnel.Get().RealName);

                    var invoiceInfo   = Invoice.WriteInstance.GetInvoice(invoiceid);
                    var personnelInfo = CurrentSession.Personnel.Get();
                    //发票汇总财务拒绝作废操作记录添加
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceid, invoiceInfo == null ? "" : invoiceInfo.InvoiceNo.ToMendString(8),
                                               OperationPoint.InvoiceStatistics.RefuseScrap.GetBusinessInfo(), string.Empty);
                }
                rad_invoce.Rebind();
            }
            if (e.CommandName == "Search")
            {
                if (RcbKindType.SelectedValue == string.Format("{0}", (Byte)InvoiceKindType.Electron))
                {
                    RAM.Alert("此功能只适用于纸质发票!");
                }
                else
                {
                    AnomalyInvoce();
                    rad_invoce.Rebind();
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add_Order(GoodsOrder model)
        {
            if (model == null ||
                !model.GoodsId.IsNotNullOrEmpty() ||
                model.Count == 0
                )
            {
                return("数据错误");
            }
            var user   = CookieHelper.GetCurrentWxUser();
            var person = CookieHelper.GetCurrentPeople();

            if (user == null || person == null)
            {
                return("身份验证过期");
            }
            using (DbRepository entities = new DbRepository())
            {
                var userEntity = entities.User.Find(user.openid);
                if (userEntity == null)
                {
                    return("用户不存在");
                }

                var goods = entities.Goods.Find(model.GoodsId);
                if (goods == null)
                {
                    return("数据错误");
                }

                if (goods.OngoingTime > DateTime.Now)
                {
                    return("还没到活动时间");
                }
                if (goods.OverTime < DateTime.Now)
                {
                    return("已过活动时间");
                }

                if (goods.SurplusNum < model.Count)
                {
                    return("商品库存不足");
                }

                //商品库存减少
                goods.SurplusNum -= (int)model.Count;
                //积分总计
                model.ScoreNum = model.Count * goods.ScoreNum;

                var userScore = entities.UserScore.FirstOrDefault(x => x.OpenId.Equals(user.openid) && x.PersonId.Equals(person.UNID));
                if (userScore == null || userScore.Score < model.ScoreNum)
                {
                    return("用户积分不足");
                }

                //扣减用户积分
                userScore.Score -= (int)model.ScoreNum;

                //消费积分
                var scoreDetials = new ScoreDetails()
                {
                    UNID        = Guid.NewGuid().ToString("N"),
                    OpenId      = user.openid,
                    CreatedTime = DateTime.Now,
                    Description = string.Format("购买商品:{0},数量{1},消费积分{2}", goods.Name, model.Count, model.Count * goods.ScoreNum),
                    IsAdd       = (int)YesOrNoCode.No,
                    Value       = (int)(model.Count * goods.ScoreNum),
                    Type        = (int)ScoreType.Mall,
                    PersonId    = person.UNID
                };
                entities.ScoreDetails.Add(scoreDetials);


                model.UNID        = Guid.NewGuid().ToString("N");
                model.OpenId      = user.openid;
                model.PersonId    = person.UNID;
                model.AllPrice    = model.Count * goods.SellingPrice;
                model.CreatedTime = DateTime.Now;

                entities.GoodsOrder.Add(model);

                return(entities.SaveChanges() > 0 ? "" : "保存出错");
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="model"</param>
        /// <returns></returns>
        public JsonResult Add(GoodsOrder model)
        {
            var result = IMallOrderService.Add_Order(model);

            return(JResult(result));
        }
Exemplo n.º 20
0
        private void SaveItem(int isTemp)
        {
            bool IsStock = bool.Parse(ConfigurationManager.AppSettings["IsStock"]);
            //更新订单状态为正式订单
            IList <ICriterion> qryList = new List <ICriterion>();

            qryList.Add(Expression.Eq("OrderNO", OrderNO));
            GoodsOrder orderInfo = Core.Container.Instance.Resolve <IServiceGoodsOrder>().GetEntityByFields(qryList);

            orderInfo.OrderDate    = DateTime.Parse(dpStartDate.Text);
            orderInfo.IsTemp       = isTemp;
            orderInfo.OrderAmount  = decimal.Parse(lblAmount.Text);
            orderInfo.OrderNumber  = decimal.Parse(lblCount.Text);
            orderInfo.SuplierID    = int.Parse(ddlSuplier.SelectedValue);
            orderInfo.WareHouseID  = int.Parse(ddlWH.SelectedValue);
            orderInfo.OrderPayType = int.Parse(ddlPay.SelectedValue);
            orderInfo.Remark       = txtRemark.Text;
            orderInfo.Operator     = User.Identity.Name;
            Core.Container.Instance.Resolve <IServiceGoodsOrder>().Update(orderInfo);

            //正式订单,更新入库信息及流水信息等
            if (isTemp == 0)
            {
                //获取进货商品明细
                IList <ICriterion> qryListDetail = new List <ICriterion>();
                qryListDetail.Add(Expression.Eq("OrderNO", OrderNO));
                Order[] orderList = new Order[1];
                Order   orderli   = new Order("ID", true);
                orderList[0] = orderli;
                IList <GoodsOrderDetail> list = Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().GetAllByKeys(qryList, orderList);

                #region  入库单信息
                if (IsStock)
                {
                    // 入库单信息
                    WHStorageOrder storageOrder = new WHStorageOrder();
                    storageOrder.BOrderNO    = OrderNO;
                    storageOrder.Operator    = User.Identity.Name;
                    storageOrder.OrderAmount = orderInfo.OrderAmount;
                    storageOrder.OrderNumber = orderInfo.OrderNumber;
                    storageOrder.OrderDate   = orderInfo.OrderDate;
                    storageOrder.OrderNO     = string.Format("RK{0}", DateTime.Parse(dpStartDate.Text).ToString("yyyyMMddHHmmss"));
                    storageOrder.OrderType   = 1;
                    storageOrder.OutOrderNO  = "";
                    storageOrder.Remark      = "进货入库";
                    storageOrder.SuplierID   = orderInfo.SuplierID;
                    storageOrder.WareHouseID = orderInfo.WareHouseID;
                    Core.Container.Instance.Resolve <IServiceWHStorageOrder>().Create(storageOrder);

                    //写入入库商品明细
                    foreach (GoodsOrderDetail detail in list)
                    {
                        WHOrderGoodsDetail orderDetail = new WHOrderGoodsDetail();
                        orderDetail.GoodsID         = detail.GoodsID;
                        orderDetail.GoodsNumber     = detail.GoodsNumber;
                        orderDetail.GoodsUnit       = detail.GoodsUnit;
                        orderDetail.GoodsUnitPrice  = detail.GoodsUnitPrice;
                        orderDetail.GoodTotalPrice  = detail.GoodTotalPrice;
                        orderDetail.OrderDate       = storageOrder.OrderDate;
                        orderDetail.OrderNO         = storageOrder.OrderNO;
                        orderDetail.TaxAmount       = detail.TaxAmount;
                        orderDetail.TaxPoint        = detail.TaxPoint;
                        orderDetail.TotalPriceNoTax = detail.TotalPriceNoTax;
                        orderDetail.UnitPriceNoTax  = detail.UnitPriceNoTax;
                        Core.Container.Instance.Resolve <IServiceWHOrderGoodsDetail>().Create(orderDetail);
                    }
                }
                #endregion  入库单信息

                #region 更新商品库存以及流水信息
                //写入入库商品明细
                foreach (GoodsOrderDetail detail in list)
                {
                    //更新商品库存信息
                    new InventoryHelper().UpdateWareHouseStock(orderInfo.WareHouseID, detail.GoodsID, detail.GoodsNumber
                                                               , detail.GoodsUnitPrice, detail.GoodTotalPrice, 1);

                    //更新商品变动明细信息(入库)
                    new InventoryHelper().UpdateGoodsJournal(orderInfo.WareHouseID, detail.GoodsID, OrderNO, "JH", 1
                                                             , detail.GoodsNumber, detail.GoodsUnitPrice, detail.GoodTotalPrice
                                                             , "", orderInfo.OrderDate);
                }

                #endregion 更新商品库存以及流水信息
            }
        }
Exemplo n.º 21
0
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            if (m_ActualPayMoney > m_PaidInAmount)
            {
                // 支付的金额不足
                MessageBox.Show("支付的金额不足,请确认后重新付款!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (m_PaidInAmount > m_ActualPayMoney)
            {
                decimal            cash = 0, noCash = 0;
                List <OrderPayoff> noCashPayoff = new List <OrderPayoff>();
                foreach (KeyValuePair <string, OrderPayoff> item in dic)
                {
                    if (item.Value.PayoffType == (int)PayoffWayMode.Cash)
                    {
                        cash += item.Value.AsPay * item.Value.Quantity;
                    }
                    else
                    {
                        noCash += item.Value.AsPay * item.Value.Quantity;
                        noCashPayoff.Add(item.Value);
                    }
                }
                if (noCash > m_ActualPayMoney)
                {
                    //非现金支付方式按单位价值从高到低排序
                    OrderPayoff[] noCashPayoffArr = noCashPayoff.ToArray();
                    for (int j = 0; j < noCashPayoffArr.Length; j++)
                    {
                        for (int i = noCashPayoffArr.Length - 1; i > j; i--)
                        {
                            if (noCashPayoffArr[j].AsPay < noCashPayoffArr[i].AsPay)
                            {
                                OrderPayoff temp = noCashPayoffArr[j];
                                noCashPayoffArr[j] = noCashPayoffArr[i];
                                noCashPayoffArr[i] = temp;
                            }
                        }
                    }
                    if (noCash - noCashPayoffArr[noCashPayoffArr.Length - 1].AsPay < m_ActualPayMoney)
                    {
                        if (cash > 0)
                        {
                            MessageBox.Show("现金支付方式多余!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("非现金支付方式金额过多,请重新支付!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    //由全部非现金及部分现金来支付
                    decimal changePay = m_PaidInAmount - m_ActualPayMoney;
                    foreach (KeyValuePair <string, OrderPayoff> item in dic)
                    {
                        if (item.Value.PayoffType == (int)PayoffWayMode.Cash)
                        {
                            item.Value.NeedChangePay = changePay;
                            break;
                        }
                    }
                }
            }
            //计算支付的金额并填充OrderPayoff
            bool               isContainsCash    = false;
            bool               isContainsVipCard = false;
            decimal            paymentMoney      = 0;
            decimal            needChangePay     = 0;
            List <OrderPayoff> orderPayoffList   = new List <OrderPayoff>();

            foreach (KeyValuePair <string, OrderPayoff> item in dic)
            {
                if (item.Value.Quantity > 0)
                {
                    if (item.Value.PayoffType == (int)PayoffWayMode.Cash)
                    {
                        isContainsCash = true;
                    }
                    if (item.Value.PayoffType == (int)PayoffWayMode.MembershipCard)
                    {
                        isContainsVipCard = true;
                    }
                    OrderPayoff orderPayoff = item.Value;
                    paymentMoney  += orderPayoff.AsPay * orderPayoff.Quantity;
                    needChangePay += orderPayoff.NeedChangePay;
                    orderPayoffList.Add(orderPayoff);
                }
            }
            if (isContainsCash)
            {
                //支付方式中包含现金,需要打开钱箱
                OpenCashBox();
            }
            bool paySuccess = false;

            if (isContainsVipCard)
            {
                Dictionary <string, VIPCardPayment> dicCardPayment;
                Dictionary <string, string>         dicCardTradePayNo;
                if (IsVipCardPaySuccess(out dicCardPayment, out dicCardTradePayNo))
                {
                    //组合交易流水号,因为需要支持多张会员卡
                    string strTradePayNo = string.Empty;
                    foreach (KeyValuePair <string, string> item in dicCardTradePayNo)
                    {
                        strTradePayNo += "," + item.Value;
                    }
                    strTradePayNo = strTradePayNo.Substring(1);
                    //将支付方式中的卡号密码去掉
                    foreach (var orderPayoff in orderPayoffList)
                    {
                        if (orderPayoff.PayoffType == (int)PayoffWayMode.MembershipCard)
                        {
                            if (!string.IsNullOrEmpty(orderPayoff.CardNo))
                            {
                                orderPayoff.CardNo = orderPayoff.CardNo.Split('#')[0];
                            }
                        }
                    }
                    // 支付服务尝试三次
                    int times = 0;
                    while (times < 3 && !paySuccess)
                    {
                        paySuccess = PayForOrder(orderPayoffList, paymentMoney, needChangePay, strTradePayNo);
                        times++;
                        Thread.Sleep(500);
                    }
                    if (!paySuccess)
                    {
                        //取消会员卡支付
                        foreach (KeyValuePair <string, VIPCardPayment> item in dicCardPayment)
                        {
                            string cardNo = item.Value.CardNo;
                            //将支付成功的会员卡取消支付
                            int returnValue = VIPCardTradeService.GetInstance().RefundVipCardPayment(cardNo, item.Value.CardPassword, dicCardTradePayNo[cardNo]);
                            if (returnValue == 1)
                            {
                                continue;
                            }
                            if (returnValue == 2)
                            {
                                MessageBox.Show(string.Format("交易流水号'{0}'不存在或者已作废", dicCardTradePayNo[cardNo]), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else if (returnValue == 99)
                            {
                                MessageBox.Show(string.Format("'{0}'的会员卡号或者密码错误!", cardNo), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                MessageBox.Show("服务器出现错误,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            //保存到本地Sqlite
                            CardRefundPay cardRefundPay = new CardRefundPay();
                            cardRefundPay.CardNo     = cardNo;
                            cardRefundPay.ShopID     = ConstantValuePool.CurrentShop.ShopID.ToString();
                            cardRefundPay.TradePayNo = dicCardTradePayNo[cardNo];
                            cardRefundPay.PayAmount  = item.Value.PayAmount;
                            cardRefundPay.EmployeeNo = item.Value.EmployeeNo;
                            cardRefundPay.DeviceNo   = item.Value.DeviceNo;
                            CardRefundPayService refundPayService = new CardRefundPayService();
                            refundPayService.AddRefundPayInfo(cardRefundPay);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("会员卡支付操作失败,请稍后再试!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                paySuccess = PayForOrder(orderPayoffList, paymentMoney, needChangePay, string.Empty);
            }
            if (paySuccess)
            {
                //打印小票
                PrintData printData = new PrintData();
                printData.ShopName        = ConstantValuePool.CurrentShop.ShopName;
                printData.DeskName        = m_SalesOrder.order.DeskName;
                printData.PersonNum       = m_SalesOrder.order.PeopleNum.ToString();
                printData.PrintTime       = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                printData.EmployeeNo      = ConstantValuePool.CurrentEmployee.EmployeeNo;
                printData.TranSequence    = m_SalesOrder.order.TranSequence.ToString();
                printData.ShopAddress     = ConstantValuePool.CurrentShop.RunAddress;
                printData.Telephone       = ConstantValuePool.CurrentShop.Telephone;
                printData.ReceivableMoney = m_ActualPayMoney.ToString("f2");
                printData.ServiceFee      = "0.00";
                printData.PaidInMoney     = paymentMoney.ToString("f2");
                printData.NeedChangePay   = needChangePay.ToString("f2");
                printData.GoodsOrderList  = new List <GoodsOrder>();
                printData.PayingOrderList = new List <PayingGoodsOrder>();
                foreach (OrderDetails item in m_SalesOrder.orderDetailsList)
                {
                    string strLevelFlag = string.Empty;
                    int    levelCount   = item.ItemLevel * 2;
                    for (int i = 0; i < levelCount; i++)
                    {
                        strLevelFlag += "-";
                    }
                    GoodsOrder goodsOrder = new GoodsOrder();
                    goodsOrder.GoodsName      = strLevelFlag + item.GoodsName;
                    goodsOrder.GoodsNum       = item.ItemQty.ToString("f1");
                    goodsOrder.SellPrice      = item.SellPrice.ToString("f2");
                    goodsOrder.TotalSellPrice = item.TotalSellPrice.ToString("f2");
                    goodsOrder.TotalDiscount  = item.TotalDiscount.ToString("f2");
                    goodsOrder.Unit           = item.Unit;
                    printData.GoodsOrderList.Add(goodsOrder);
                }
                foreach (OrderPayoff orderPayoff in orderPayoffList)
                {
                    PayingGoodsOrder payingOrder = new PayingGoodsOrder();
                    payingOrder.PayoffName    = orderPayoff.PayoffName;
                    payingOrder.PayoffMoney   = (orderPayoff.AsPay * orderPayoff.Quantity).ToString("f2");
                    payingOrder.NeedChangePay = orderPayoff.NeedChangePay.ToString("f2");
                    printData.PayingOrderList.Add(payingOrder);
                }
                string paperWidth = ConstantValuePool.BizSettingConfig.printConfig.PaperWidth;
                if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.DRIVER)
                {
                    string           printerName = ConstantValuePool.BizSettingConfig.printConfig.Name;
                    string           paperName   = ConstantValuePool.BizSettingConfig.printConfig.PaperName;
                    DriverOrderPrint printer     = DriverOrderPrint.GetInstance(printerName, paperName, paperWidth);
                    printer.DoPrintPaidOrder(printData);
                }
                if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.COM)
                {
                    string port = ConstantValuePool.BizSettingConfig.printConfig.Name;
                    if (port.Length > 3)
                    {
                        if (port.Substring(0, 3).ToUpper() == "COM")
                        {
                            string portName = port.Substring(0, 4).ToUpper();
                            InstructionOrderPrint printer = new InstructionOrderPrint(portName, 9600, Parity.None, 8, StopBits.One, paperWidth);
                            printer.DoPrintPaidOrder(printData);
                        }
                    }
                }
                if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.ETHERNET)
                {
                    string ipAddress = ConstantValuePool.BizSettingConfig.printConfig.Name;
                    InstructionOrderPrint printer = new InstructionOrderPrint(ipAddress, 9100, paperWidth);
                    printer.DoPrintPaidOrder(printData);
                }
                if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.USB)
                {
                    string vid                    = ConstantValuePool.BizSettingConfig.printConfig.VID;
                    string pid                    = ConstantValuePool.BizSettingConfig.printConfig.PID;
                    string endpointId             = ConstantValuePool.BizSettingConfig.printConfig.EndpointID;
                    InstructionOrderPrint printer = new InstructionOrderPrint(vid, pid, endpointId, paperWidth);
                    printer.DoPrintPaidOrder(printData);
                }
                //判断单据类型,如果是外带并且是直接出货
                if (m_SalesOrder.order.EatType == (int)EatWayType.Takeout && ConstantValuePool.BizSettingConfig.DirectShipping)
                {
                    CustomerOrder customerOrder = new CustomerOrder
                    {
                        OrderID            = m_SalesOrder.order.OrderID,
                        DeliveryEmployeeNo = string.Empty
                    };
                    CustomersService.GetInstance().UpdateTakeoutOrderStatus(customerOrder);
                }
                m_IsPaidOrder = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("账单支付失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 22
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentRow != null && _salesOrder != null && _salesOrder.order != null)
     {
         if (_salesOrder.order.Status == 1)
         {
             int selectedIndex = dataGridView1.CurrentRow.Index;
             if (dataGridView1.Rows[selectedIndex].Cells["OrderID"].Value != null)
             {
                 Order order = _salesOrder.order;
                 //打印小票
                 PrintData printData = new PrintData();
                 printData.ShopName        = ConstantValuePool.CurrentShop.ShopName;
                 printData.DeskName        = order.DeskName;
                 printData.PersonNum       = order.PeopleNum.ToString();
                 printData.PrintTime       = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                 printData.EmployeeNo      = order.EmployeeNo;
                 printData.TranSequence    = order.TranSequence.ToString();
                 printData.ShopAddress     = ConstantValuePool.CurrentShop.RunAddress;
                 printData.Telephone       = ConstantValuePool.CurrentShop.Telephone;
                 printData.ReceivableMoney = order.ActualSellPrice.ToString("f2");
                 printData.ServiceFee      = order.ServiceFee.ToString("f2");
                 printData.PaidInMoney     = order.PaymentMoney.ToString("f2");
                 printData.NeedChangePay   = order.NeedChangePay.ToString("f2");
                 printData.GoodsOrderList  = new List <GoodsOrder>();
                 printData.PayingOrderList = new List <PayingGoodsOrder>();
                 foreach (OrderDetails item in _salesOrder.orderDetailsList)
                 {
                     string strLevelFlag = string.Empty;
                     int    levelCount   = item.ItemLevel * 2;
                     for (int i = 0; i < levelCount; i++)
                     {
                         strLevelFlag += "-";
                     }
                     GoodsOrder goodsOrder = new GoodsOrder();
                     goodsOrder.GoodsName      = strLevelFlag + item.GoodsName;
                     goodsOrder.GoodsNum       = item.ItemQty.ToString("f1");
                     goodsOrder.SellPrice      = item.SellPrice.ToString("f2");
                     goodsOrder.TotalSellPrice = item.TotalSellPrice.ToString("f2");
                     goodsOrder.TotalDiscount  = item.TotalDiscount.ToString("f2");
                     goodsOrder.Unit           = item.Unit;
                     printData.GoodsOrderList.Add(goodsOrder);
                 }
                 foreach (OrderPayoff orderPayoff in _salesOrder.orderPayoffList)
                 {
                     PayingGoodsOrder payingOrder = new PayingGoodsOrder();
                     payingOrder.PayoffName    = orderPayoff.PayoffName;
                     payingOrder.PayoffMoney   = (orderPayoff.AsPay * orderPayoff.Quantity).ToString("f2");
                     payingOrder.NeedChangePay = orderPayoff.NeedChangePay.ToString("f2");
                     printData.PayingOrderList.Add(payingOrder);
                 }
                 string paperWidth = ConstantValuePool.BizSettingConfig.printConfig.PaperWidth;
                 if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.DRIVER)
                 {
                     string           printerName = ConstantValuePool.BizSettingConfig.printConfig.Name;
                     string           paperName   = ConstantValuePool.BizSettingConfig.printConfig.PaperName;
                     DriverOrderPrint printer     = DriverOrderPrint.GetInstance(printerName, paperName, paperWidth);
                     printer.DoPrintPaidOrder(printData);
                 }
                 if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.COM)
                 {
                     string port = ConstantValuePool.BizSettingConfig.printConfig.Name;
                     if (port.Length > 3)
                     {
                         if (port.Substring(0, 3).ToUpper() == "COM")
                         {
                             string portName = port.Substring(0, 4).ToUpper();
                             InstructionOrderPrint printer = new InstructionOrderPrint(portName, 9600, Parity.None, 8, StopBits.One, paperWidth);
                             printer.DoPrintPaidOrder(printData);
                         }
                     }
                 }
                 if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.ETHERNET)
                 {
                     string ipAddress = ConstantValuePool.BizSettingConfig.printConfig.Name;
                     InstructionOrderPrint printer = new InstructionOrderPrint(ipAddress, 9100, paperWidth);
                     printer.DoPrintPaidOrder(printData);
                 }
                 if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.USB)
                 {
                     string vid                    = ConstantValuePool.BizSettingConfig.printConfig.VID;
                     string pid                    = ConstantValuePool.BizSettingConfig.printConfig.PID;
                     string endpointId             = ConstantValuePool.BizSettingConfig.printConfig.EndpointID;
                     InstructionOrderPrint printer = new InstructionOrderPrint(vid, pid, endpointId, paperWidth);
                     printer.DoPrintPaidOrder(printData);
                 }
             }
         }
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// 根据预分装号获取的订单列表获取每条订单的详细信息列表
        /// </summary>
        /// <param name="list"> 订单列表</param>
        /// <returns></returns>
        public List <GoodsOrder> getGoodsOrderListByAddvanceId(List <string> list)
        {
            List <GoodsOrder> returnVal = new List <GoodsOrder>();

            string ConnString = ConfigurationManager.AppSettings["Sngoo"];
            //string inputPs, readPS;


            SqlConnection connection = new SqlConnection(ConnString);

            connection.Open();
            for (int i = 0; i < list.Count; i++)
            {
                string     ConnQuery = "  select * from yl_GoodsOrder where OrderNo= '" + list[i].ToString() + "'";
                SqlCommand lo_cmd    = new SqlCommand(ConnQuery, connection);

                SqlDataReader reader = lo_cmd.ExecuteReader();
                reader.Read();
                GoodsOrder item = new GoodsOrder();
                item.OrderNo       = reader["OrderNo"].ToString();
                item.PayTime       = Convert.ToDateTime(reader["PayTime"]);
                item.PickPointName = reader["PickPointName"].ToString();
                item.ReceiveTel    = reader["ReceiveTel"].ToString();
                item.RecevieName   = reader["RecevieName"].ToString();
                if (reader["CheckerCode"].ToString() != "0" || reader["CheckerCode"].ToString() == "")
                {
                    item.AddvanceSub = 1;
                }
                else
                {
                    item.AddvanceSub = 0;
                }
                if (reader["PickCode"].ToString() == "")
                {
                    item.PickCode = "";
                }
                else
                {
                    item.PickCode = reader["PickCode"].ToString();
                }

                if (reader["RecoCode"].ToString() == "")
                {
                    item.RecoCode = "";
                }
                else
                {
                    item.RecoCode = reader["RecoCode"].ToString();
                }
                if (reader["ShoppingNo"].ToString() == "")
                {
                    item.ShoppingNo = "";
                }
                else
                {
                    item.ShoppingNo = reader["ShoppingNo"].ToString();
                }



                returnVal.Add(item);

                reader.Close();
                lo_cmd.Dispose();
            }



            connection.Close();
            connection.Dispose();

            //ConnString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=sngoo712;Data Source=(local)";
            return(returnVal);
        }
Exemplo n.º 24
0
        //批量删除
        protected void btn_Del_Click(object sender, EventArgs e)
        {
            if (Request["ckId"] != null)
            {
                IGoodsOrder       goodsOrder        = new GoodsOrder(GlobalConfig.DB.FromType.Read);
                var               purchasingManager = new PurchasingManager(new Purchasing(GlobalConfig.DB.FromType.Read), _goodsCenterSao, null, null, null);
                IStorageRecordDao storageRecordDao  = new StorageRecordDao(GlobalConfig.DB.FromType.Read);

                var        errorMsg    = new StringBuilder();
                var        goodsIdList = new List <Guid>();
                var        goodsIdsAndGoodsNamesAndGoodsAuditState = Request["ckId"].Split(',');
                List <int> stockStates = new List <int>
                {
                    (int)StorageRecordState.WaitAudit,
                    (int)StorageRecordState.Refuse,
                    (int)StorageRecordState.Refuse,
                    (int)StorageRecordState.Approved,
                    (int)StorageRecordState.Finished
                };
                foreach (var item in goodsIdsAndGoodsNamesAndGoodsAuditState)
                {
                    var    goodsId   = new Guid(item.Split('&')[0]);
                    string goodsName = item.Split('&')[1];
                    if (goodsOrder.SelectSemiStockAtOneYearByGoodsId(goodsId, null, null, 365, stockStates))
                    {
                        errorMsg.Append("“").Append(goodsName).Append("”该商品1年内有进行过出入库记录,不允许删除!").Append("\\n");
                        continue;
                    }
                    if (purchasingManager.SelectPurchasingNoCompleteByGoodsId(goodsId, null))
                    {
                        errorMsg.Append("“").Append(goodsName).Append("”该商品存在未完成的采购单,不允许删除!").Append("\\n");
                        continue;
                    }
                    if (storageRecordDao.IsExistNormalStorageRecord(goodsId, null))
                    {
                        errorMsg.Append("“").Append(goodsName).Append("”该商品存在未审核的出入库单据,不允许删除!").Append("\\n");
                        continue;
                    }
                    if (CacheCollection.Filiale.GetHeadList().Where(f => f.FilialeTypes.Contains((int)FilialeType.EntityShop)).Any(source => StockSao.IsExistGoodsStock(source.ID, goodsId, new List <Guid>())))
                    {
                        errorMsg.Append("“").Append(goodsName).Append("”此商品门店有库存,不允许删除!").Append("\\n");
                        continue;
                    }

                    goodsIdList.Add(goodsId);
                }
                if (!string.IsNullOrEmpty(errorMsg.ToString()))
                {
                    MessageBox.Show(this, errorMsg.ToString());
                }
                else
                {
                    //删除主商品
                    string errorMessage;
                    var    personnel = CurrentSession.Personnel.Get();
                    var    isSuccess = _goodManager.DeleteGoods(goodsIdList, personnel.RealName, personnel.PersonnelId, out errorMessage);
                    if (isSuccess)
                    {
                        MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                        MessageBox.Show(this, "主商品删除成功!");
                    }
                    else
                    {
                        MessageBox.Show(this, "主商品删除失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "请选择相关数据!");
            }
        }
Exemplo n.º 25
0
        public IActionResult newGoodsOrder(GoodsOrder order)
        {
            DBHelper dbHelper = new DBHelper();

            try
            {
                // 检查顾客是否为VIP
                VIP check = VipController.checkVip(order.customerId);

                // 添加订单
                string insert = "INSERT INTO GOODS_ORDER VALUES(:id,:customerId,:sellerId,:goodsName,:price,:payTime,:goodsId)";

                // 返回信息(购买件数以及积分增加)
                long   res   = order.number;
                double point = 0;
                order.price *= (check == null ? 1 : check.discount);
                for (long i = 0; i < order.number; i++)
                {
                    OracleParameter[] parametersForInsert =
                    {
                        new OracleParameter(":id",         OracleDbType.Varchar2, 50),
                        new OracleParameter(":customerId", OracleDbType.Long,     10),
                        new OracleParameter(":sellerId",   OracleDbType.Long,     10),
                        new OracleParameter(":goodsName",  OracleDbType.Varchar2, 50),
                        new OracleParameter(":price",      OracleDbType.Double),
                        new OracleParameter(":payTime",    OracleDbType.Varchar2, 50),
                        new OracleParameter(":goodsId",    OracleDbType.Long, 10)
                    };
                    parametersForInsert[0].Value = dbHelper.ExecuteMax("GOODS_ORDER") + 1;
                    parametersForInsert[1].Value = order.customerId;
                    parametersForInsert[2].Value = order.sellerId;
                    parametersForInsert[3].Value = order.goodsName;
                    parametersForInsert[4].Value = order.price;
                    parametersForInsert[5].Value = DateTime.Now.ToLocalTime().ToString("G");
                    parametersForInsert[6].Value = order.goodsId;
                    dbHelper.ExecuteNonQuery(insert, parametersForInsert);
                }
                point += (order.price * order.number);
                ++res;

                // 卖(存货、收入数据更新)

                // 存货更新
                string            updateGoods = "UPDATE SELLER_GOODS SET AVAILABLE = AVAILABLE-:orders WHERE SELLER_ID =:sellerId AND GOODS_ID =:goodsId";
                OracleParameter[] parametersForUpdateGoods =
                {
                    new OracleParameter(":orders",   OracleDbType.Long, 10),
                    new OracleParameter(":sellerId", OracleDbType.Long, 10),
                    new OracleParameter(":goodsId",  OracleDbType.Long, 10)
                };
                parametersForUpdateGoods[0].Value = order.number;
                parametersForUpdateGoods[1].Value = order.sellerId;
                parametersForUpdateGoods[2].Value = order.goodsId;
                dbHelper.ExecuteNonQuery(updateGoods, parametersForUpdateGoods);

                // 收入更新
                string            updateEarning = "UPDATE SELLER SET EARNING = EARNING+:money WHERE ID =:sellerId";
                OracleParameter[] parametersForUpdateEarning =
                {
                    new OracleParameter(":money",    OracleDbType.Double),
                    new OracleParameter(":sellerId", OracleDbType.Long, 10)
                };
                parametersForUpdateEarning[0].Value = order.price * order.number;
                parametersForUpdateEarning[1].Value = order.sellerId;
                dbHelper.ExecuteNonQuery(updateEarning, parametersForUpdateEarning);

                // 积分
                if (check == null)
                {
                    return(Ok("购买成功,已购" + res.ToString() + "件商品"));
                }
                else
                {
                    VipController.updateVip(order.customerId, point);
                    return(Ok("购买成功,已购" + res.ToString() + "件商品\n" + "积分增加" + point.ToString()));
                }
            }
            catch (OracleException oe)
            {
                return(BadRequest("数据库请求错误 " + "错误代码 " + oe.Number.ToString()));
            }
            catch (Exception)
            {
                return(BadRequest("未知错误"));
            }
        }