示例#1
0
        private void sorteGoodList_Load(object sender, EventArgs e)
        {
            numberTextBox.Focus();
            Times times = new Times();

            times.TopLevel = false;
            this.timePanel.Controls.Add(times);
            times.Show();

            //if (goodDataGridView.Focused == true)
            //{
            //    MessageBox.Show("true");
            //}
            //else
            //{
            //    MessageBox.Show("false");
            //}
            //goodDataGridView.ClearSelection();

            int hw = redButton.Height;

            if (hw > redButton.Width)
            {
                hw = redButton.Width;
            }
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(4, 4, hw - 8, hw - 8);
            gp.FillMode            = System.Drawing.Drawing2D.FillMode.Winding;
            redButton.Region       = new Region(gp);
            redButton.BackColor    = Color.Red;
            yellowButton.Region    = new Region(gp);
            yellowButton.BackColor = Color.Yellow;
            greenButton.Region     = new Region(gp);
            greenButton.BackColor  = Color.Green;
            //---
            dt            = ConstantUtil.Branchds.Tables["Zc_sorte_item"];
            result        = dt.Rows[ConstantUtil.index][14];
            textBox2.Text = dt.Rows[ConstantUtil.index][9].ToString();
            sortedao      = new orderDao();
            branchName    = sortedao.getBranchName(result.ToString());
            textBox1.Text = branchName;

            //展示数据
            showInfo();

            //后台刷新数据
            System.Timers.Timer pTimer = new System.Timers.Timer(1000);               //每隔5秒执行一次,没用winfrom自带的
            pTimer.Elapsed  += new System.Timers.ElapsedEventHandler(pTimer_Elapsed); //委托,要执行的方法
            pTimer.AutoReset = true;                                                  //获取该定时器自动执行
            pTimer.Enabled   = true;                                                  //这个一定要写,要不然定时器不会执行的
            Control.CheckForIllegalCrossThreadCalls = false;                          //这个不太懂,有待研究
        }
        public orderDto OrderDaoToOrderDto(orderDao o)
        {
            orderDto od = new orderDto();

            od.Id       = o.Id;
            od.Name     = o.Name;
            od.products = new List <productDto>();
            foreach (var item in o.products)
            {
                od.products.Add(ProductDaoToProductDto(item));
            }
            od.totalPrice = o.totalPrice;
            return(od);
        }
示例#3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            DataTable dt     = ConstantUtil.Branchds.Tables["Zc_sorte_item"];
            object    result = dt.Rows[ConstantUtil.index][14];
            //byte[] buffer = Encoding.Default.GetBytes(result.ToString());
            orderDao orderdao = new orderDao();

            if (ConstantUtil.ipList == null || ConstantUtil.ipList.Count == 0)
            {
                MessageBox.Show("工位或者工位IP尚未设定,请设定完毕后再开始分拣");
                return;
            }
            else
            {
                for (int i = 0; i < ConstantUtil.ipList.Count; i++)
                {
                    string ip = ConstantUtil.ipList[i];
                    orderdao.insertSorteStatus(result.ToString(), ip);
                }
            }
            redButton.Hide();
            redLabel.Hide();
            greenButton.Show();
            greenLabel.Show();
            yellowButton.Hide();
            yellowLabel.Hide();
            numberTextBox.Focus();
            //if (ConstantUtil.socketList.Count > 0)
            //{
            //    orderDao orderdao = new orderDao();
            //    orderdao.insertSorteStatus(result.ToString(),ConstantUtil.ip1);
            //    orderdao.insertSorteStatus(result.ToString(), ConstantUtil.ip2);
            //    redButton.Hide();
            //        redLabel.Hide();
            //        greenButton.Show();
            //        greenLabel.Show();
            //        yellowButton.Hide();
            //        yellowLabel.Hide();
            //}
            //else
            //{
            //    MessageBox.Show("目前未有子设备连接主机!");
            //}

            //byte[] buffer = Encoding.Default.GetBytes(str);
            //connSocket.Send(buffer, buffer.Length, SocketFlags.None);
        }
示例#4
0
        public string[] GetPrintStr()
        {
            //DataTable dt = ConstantUtil.Branchds.Tables["Zc_sorte_item"];
            //string street = dt.Rows[ConstantUtil.index][13].ToString();
            sortedao   = new orderDao();
            branchName = sortedao.getBranchName(ConstantUtil.street);

            StringBuilder sb = new StringBuilder();

            string tou = "宜鲜美配送有限公司";

            string address = "南京市江宁区东麒路66号";

            //string saleID = id_.Text;

            //string item = "品名";

            //decimal price = 25.00M;

            //int count = 5;

            //decimal total = 0.00M;

            //decimal fukuan = 500.00M;



            sb.Append("            " + tou + "     \n");

            sb.Append("-----------------------------------------------------------------\n");

            sb.Append("日期:" + DateTime.Now.ToShortDateString() + "  " + "分店:" + branchName + "\n");

            sb.Append("-----------------------------------------------------------------\n");

            sb.Append("品名" + "\t\t" + "单价" + "\t" + "重/数量" + "\t" + "小计" + "\n");
            //for (int i = 0; i < itemDataGridView.RowCount; i++)
            //{
            //    int actualnums = itemDataGridView[4, i].Value == null ? 0 : Convert.ToInt32(itemDataGridView[4, i].Value);
            //    if (actualnums != 0)
            //    {
            //        string name = itemDataGridView[1, i].Value == null ? "" : itemDataGridView[1, i].Value.ToString();
            //        if (name.Length < 4)
            //        {
            //            name += "\t\t";
            //        }
            //        else if (name.Length <= 6)
            //        {
            //            name += "\t";
            //        }
            //        else
            //        {
            //            name = name.Substring(0, 6) + "... ";
            //        }
            //        string price = itemDataGridView[2, i].Value == null ? "" : itemDataGridView[2, i].Value.ToString();
            //        price = float.Parse(price).ToString("0.00");
            //        string amount = itemDataGridView[7, i].Value == null ? "" : itemDataGridView[7, i].Value.ToString();
            //        amount = float.Parse(amount).ToString("0.00");
            //        sb.Append(name + price + "\t" + actualnums + "\t" + amount + "\n");
            //    }
            //}
            float  totalSum    = 0;
            float  totalAmount = 0;
            string sql         = "select a.goods_id, a.goods_name, a.SORTENUM, a.WEIGHT, b.GOODS_PRICE, b.GOODS_UNIT  from ZC_ORDERS_SORTE a left join ZC_GOODS_MASTER b "
                                 + " on a.GOODS_ID = b.SERIALNUMBER where a.ADDRESS = :street and a.SORTEID = :sorteId order by b.serialnumber ";
            OracleConnection conn = null;
            OracleCommand    cmd  = new OracleCommand();

            try
            {
                conn            = OracleUtil.OpenConn();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.Parameters.Add(":street", ConstantUtil.street);
                cmd.Parameters.Add(":sorteId", ConstantUtil.sorte_id);
                var reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string serialNumber = reader.IsDBNull(0) ? string.Empty : reader.GetString(0);
                    string name         = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                    string sorteNum     = reader.IsDBNull(2) ? "0" : reader.GetString(2);
                    string weightString = reader.IsDBNull(3) ? "0" : reader.GetString(3);
                    string goodsPrice   = reader.IsDBNull(4) ? "0" : reader.GetFloat(4).ToString("0.00");
                    string unit         = reader.IsDBNull(5) ? string.Empty : reader.GetString(5);
                    float  weight       = float.Parse(weightString);
                    float  price        = float.Parse(goodsPrice);
                    float  nums         = float.Parse(sorteNum);
                    totalSum    += nums;
                    totalAmount += price * nums;
                    if (name.Length < 4)
                    {
                        name += "\t\t";
                    }
                    else if (name.Length <= 6)
                    {
                        name += "\t";
                    }
                    else
                    {
                        name = name.Substring(0, 6) + "...\t";
                    }
                    if (serialNumber.Length == 5)
                    {
                        sb.Append(name + price.ToString("0.00") + "\t" + weight.ToString("0.000") + "\t" + (price * weight).ToString("0.00") + "\n");
                    }
                    else
                    {
                        sb.Append(name + price.ToString("0.00") + "\t" + sorteNum + unit + "\t" + (price * nums).ToString("0.00") + "\n");
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }
            finally
            {
                cmd.Dispose();
                OracleUtil.CloseConn(conn);
            }
            sb.Append("-----------------------------------------------------------------\n");

            sb.Append("数量: " + totalSum.ToString("0.00") + "\t\t 合计: " + totalAmount.ToString("0.00") + "\n");

            sb.Append("-----------------------------------------------------------------\n");

            sb.Append("地址:" + address + "\n");


            sb.Append("             谢谢惠顾欢迎下次光临                ");
            //log.Error(sb.ToString()+"--------->");
            return(sb.ToString().Split('\n'));
        }
示例#5
0
        private void endButton_Click(object sender, EventArgs e)
        {
            if (sortFlag == false)
            {
                DataTable dt      = ConstantUtil.Branchds.Tables["Zc_sorte_item"];
                object    sorteId = dt.Rows[0][8];
                if (ConstantUtil.index + 1 >= dt.Rows.Count)
                {
                    for (int i = 0; i < goodDataGridView.Rows.Count; i++)
                    {
                        string oldCount = goodDataGridView.Rows[i].Cells[3].Value == null ? "" : goodDataGridView.Rows[i].Cells[3].Value.ToString();
                        string newCount = goodDataGridView.Rows[i].Cells[4].Value == null ? "" : goodDataGridView.Rows[i].Cells[4].Value.ToString();
                        if (oldCount.Equals(newCount))
                        {
                        }
                        else
                        {
                            DialogResult dr = MessageBox.Show("存在分拣份数不符合的商品,确定结束分拣?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                            if (dr == DialogResult.OK)
                            {
                                break;
                            }
                            else
                            {
                                return;
                            }
                        }
                    }

                    orderDao orderdao = new orderDao();
                    orderdao.deleteSorteStatus(ConstantUtil.ip1);
                    orderdao.deleteSorteStatus(ConstantUtil.ip2);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        object id       = dt.Rows[i][0];
                        object streetId = dt.Rows[i][14];
                        List <ZcProcessOrder> ZcProcessOrderList = orderdao.FindAll(streetId.ToString());
                        if (ZcProcessOrderList != null && ZcProcessOrderList.Count() > 0)
                        {
                            for (int a = 0; a < ZcProcessOrderList.Count; a++)
                            {
                                ZcProcessOrder            zcprocessOrder         = ZcProcessOrderList[a];
                                string                    orderId                = zcprocessOrder.id;
                                List <ZcProcessOrderItem> ZcProcessOrderItemList = orderdao.getItemByid(orderId);
                                if (ZcProcessOrderItemList != null && ZcProcessOrderItemList.Count() > 0)
                                {
                                    orderdao.AddtransitItem(ZcProcessOrderItemList);
                                    for (int b = 0; b < ZcProcessOrderItemList.Count; b++)
                                    {
                                        ZcProcessOrderItem zcProcessOrderItem = ZcProcessOrderItemList[b];
                                        string             itemId             = zcProcessOrderItem.id;
                                        orderdao.deletePorcessItem(itemId);
                                        orderdao.updateStoreHouse(zcProcessOrderItem);
                                    }
                                }
                                if ("全部完成".Equals(zcprocessOrder.pullFlag))
                                {
                                    zcprocessOrder.orderStatus = "5";
                                    orderdao.deletePorcessOrder(zcprocessOrder.id);
                                    int count = orderdao.getTransitOrderCount(zcprocessOrder.id);

                                    if (count == 0)
                                    {
                                        orderdao.AddtransitOrder(zcprocessOrder);
                                    }
                                    else
                                    {
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                    //改变订单状态
                    orderdao.UpdateStatus(sorteId);
                    MessageBox.Show("分拣完毕!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    sortFlag = true;
                }
                else
                {
                    MessageBox.Show("所有分店尚未分拣完毕,请分拣完毕后再提交数据");
                }
            }
            else
            {
                MessageBox.Show("订单已分拣结束,请返回或退出操作");
            }
        }
示例#6
0
        public DataSet getGridData()
        {
            result = dt.Rows[ConstantUtil.index][14];
            string remark = dt.Rows[ConstantUtil.index][9].ToString().Trim();

            if (string.IsNullOrEmpty(remark))
            {
                //topPanel.Height = 100;
                messagePanel.Visible    = false;
                goodTablePanel.Location = new Point(3, 117);
                //goodTablePanel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
                textBox2.Text = "";
                //label1.Visible = false;
                //textBox2.Visible = false;
                // goodTablePanel.Height = goodTableGroupBox.Height - topPanel.Height - topPanel.Location.Y;
            }
            else
            {
                //topPanel.Height = 165;
                messagePanel.Visible    = true;
                goodTablePanel.Location = new Point(3, 182);
                //goodTablePanel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
                //goodTablePanel.Height = goodTableGroupBox.Height - topPanel.Height - topPanel.Location.Y - messagePanel.Location.Y - messagePanel.Height;
                //label1.Visible = true;
                //textBox2.Visible = true;
                textBox2.Text = remark;
            }
            sortedao      = new orderDao();
            branchName    = sortedao.getBranchName(result.ToString());
            textBox1.Text = branchName;
            try
            {
                OracleConnection connection = OracleUtil.OpenConn();
                if (connection == null)
                {
                    ds = null;
                }
                else
                {
                    //在每次查找或填充数据前判断ds是否为null
                    if (ds != null)
                    {
                        if (ds.Tables.Count > 0)
                        {
                            ds.Tables[0].Rows.Clear();
                            ds.Tables[0].Columns.Clear();
                            ds.Tables[0].AcceptChanges();
                        }
                    }
                    else
                    {
                        ds = new DataSet();
                    }
                    string sql = "select name,serialNumber,goodsfile_id,sum(nums) as nums,branchid ,sorteNum ,workname,workcode from "
                                 + "(select a.goods_state,a.name,a.nums,c.id as goodsfile_id,c.serialNumber,b.branchid,d.sortenum,e.workname,e.workcode "
                                 + " from zc_order_process_item a "
                                 + " left join zc_order_process b on b.id=a.order_id left join zc_goods_master c on c.id=a.goodsfile_id left join (select SUM(sortenum) as sortenum,goods_id ,address from ZC_ORDERS_SORTE where sorteId = '" + ConstantUtil.sorte_id + "' GROUP by goods_id, address) d on d.goods_id = c.id and b.branchid=d.address  left join zc_workstation e on e.id = c.zcuserinfo"
                                 + " where branchid = '" + result + "' ) "
                                 + "group by name,serialNumber,goodsfile_id,branchid,sorteNum,workname,workcode order by serialNumber";
                    OracleCommand     cmd = new OracleCommand(sql, connection);
                    OracleDataAdapter da  = new OracleDataAdapter(cmd);
                    da.Fill(ds, "Zc_sorte_item");

                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                log.Error("加载各分店商品信息失败", ex);
            }
            return(ds);
        }
示例#7
0
 public bool DeleteOrder(orderDao od)
 {
     return(c.DeleteOrder(map.OrderDaoToOrder(od)));
 }
示例#8
0
 public bool AddOrder(orderDao od)
 {
     return(c.AddOrder(map.OrderDaoToOrder(od)));
 }