Description
Properties
| Name | Value |
|---|---|
| Collation | |
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Schema Bound | False |
| Created | 11/6/2020 19:02:35 |
| Last Modified | 11/6/2020 19:02:35 |
Columns
| Key | Name | Description |
|---|---|---|
| ms_item_out_detail_id | ||
| out_qty | ||
| plan_qty |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE view dbo.vw_ms_production_in_sum_to_part
---XencX---with encryption
as
SELECT
dt_ms_part_list_out.ms_item_out_detail_id
,sum(case when dt_ms_part_list_production_h_status.ms_part_list_production_status_id = 1 then dt_ms_part_list_out.quantity else 0 end ) out_qty
,sum(case when dt_ms_part_list_production_h_status.ms_part_list_production_status_id = 0 then dt_ms_part_list_out.quantity else 0 end ) plan_qty
FROM dt_ms_part_list_production_h_status
INNER JOIN dt_ms_part_list_production_header ON dt_ms_part_list_production_h_status.ms_part_list_production_h_status_id = dt_ms_part_list_production_header.ms_part_list_production_h_status_id
INNER JOIN dt_ms_part_list_production_detail AS dt_ms_part_list_production_detail_1 ON dt_ms_part_list_production_header.ms_part_list_production_id = dt_ms_part_list_production_detail_1.ms_part_list_production_id
INNER JOIN dt_ms_part_list_out ON dt_ms_part_list_production_detail_1.ms_part_list_production_detail_id = dt_ms_part_list_out.ms_part_list_process_detail_id
WHERE dt_ms_part_list_production_h_status.ms_part_list_production_status_id<>-1
AND dt_ms_part_list_out.ms_process_id = 1
GROUP BY dt_ms_part_list_out.ms_item_out_detail_id
GO
GO
CREATE view dbo.vw_ms_production_in_sum_to_part
---XencX---with encryption
as
SELECT
dt_ms_part_list_out.ms_item_out_detail_id
,sum(case when dt_ms_part_list_production_h_status.ms_part_list_production_status_id = 1 then dt_ms_part_list_out.quantity else 0 end ) out_qty
,sum(case when dt_ms_part_list_production_h_status.ms_part_list_production_status_id = 0 then dt_ms_part_list_out.quantity else 0 end ) plan_qty
FROM dt_ms_part_list_production_h_status
INNER JOIN dt_ms_part_list_production_header ON dt_ms_part_list_production_h_status.ms_part_list_production_h_status_id = dt_ms_part_list_production_header.ms_part_list_production_h_status_id
INNER JOIN dt_ms_part_list_production_detail AS dt_ms_part_list_production_detail_1 ON dt_ms_part_list_production_header.ms_part_list_production_id = dt_ms_part_list_production_detail_1.ms_part_list_production_id
INNER JOIN dt_ms_part_list_out ON dt_ms_part_list_production_detail_1.ms_part_list_production_detail_id = dt_ms_part_list_out.ms_part_list_process_detail_id
WHERE dt_ms_part_list_production_h_status.ms_part_list_production_status_id<>-1
AND dt_ms_part_list_out.ms_process_id = 1
GROUP BY dt_ms_part_list_out.ms_item_out_detail_id
GO