Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ReminderOrder reminderOrder = new ReminderOrder
            {
                OrderID = new Guid("15629db5-f2bc-4d01-9142-064886f4fdad"),
                OrderDetailsIDList = new List<Guid>
                {
                    new Guid("C5D49437-D8D5-44D0-B4DC-21D7ECB2D813"),
                    new Guid("8191C8C9-10C2-43E7-98B1-CE13343DFFB0")
                },
                EmployeeNo = "999999",
                ReasonName = "加紧"
            };
            bool success = ReminderOrderService.GetInstance().CreateReminderOrder(reminderOrder);

            var customers = CustomersService.GetInstance().GetAllCustomerInfo();
            var basicData = SysBasicDataService.GetInstance().GetSysBasicData();

            Employee employee = null;
            int result = EmployeeService.GetInstance().GetEmployee(this.textBox1.Text, this.textBox2.Text, out employee);
            if (result == 1)
            {

            }
        }
        public bool CreateReminderOrder(ReminderOrder reminderOrder)
        {
            string json = JsonConvert.SerializeObject(reminderOrder);
            byte[] jsonByte = Encoding.UTF8.GetBytes(json);

            int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length;
            byte[] sendByte = new byte[cByte];
            int byteOffset = 0;
            Array.Copy(BitConverter.GetBytes((int)Command.ID_CREATE_REMINDERORDER), sendByte, BasicTypeLength.INT32);
            byteOffset = BasicTypeLength.INT32;
            Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32);
            byteOffset += BasicTypeLength.INT32;
            Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length);
            byteOffset += jsonByte.Length;

            bool result = false;
            using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port))
            {
                Byte[] receiveData = null;
                Int32 operCode = socket.SendReceive(sendByte, out receiveData);
                if (operCode == (int)RET_VALUE.SUCCEEDED)
                {
                    result = true;
                }
                socket.Close();
            }
            return result;
        }
 public bool CreateReminderOrder(ReminderOrder reminderOrder)
 {
     if (reminderOrder == null || reminderOrder.OrderDetailsIDList == null || reminderOrder.OrderDetailsIDList.Count <= 0)
     {
         return false;
     }
     bool returnValue = false;
     try
     {
         _daoManager.OpenConnection();
         //添加打印任务
         SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo();
         if (systemConfig.IncludeKitchenPrint)
         {
             Order order = _orderDao.GetOrder(reminderOrder.OrderID);
             if (order != null)
             {
                 SalesOrder salesOrder = new SalesOrder
                 {
                     order = order,
                     orderDetailsList = _orderDetailsDao.GetOrderDetailsList(reminderOrder.OrderDetailsIDList)
                 };
                 IList<PrintTask> printTaskList = PrintTaskService.GetInstance().GetPrintTaskList(salesOrder, systemConfig.PrintStyle, systemConfig.FollowStyle, systemConfig.PrintType, 3, reminderOrder.ReasonName);
                 foreach (PrintTask printTask in printTaskList)
                 {
                     _printTaskDao.InsertPrintTask(printTask);
                 }
             }
         }
         returnValue = true;
     }
     catch (Exception exception)
     {
         LogHelper.GetInstance().Error(string.Format("[CreateReminderOrder]参数:reminderOrder_{0}", JsonConvert.SerializeObject(reminderOrder)), exception);
     }
     finally
     {
         _daoManager.CloseConnection();
     }
     return returnValue;
 }
Exemple #4
0
 private void btnReminder_Click(object sender, EventArgs e)
 {
     if (dgvGoodsOrder.CurrentRow != null)
     {
         int seletedIndex = dgvGoodsOrder.CurrentRow.Index;
         DataGridViewRow dgr = dgvGoodsOrder.Rows[seletedIndex];
         if (dgr.Cells["OrderDetailsID"].Value != null)
         {
             int itemType = Convert.ToInt32(dgr.Cells["ItemType"].Value);
             if ((dgr.Cells["Wait"].Value == null || Convert.ToInt32(dgr.Cells["Wait"].Value) == 0) && itemType == (int)OrderItemType.Goods)
             {
                 FormReminder form = new FormReminder();
                 form.ShowDialog();
                 if (form.CurrentReason != null)
                 { 
                     //催单
                     IList<Guid> orderDetailsIdList = new List<Guid>();
                     Guid orderDetailsId = new Guid(dgr.Cells["OrderDetailsID"].Value.ToString());
                     orderDetailsIdList.Add(orderDetailsId);
                     if (seletedIndex < dgvGoodsOrder.Rows.Count - 1)
                     {
                         for (int index = seletedIndex + 1; index < dgvGoodsOrder.Rows.Count; index++)
                         {
                             if (Convert.ToInt32(dgvGoodsOrder.Rows[index].Cells["ItemType"].Value) == (int)OrderItemType.Goods)
                             {
                                 break;
                             }
                             orderDetailsId = new Guid(dgvGoodsOrder.Rows[index].Cells["OrderDetailsID"].Value.ToString());
                             orderDetailsIdList.Add(orderDetailsId);
                         }
                     }
                     ReminderOrder reminder = new ReminderOrder();
                     reminder.OrderID = _salesOrder.order.OrderID;
                     reminder.OrderDetailsIDList = orderDetailsIdList;
                     reminder.ReasonName = form.CurrentReason.ReasonName;
                     reminder.EmployeeNo = ConstantValuePool.CurrentEmployee.EmployeeNo;
                     bool result = ReminderService.GetInstance().CreateReminderOrder(reminder);
                     if (!result)
                     {
                         MessageBox.Show("催单失败,请重新操作!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         return;
                     }
                 }
             }
         }
     }
     this.exTabControl1.SelectedIndex = 0;
 }