Exemplo n.º 1
0
        // 数量加一,但不能大于余量
        private void AddNum(object sender, RoutedEventArgs e)
        {
            material materialLeft = mmsContext.material.Find(materialNumber.m.mid);

            if (materialLeft.rest > materialNumber.Count)
            {
                materialNumber.Count++;
            }
            else
            {
                MessageBox.Show("选择数量不能超过余量!");
            }
        }
Exemplo n.º 2
0
        // 确认,将值返回后关闭
        private void Confirm(object sender, RoutedEventArgs e)
        {
            material materialLeft = mmsContext.material.Find(materialNumber.m.mid);

            if (materialLeft.rest > materialNumber.Count)
            {
                materialNumCallback.Modify(materialNumber);
                Close();
            }
            else
            {
                MessageBox.Show("选择数量不能超过余量!");
            }
        }
Exemplo n.º 3
0
        // 确认选择的物料,生成取货订单
        private void ConfirmChoosed(object sender, RoutedEventArgs e)
        {
            if (!Account.Instance.IsLogin())
            {
                MessageBox.Show("缺少登录信息,请重试");
                return;
            }

            string id = System.Guid.NewGuid().ToString("N");

            // TODO 等待嵌入式设备返回操作成功信息

            foreach (MaterialNumber materialNumber in choosedMaterials)
            {
                // 若提交订单时,可用数量不够
                material materialLeft = context.material.Find(materialNumber.m.mid);
                if (materialLeft.rest < materialNumber.Count)
                {
                    MessageBox.Show("编号:" + materialLeft.mid + " 库存不足!");
                    return;
                }
                out_item outItemNew = new out_item()
                {
                    out_id = id, mid = materialNumber.m.mid, num = materialNumber.Count
                };
                context.out_item.Add(outItemNew);

                // 修改物料表中的可用数量
                materialLeft.rest -= materialNumber.Count;
                context.Entry(materialLeft).State = EntityState.Modified;
            }

            out_order order = new out_order()
            {
                out_id = id, out_time = DateTime.Now, employee_id = Account.Instance.GetUser().emplyee_id
            };

            context.out_order.Add(order);

            context.SaveChanges();

            // 刷新界面,并且提示成功
            MessageBox.Show("取料成功!");
            lvMaterials.ItemsSource = context.material.ToList();
            // 清空已选择
            choosedMaterials.Clear();
        }
Exemplo n.º 4
0
 // TODO 修改添加物料数量后返回
 public void OnModifiedNumBack(material m, int num)
 {
 }