Beispiel #1
0
 public static byte[] LadeOrderDetails(byte[] itemBuffer)
 {
     byte[] objRet = null;
     string strReceive = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
     List<OrderDetails> orderDetailsList = JsonConvert.DeserializeObject<List<OrderDetails>>(strReceive);
     bool result = true;
     if (orderDetailsList != null && orderDetailsList.Count > 0)
     {
         foreach (OrderDetails item in orderDetailsList)
         {
             result = OrderDetailsService.GetInstance().LadeOrderDetails(item);
             if (!result)
             {
                 break;
             }
         }
     }
     if (result)
     {
         //成功
         objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
         Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
         Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
     }
     else
     {
         //单品提单失败
         objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
         Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
         Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
     }
     return objRet;
 }
Beispiel #2
0
        private void btnStatistics_Click(object sender, EventArgs e)
        {
            if (this.dateTimePicker4.Value > this.dateTimePicker3.Value)
            {
                string beginDate = this.dateTimePicker3.Value.ToString("yyyy-MM-dd");
                string endDate   = this.dateTimePicker4.Value.ToString("yyyy-MM-dd");

                IList <TopSellGoods> topSellGoodsList = OrderDetailsService.GetInstance().GetTopSellGoodsByTime(beginDate, endDate);
                if (topSellGoodsList != null && topSellGoodsList.Count > 0)
                {
                    BindChartPieData(topSellGoodsList);
                }
            }
        }
Beispiel #3
0
        public static byte[] GetLastCustomPrice(byte[] itemBuffer)
        {
            byte[] objRet = null;
            string strReceive = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
            Guid goodsID = new Guid(strReceive);

            decimal result = OrderDetailsService.GetInstance().GetLastCustomPrice(goodsID);

            int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + BasicTypeLength.DOUBLE_DECIMAL;
            objRet = new byte[transCount];
            Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes((double)result), 0, objRet, 2 * BasicTypeLength.INT32, BasicTypeLength.DOUBLE_DECIMAL);
            return objRet;
        }
Beispiel #4
0
        public static byte[] GetAllDeletedItems(byte[] itemBuffer)
        {
            byte[] objRet = null;
            string beginDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.BEGINDATE).Trim('\0');
            string endDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE, ParamFieldLength.ENDDATE).Trim('\0');
            int dateType = BitConverter.ToInt32(itemBuffer, ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE + ParamFieldLength.ENDDATE);

            DeletedAllItems deletedAllItems = OrderDetailsService.GetInstance().GetAllDeletedItems(DateTime.Parse(beginDate), DateTime.Parse(endDate), dateType);
            string json = JsonConvert.SerializeObject(deletedAllItems);
            byte[] jsonByte = Encoding.UTF8.GetBytes(json);

            int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
            objRet = new byte[transCount];
            Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            return objRet;
        }
Beispiel #5
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dataGirdViewExt1.Rows.Clear();
            dataGirdViewExt2.Rows.Clear();
            string beginDate = dateTimePicker1.Value.ToString("yyyy-MM-dd 00:00:00");
            string endDate   = dateTimePicker2.Value.ToString("yyyy-MM-dd 23:59:59");
            int    dateType  = 1;

            if (cmbDateType.Text == "账务日")
            {
                dateType = 1;
            }
            if (cmbDateType.Text == "营业日")
            {
                dateType = 2;
            }
            DeletedAllItems deletedAllItems = OrderDetailsService.GetInstance().GetAllDeletedItems(beginDate, endDate, dateType);

            //绑定单品删除品项
            if (deletedAllItems.DeletedGoodsItemList != null && deletedAllItems.DeletedGoodsItemList.Count > 0)
            {
                decimal totalAmount = 0M;
                foreach (DeletedItem item in deletedAllItems.DeletedGoodsItemList)
                {
                    totalAmount += item.TotalSellPrice;
                    int index = dataGirdViewExt1.Rows.Add();
                    dataGirdViewExt1.Rows[index].Cells["colTranSequence"].Value     = item.TranSequence;
                    dataGirdViewExt1.Rows[index].Cells["colDeskName"].Value         = item.DeskName;
                    dataGirdViewExt1.Rows[index].Cells["colOrderNo"].Value          = item.OrderNo;
                    dataGirdViewExt1.Rows[index].Cells["colGoodsName"].Value        = item.GoodsName;
                    dataGirdViewExt1.Rows[index].Cells["colItemQty"].Value          = item.ItemQty;
                    dataGirdViewExt1.Rows[index].Cells["colCancelReasonName"].Value = item.CancelReasonName;
                    dataGirdViewExt1.Rows[index].Cells["colCancelEmployeeNo"].Value = item.CancelEmployeeNo;
                    dataGirdViewExt1.Rows[index].Cells["colLastModifiedTime"].Value = item.LastModifiedTime;
                    string type = string.Empty;
                    if (item.PayTime == null)
                    {
                        type = "退菜";
                    }
                    else
                    {
                        type = "退单";
                    }
                    dataGirdViewExt1.Rows[index].Cells["colType"].Value = type;
                }
                txtTotalQty.Text    = deletedAllItems.DeletedGoodsItemList.Count.ToString();
                txtTotalAmount.Text = totalAmount.ToString("f2");
            }
            //绑定整单删除品项
            if (deletedAllItems.DeletedOrderItemList != null && deletedAllItems.DeletedOrderItemList.Count > 0)
            {
                decimal totalMoney = 0M;
                foreach (DeletedItem item in deletedAllItems.DeletedOrderItemList)
                {
                    totalMoney += item.TotalSellPrice;
                    int index = dataGirdViewExt2.Rows.Add();
                    dataGirdViewExt2.Rows[index].Cells["colTranSequence1"].Value     = item.TranSequence;
                    dataGirdViewExt2.Rows[index].Cells["colDeskName1"].Value         = item.DeskName;
                    dataGirdViewExt2.Rows[index].Cells["colOrderNo1"].Value          = item.OrderNo;
                    dataGirdViewExt2.Rows[index].Cells["colGoodsName1"].Value        = item.GoodsName;
                    dataGirdViewExt2.Rows[index].Cells["colItemQty1"].Value          = item.ItemQty;
                    dataGirdViewExt2.Rows[index].Cells["colCancelReasonName1"].Value = item.CancelReasonName;
                    dataGirdViewExt2.Rows[index].Cells["colCancelEmployeeNo1"].Value = item.CancelEmployeeNo;
                    dataGirdViewExt2.Rows[index].Cells["colLastModifiedTime1"].Value = item.LastModifiedTime;
                    string type = string.Empty;
                    if (item.PayTime == null)
                    {
                        type = "退菜";
                    }
                    else
                    {
                        type = "退单";
                    }
                    dataGirdViewExt2.Rows[index].Cells["colType1"].Value = type;
                }
                txtTotalNum.Text   = deletedAllItems.DeletedOrderItemList.Count.ToString();
                txtTotalMoney.Text = totalMoney.ToString("f2");
            }
        }