private void CreatePreOrder(string filesPathItem)
        {
            if (DataDB.IsExcelAlreadyOrdered(filesPathItem))
            {
                Util.ShowMessage(AlarmType.WARNING, $"El archivo cargado ya ha sido ordenado anteriormente ({filesPathItem})");
                return;
            }
            this.ProcessTextBox.Visible = true;
            List <MaterialBOM> materialList = ExcelUtil.ConvertExcelToMaterialListFromBOM(filesPathItem, this.ProcessTextBox);

            this.ProcessTextBox.Visible = false;
            this.ProcessTextBox.Text    = string.Empty;
            if (materialList == null)
            {
                return;
            }
            if (materialList.Count == 0)
            {
                return;
            }
            Order receiveOrder = DataDB.InsertBOMMaterialList(materialList, filesPathItem);
            List <MaterialOrder> preorderList = receiveOrder.MaterialList;

            if (preorderList.Count != 0)
            {
                PDFUtil.CreatePreOrder(receiveOrder);
                Util.ShowMessage(AlarmType.SUCCESS, $"Se encontraron {preorderList.Count} materiales en almacén");
            }
            else
            {
                MessageBox.Show("No hay ningún producto disponible en almacén");
            }
        }
Exemple #2
0
        private void BtnPrint_Click(object sender, EventArgs e)
        {
            Btn    btn   = (Btn)sender;
            Order  order = btn.Order;
            string path  = $@"{Util.CURRENT_PATH}\PreOrder_{order.Id}.pdf";

            if (Util.ExistFile(path))
            {
                System.Diagnostics.Process.Start(path);
            }
            else
            {
                order = DataDB.GetPreOrderById(order);
                PDFUtil.CreatePreOrder(order);
            }
        }