-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Oct 16, 2020 at 02:46 AM
-- Server version: 5.7.26
-- PHP Version: 7.3.8

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

--
-- Database: `montzo_manufacture`
--

-- --------------------------------------------------------

--
-- Table structure for table `WorkOrderOperations`
--

DROP TABLE IF EXISTS `WorkOrderOperations`;
CREATE TABLE `WorkOrderOperations` (
  `id` bigint(20) NOT NULL,
  `workOrderId` bigint(20) NOT NULL,
  `operationId` bigint(20) NOT NULL,
  `operationTime` double NOT NULL,
  `operationCost` double NOT NULL,
  `workstationId` bigint(20) NOT NULL,
  `batchSize` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `WorkOrderOperations`
--

INSERT INTO `WorkOrderOperations` (`id`, `workOrderId`, `operationId`, `operationTime`, `operationCost`, `workstationId`, `batchSize`) VALUES
(1, 1, 17, 150, 202.5, 1, 2),
(2, 1, 20, 150, 600, 9, 2);

-- --------------------------------------------------------

--
-- Table structure for table `WorkOrderRequiredItems`
--

DROP TABLE IF EXISTS `WorkOrderRequiredItems`;
CREATE TABLE `WorkOrderRequiredItems` (
  `id` int(11) NOT NULL,
  `itemId` int(11) NOT NULL,
  `variantId` bigint(20) NOT NULL DEFAULT '0',
  `sourceWarehouseId` int(11) NOT NULL,
  `requiredQuantity` double NOT NULL,
  `rate` double NOT NULL DEFAULT '0',
  `amount` double NOT NULL DEFAULT '0',
  `workOrderId` int(11) NOT NULL,
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  `deletedAt` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `WorkOrderRequiredItems`
--

INSERT INTO `WorkOrderRequiredItems` (`id`, `itemId`, `variantId`, `sourceWarehouseId`, `requiredQuantity`, `rate`, `amount`, `workOrderId`, `createdAt`, `updatedAt`, `deletedAt`) VALUES
(1, 1, 1, 5, 150, 3, 450, 1, '2020-10-15 05:41:19', '2020-10-15 07:03:03', '0000-00-00 00:00:00'),
(2, 3, 3, 5, 51, 200, 10200, 1, '2020-10-15 05:41:19', '2020-10-15 07:03:03', '0000-00-00 00:00:00');

-- --------------------------------------------------------

--
-- Table structure for table `WorkOrders`
--

DROP TABLE IF EXISTS `WorkOrders`;
CREATE TABLE `WorkOrders` (
  `id` int(11) NOT NULL,
  `productionPlanId` int(11) NOT NULL DEFAULT '0' COMMENT 'Left it 0 if not created from ProductionPlan or Sale Order',
  `number` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branchId` int(11) NOT NULL,
  `itemId` int(11) NOT NULL,
  `variantId` int(11) NOT NULL DEFAULT '0',
  `quantity` double NOT NULL,
  `bomId` bigint(20) NOT NULL,
  `projectId` int(11) NOT NULL DEFAULT '0',
  `allowAlternativeItem` tinyint(4) DEFAULT '0',
  `sourceWarehouseId` int(11) NOT NULL,
  `targetWarehouseId` int(11) NOT NULL,
  `wipWarehouseId` int(11) NOT NULL,
  `scrapWarehouseId` int(11) NOT NULL,
  `plannedStartDate` date DEFAULT NULL,
  `plannedEndDate` date DEFAULT NULL,
  `expectedDeliveryDate` date DEFAULT NULL,
  `transferMaterialAgainst` tinyint(4) NOT NULL DEFAULT '1' COMMENT '2 = JOB CARD or 1 = WORK ORDER',
  `additionalOperationCost` double NOT NULL,
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  `deletedAt` datetime DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 = Draft 1 = Published'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `WorkOrders`
--

INSERT INTO `WorkOrders` (`id`, `productionPlanId`, `number`, `branchId`, `itemId`, `variantId`, `quantity`, `bomId`, `projectId`, `allowAlternativeItem`, `sourceWarehouseId`, `targetWarehouseId`, `wipWarehouseId`, `scrapWarehouseId`, `plannedStartDate`, `plannedEndDate`, `expectedDeliveryDate`, `transferMaterialAgainst`, `additionalOperationCost`, `createdAt`, `updatedAt`, `deletedAt`, `status`) VALUES
(1, 0, 'WO-LV-101-RED-XL-29', 0, 4, 8, 30, 3, 1, NULL, 1, 5, 1, 4, '2020-10-25', '2020-10-28', '2020-10-29', 1, 0, '2020-10-15 05:41:19', '2020-10-15 07:03:03', NULL, 0);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `WorkOrderOperations`
--
ALTER TABLE `WorkOrderOperations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `WorkOrderRequiredItems`
--
ALTER TABLE `WorkOrderRequiredItems`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `WorkOrders`
--
ALTER TABLE `WorkOrders`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `WorkOrderOperations`
--
ALTER TABLE `WorkOrderOperations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `WorkOrderRequiredItems`
--
ALTER TABLE `WorkOrderRequiredItems`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `WorkOrders`
--
ALTER TABLE `WorkOrders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
