From 8b1f538599fe6a4337282039f5cad3745e36f19d Mon Sep 17 00:00:00 2001
From: Samart <samart@smartgosd.com>
Date: Thu, 7 Sep 2023 13:47:02 +0700
Subject: [PATCH] Fuu : Fix after UAT1

---
 .../SNSE032_W/SNSE032_W.component.html        | 68 ++++++++------
 .../SNSE032_W/SNSE032_W.component.ts          |  2 +-
 .../SNSE053_W/SNSE053_W.component.html        | 79 ++++++++++------
 .../SNSE053_W/SNSE053_W.component.ts          |  9 +-
 .../warehouse/SNWR026/SNWR026.component.html  | 20 ++---
 .../warehouse/SNWR026/SNWR026.component.ts    | 14 +--
 .../warehouse/SNWR028/SNWR028.component.ts    |  2 +-
 .../warehouse/SNWR032/SNWR032.component.ts    |  1 +
 .../warehouse/SNWR033/SNWR033.component.html  |  6 +-
 .../warehouse/SNWR033/SNWR033.component.ts    | 16 ++--
 .../warehouse/SNWR037/SNWR037.component.html  | 89 ++++++++++++-------
 .../warehouse/SNWR037/SNWR037.component.ts    | 55 +++++++++++-
 .../warehouse/SNWR038/SNWR038.component.ts    |  2 +-
 13 files changed, 244 insertions(+), 119 deletions(-)

diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.html b/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.html
index 5bd86527..eaf8b715 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.html
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.html
@@ -70,7 +70,7 @@
               </button>
             </div>
           </div>
-          <auto-table id="tbl1" [tableName]="'SNSE053_W_TAB1'" [stickyEndCol]="'Edit'" [tableData]="tableData" [showPagination]="false"
+          <auto-table id="tbl1" [tableName]="'SNSE032_W_TAB1'" [stickyEndCol]="'Edit'" [tableData]="tableData" [showPagination]="false"
                       [tableFooter]="tblFooter" [minpage]="100">
 
             <ng-template let-header="header" #tblHeader>
@@ -91,7 +91,7 @@
                       || header.FIELD_NAME == 'GROSS_WEIGHT'
                       || header.FIELD_NAME == 'GROSS_MM'
                       || header.FIELD_NAME == 'CASE_WIDTH'
-                      || header.FIELD_NAME == 'CASE_LENGTH'
+                      || header.FIELD_NAME == 'CASE_DEPTH'
                       || header.FIELD_NAME == 'CASE_HEIGHT'
                     then textbox; else text"></div>
               <ng-template #textbox>
@@ -102,41 +102,37 @@
                                 [checked]="selection.isSelected(data)">
                   </mat-checkbox>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_NO'">
                   <button mat-stroked-button (click)="onClickRow(data);TabGroup.selectedIndex = 1">
                     {{ data.CASE_NO }}
                   </button>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_WEIGHT'">
                   <mat-form-field style="text-align: right;">       
                     <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_WEIGHT">
                   </mat-form-field> 
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_MM'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_MM">
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_MM" disabled>
                   </mat-form-field> 
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_WIDTH'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_WIDTH">
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_WIDTH"
+                      [disabled]="data.CAN_CONFIG != 'Y'">
                   </mat-form-field> 
                 </ng-template>
-
-                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_LENGTH'">
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_DEPTH'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_LENGTH">
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_DEPTH"
+                      [disabled]="data.CAN_CONFIG != 'Y'">
                   </mat-form-field> 
                 </ng-template>
-
-                
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_HEIGHT'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_HEIGHT">
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_HEIGHT"
+                      [disabled]="data.CAN_CONFIG != 'Y'">
                   </mat-form-field> 
                 </ng-template>
 
@@ -221,7 +217,7 @@
         </div>-->
 
           </div>
-          <auto-table id="tbl2" [tableName]="'SNSE032_TAB2'" [tableData]="tableData2" [tableFooter]="tblFooter2" [showPagination]="true" [minpage]="100">
+          <auto-table id="tbl2" [tableName]="'SNSE032_W_TAB2'" [tableData]="tableData2" [tableFooter]="tblFooter2" [showPagination]="true" [minpage]="100">
 
           </auto-table>
 
@@ -257,14 +253,17 @@
             </div>
           </div>
 
-          <auto-table [tableName]="'SNSE032_TAB3'" [tableData]="tableData3" [showPagination]="false"
+          <auto-table [tableName]="'SNSE032_W_TAB3'" [tableData]="tableData3" [showPagination]="false"
                       [tableFooter]="tblFooter">
 
             <ng-template let-header="header" let-data="data" let-index="index">
               <div *ngIf="header.FIELD_NAME == 'Edit'
                       || header.FIELD_NAME == 'CASE_NO'
-                   || header.FIELD_NAME == 'GROSS_WEIGHT'
-                   || header.FIELD_NAME == 'GROSS_MM';
+                      || header.FIELD_NAME == 'GROSS_WEIGHT'
+                      || header.FIELD_NAME == 'GROSS_MM'
+                      || header.FIELD_NAME == 'CASE_WIDTH'
+                      || header.FIELD_NAME == 'CASE_DEPTH'
+                      || header.FIELD_NAME == 'CASE_HEIGHT';
                     then textbox; else text"></div>
               <ng-template #textbox>
 
@@ -272,19 +271,38 @@
                   <mat-checkbox (change)="CheckToPack($event,data)" [(ngModel)]="data.CHK_BOX">
                   </mat-checkbox>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_NO'">
                   <button mat-stroked-button (click)="onClickRow3(data);TabGroup.selectedIndex = 3">
                     {{ data.CASE_NO }}
                   </button>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_WEIGHT'">
-                  {{data[header.FIELD_NAME] | number:'1.3-3'}}
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_WEIGHT">
+                  </mat-form-field> 
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_MM'">
-                  {{data[header.FIELD_NAME] | number:'1.3-3'}}
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_MM" disabled>
+                  </mat-form-field> 
+                </ng-template>
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_WIDTH'">
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_WIDTH"
+                      [disabled]="data.CAN_CONFIG != 'Y'">
+                  </mat-form-field> 
+                </ng-template>
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_DEPTH'">
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_DEPTH"
+                      [disabled]="data.CAN_CONFIG != 'Y'">
+                  </mat-form-field> 
+                </ng-template>
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_HEIGHT'">
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_HEIGHT"
+                      [disabled]="data.CAN_CONFIG != 'Y'">
+                  </mat-form-field> 
                 </ng-template>
 
               </ng-template>
@@ -339,7 +357,7 @@
             </div>
           </div>
 
-          <auto-table [tableName]="'SNSE032_TAB2'" [tableData]="tableData4" [tableFooter]="tblFooter2" [showPagination]="true">
+          <auto-table [tableName]="'SNSE032_W_TAB2'" [tableData]="tableData4" [tableFooter]="tblFooter2" [showPagination]="true">
 
           </auto-table>
 
@@ -368,7 +386,7 @@
               </button>
             </div>
           </div>
-          <auto-table id="tbl3" [tableName]="'SNSE032_TAB1'" [tableData]="tableData5" [stickyEndCol]="'Edit'" [showPagination]="false"
+          <auto-table id="tbl3" [tableName]="'SNSE032_W_TAB1'" [tableData]="tableData5" [stickyEndCol]="'Edit'" [showPagination]="false"
                       [tableFooter]="tblFooter" [minpage]="100">
 
             <ng-template let-header="header" #tblHeader>
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.ts
index 18e3ccd5..d2fe54ae 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNSE032_W/SNSE032_W.component.ts
@@ -356,7 +356,7 @@ export class SNSE032_WComponent implements OnInit {
           AlertMsg="Please enter a Width value greater than 0 from Case No "+x.CASE_NO;
           flgAlert = 1;
         }
-        if (x.CASE_LENGTH < 0 ){
+        if (x.CASE_DEPTH < 0 ){
           AlertMsg="Please enter a Length value greater than 0 from Case No "+x.CASE_NO;
           flgAlert = 1;
         }
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.html b/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.html
index 1beee6de..fd789455 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.html
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.html
@@ -82,7 +82,7 @@
                       || header.FIELD_NAME == 'GROSS_WEIGHT'
                       || header.FIELD_NAME == 'GROSS_MM'
                       || header.FIELD_NAME == 'CASE_WIDTH'
-                      || header.FIELD_NAME == 'CASE_LENGTH'
+                      || header.FIELD_NAME == 'CASE_DEPTH'
                       || header.FIELD_NAME == 'CASE_HEIGHT'
                     then textbox; else text"></div>
               <ng-template #textbox>
@@ -92,8 +92,6 @@
                     <i class="material-icons">edit</i>
                   </button>
                 </ng-template> -->
-
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'Edit'">
                   <mat-checkbox (click)="$event.stopPropagation()"
                                 (change)="$event ? selection.toggle(data) : null;CheckToPack($event,data);"
@@ -104,35 +102,38 @@
                     {{ data.CASE_NO }}
                   </button>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_WEIGHT'">
                   <mat-form-field style="text-align: right;">       
                     <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_WEIGHT">
                   </mat-form-field> 
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_MM'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_MM">
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_MM" disabled>
                   </mat-form-field> 
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_WIDTH'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_WIDTH">
+                    <input class="can-input" type="number" step="0.01" min="0" max="99999" 
+                    matInput autocompleteOff [(ngModel)]="data.CASE_WIDTH" 
+                    onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)"
+                    (ngModelChange)="CalculateM3(data)" [disabled]="data.CAN_CONFIG != 'Y'">
                   </mat-form-field> 
                 </ng-template>
-
-                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_LENGTH'">
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_DEPTH'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_LENGTH">
+                    <input class="can-input" type="number" step="0.01" min="0" max="99999" 
+                    matInput autocompleteOff [(ngModel)]="data.CASE_DEPTH" 
+                    onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)"
+                    (ngModelChange)="CalculateM3(data)" [disabled]="data.CAN_CONFIG != 'Y'">
                   </mat-form-field> 
                 </ng-template>
-
-                
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_HEIGHT'">
                   <mat-form-field style="text-align: right;">       
-                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.CASE_HEIGHT">
+                    <input class="can-input" type="number" step="0.01" min="0" max="99999" 
+                    matInput autocompleteOff [(ngModel)]="data.CASE_HEIGHT" 
+                    onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)"
+                    (ngModelChange)="CalculateM3(data)" [disabled]="data.CAN_CONFIG != 'Y'">
                   </mat-form-field> 
                 </ng-template>
 
@@ -207,7 +208,7 @@
             </div>
 
           </div>
-          <auto-table [tableName]="'SNSE032_TAB2'" [tableData]="tableData2" [tableFooter]="tblFooter2" [showPagination]="true" [minpage]="100"></auto-table>
+          <auto-table [tableName]="'SNSE053_W_TAB2'" [tableData]="tableData2" [tableFooter]="tblFooter2" [showPagination]="true" [minpage]="100"></auto-table>
         </ng-template>
       </mat-tab>
       <mat-tab label="(Modify) Pre-Invoice">
@@ -240,14 +241,17 @@
             </div>
           </div>
 
-          <auto-table [tableName]="'SNSE032_TAB3'" [tableData]="tableData3" [showPagination]="false"
+          <auto-table [tableName]="'SNSE053_W_TAB3'" [tableData]="tableData3" [showPagination]="false"
                       [tableFooter]="tblFooter">
 
             <ng-template let-header="header" let-data="data" let-index="index">
               <div *ngIf="header.FIELD_NAME == 'Edit'
                       || header.FIELD_NAME == 'CASE_NO'
-                   || header.FIELD_NAME == 'GROSS_WEIGHT'
-                   || header.FIELD_NAME == 'GROSS_MM';
+                      || header.FIELD_NAME == 'GROSS_WEIGHT'
+                      || header.FIELD_NAME == 'GROSS_MM'
+                      || header.FIELD_NAME == 'CASE_WIDTH'
+                      || header.FIELD_NAME == 'CASE_DEPTH'
+                      || header.FIELD_NAME == 'CASE_HEIGHT';
                     then textbox; else text"></div>
               <ng-template #textbox>
 
@@ -255,19 +259,44 @@
                   <mat-checkbox (change)="CheckToPack($event,data)" [(ngModel)]="data.CHK_BOX">
                   </mat-checkbox>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'CASE_NO'">
                   <button mat-stroked-button (click)="onClickRow3(data);TabGroup.selectedIndex = 3">
                     {{ data.CASE_NO }}
                   </button>
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_WEIGHT'">
-                  {{data[header.FIELD_NAME] | number:'1.3-3'}}
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_WEIGHT">
+                  </mat-form-field> 
                 </ng-template>
-
                 <ng-template [ngIf]="header.FIELD_NAME == 'GROSS_MM'">
-                  {{data[header.FIELD_NAME] | number:'1.3-3'}}
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" matInput autocompleteOff [(ngModel)]="data.GROSS_MM" disabled>
+                  </mat-form-field> 
+                </ng-template>
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_WIDTH'">
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" step="0.01" min="0" max="99999" 
+                    matInput autocompleteOff [(ngModel)]="data.CASE_WIDTH" 
+                    onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)"
+                    (ngModelChange)="CalculateM3(data)" [disabled]="data.CAN_CONFIG != 'Y'">
+                  </mat-form-field> 
+                </ng-template>
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_DEPTH'">
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" step="0.01" min="0" max="99999" 
+                    matInput autocompleteOff [(ngModel)]="data.CASE_DEPTH" 
+                    onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)"
+                    (ngModelChange)="CalculateM3(data)" [disabled]="data.CAN_CONFIG != 'Y'">
+                  </mat-form-field> 
+                </ng-template>
+                <ng-template [ngIf]="header.FIELD_NAME == 'CASE_HEIGHT'">
+                  <mat-form-field style="text-align: right;">       
+                    <input class="can-input" type="number" step="0.01" min="0" max="99999" 
+                    matInput autocompleteOff [(ngModel)]="data.CASE_HEIGHT" 
+                    onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)"
+                    (ngModelChange)="CalculateM3(data)" [disabled]="data.CAN_CONFIG != 'Y'">
+                  </mat-form-field> 
                 </ng-template>
 
               </ng-template>
@@ -322,7 +351,7 @@
             </div>
           </div>
 
-          <auto-table [tableName]="'SNSE032_TAB2'" [tableData]="tableData4" [tableFooter]="tblFooter2" [showPagination]="true">
+          <auto-table [tableName]="'SNSE053_W_TAB2'" [tableData]="tableData4" [tableFooter]="tblFooter2" [showPagination]="true">
 
           </auto-table>
 
@@ -352,7 +381,7 @@
               </button>
             </div>
           </div>
-          <auto-table [tableName]="'SNSE032_TAB1'" [tableData]="tableData5" [showPagination]="false" [stickyEndCol]="'Edit'" [tableFooter]="tblFooter">
+          <auto-table [tableName]="'SNSE053_W_TAB1'" [tableData]="tableData5" [showPagination]="false" [stickyEndCol]="'Edit'" [tableFooter]="tblFooter">
             <ng-template let-header="header" #tblHeader>
               <div *ngIf="header.FIELD_NAME == 'Edit';then showChecks;else showTitle"></div>
               <ng-template #showTitle>
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.ts
index 223a2128..4a33ed4f 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNSE053_W/SNSE053_W.component.ts
@@ -361,8 +361,8 @@ export class SNSE053_WComponent implements OnInit {
           AlertMsg="Please enter a Width value greater than 0 from Case No "+x.CASE_NO;
           flgAlert = 1;
         }
-        if (x.CASE_LENGTH < 0 ){
-          AlertMsg="Please enter a Length value greater than 0 from Case No "+x.CASE_NO;
+        if (x.CASE_DEPTH < 0 ){
+          AlertMsg="Please enter a Depth value greater than 0 from Case No "+x.CASE_NO;
           flgAlert = 1;
         }
         if (x.CASE_HEIGHT < 0 ){
@@ -513,4 +513,9 @@ export class SNSE053_WComponent implements OnInit {
       this.GetDataModify();
     }
   }
+  
+	public CalculateM3(row) {
+		const M3 = this.global.Round((row.CASE_WIDTH * row.CASE_DEPTH * row.CASE_HEIGHT) / Math.pow(10, 9), 3);
+    row.GROSS_MM = M3;
+	}
 }
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.html b/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.html
index 291fd256..c8988061 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.html
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.html
@@ -3,6 +3,16 @@
   <ng-template [ngIf]="ShowList">
     <div class="form-box">
       <div class="row">
+        <div class="col-md-2">
+          <mat-form-field class="w-100" floatLabel="always">
+            <mat-label>Picking list No.</mat-label>
+            <input name="PICKING_NO" matInput autocompleteOff class="can-input" [(ngModel)]="params.PICKING_LIST_NO"
+                   (change)="autoCompletePickListNo.query()" />
+            <auto-complete-query matSuffix [config]="lookupPickListNoConfig" [textInput]="params.PICKING_LIST_NO"
+                                 (datacallback)="SetSelectedPickListNo($event)" #autoCompletePickListNo>
+            </auto-complete-query>
+          </mat-form-field>
+        </div>
         <div class="col-md-2">
           <mat-form-field class="w-100" floatLabel="always">
             <mat-label>Customer Code</mat-label>
@@ -36,16 +46,6 @@
     </mat-form-field>
   </div>-->
 
-        <div class="col-md-2">
-          <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>Picking list No.</mat-label>
-            <input name="PICKING_NO" matInput autocompleteOff class="can-input" [(ngModel)]="params.PICKING_LIST_NO"
-                   (change)="autoCompletePickListNo.query()" />
-            <auto-complete-query matSuffix [config]="lookupPickListNoConfig" [textInput]="params.PICKING_LIST_NO"
-                                 (datacallback)="SetSelectedPickListNo($event)" #autoCompletePickListNo>
-            </auto-complete-query>
-          </mat-form-field>
-        </div>
         <div class="col-md-2 text-right">
           <button type="button" mat-raised-button name="BtnSearch" (click)="Search()">
             <i class="material-icons">search</i>
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.ts
index b4f2ec02..c0b5e718 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR026/SNWR026.component.ts
@@ -120,14 +120,14 @@ export class SNWR026Component implements OnInit {
 
     // Add mendotary customer code
 
-    if (this.params.CUSTOMER_CODE == '') {
-      this.modal.warning(
-        "Please input the customer code",
-        this.viewRef
-      );
+    // if (this.params.CUSTOMER_CODE == '') {
+    //   this.modal.warning(
+    //     "Please input the customer code",
+    //     this.viewRef
+    //   );
 
-      return;
-    }
+    //   return;
+    // }
 
 
     this.http.post("WH", "SNWR026_GetPickingHeader", this.params).subscribe(
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR028/SNWR028.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNWR028/SNWR028.component.ts
index d2b9b94f..51aca6d8 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR028/SNWR028.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR028/SNWR028.component.ts
@@ -98,7 +98,7 @@ export class SNWR028Component implements OnInit {
             this.caseNoTo = res.CaseNoTo;
             this.params.isPreview = true;
             this.modal.info(
-              `Preview Case Number : ${res.CustomerCode}-${res.CaseNoFrom} to ${res.CustomerCode}-${res.CaseNoTo}`,
+              `Preview Case Number : <BR>${res.CustomerCode}-${res.CaseNoFrom} to ${res.CustomerCode}-${res.CaseNoTo}`,
               this.viewRef,
               () => {
                 this.Preview();
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR032/SNWR032.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNWR032/SNWR032.component.ts
index 5b567b2d..c001dd69 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR032/SNWR032.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR032/SNWR032.component.ts
@@ -289,6 +289,7 @@ export class SNWR032Component implements OnInit {
       this.http.post("WH","SNWR032_SaveByUpload",this.tableUploadFilter)
       .subscribe(res => {
         if(res.STATUS == "DONE"){
+          this.dialogupload.Close();
           this.modal.confirm("Transaction complete: applied and saved.",this.viewref);
         }else{
           this.modal.error("No change to save. Something went wrong.",this.viewref)
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.html b/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.html
index b66c40ac..8d374858 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.html
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.html
@@ -50,12 +50,12 @@
         </div>
         <div class="row mt-1" *ngIf="scannedBaby && scannedBaby?.STATUS_CODE !== 'R'">
           <div class="col-md-12 text-left">
-            <label class="scan-item" style="color:red">ÃÒ¡ÒùÕé¶Ù¡¹Óä»á¾¤àÃÕºÃéÍÂáÅéÇ</label>
+            <label class="scan-item" style="color:red">รายการนี้ถูกนำไปแพคเรียบร้อยแล้ว</label>
           </div>
         </div>
         <div class="row mt-1" *ngIf="scannedCard?.HAVE_REMAIN === false">
           <div class="col-md-12 text-left">
-            <label class="scan-item" style="color:red">ÃÒ¡ÒÃä´é¶Ù¡ packed ·Ñé§ËÁ´áÅéÇ</label>
+            <label class="scan-item" style="color:red">รายการได้ถูก packed ทั้งหมดแล้ว</label>
           </div>
         </div>
       </div>
@@ -188,7 +188,7 @@
                     <div class="col-md-1 text-center">
                       <label class="remaining-list label-link cur-pointer" *ngIf="data.STATUS_CODE == 'R'"
                         (click)="DeleteBaby(data)" >
-                        ź
+                        ลบ
                       </label>
                     </div>
                     <div class="col-md-2 text-center">
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.ts
index 63db8fe3..62723a6b 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR033/SNWR033.component.ts
@@ -115,10 +115,10 @@ export class SNWR033Component implements OnInit {
   }
 
   public Receive() {
-		if (!this.CheckFinishedForSaveInstruction()) {
-      this.modal.warning("กรุณารับเข้างานให้เสร็จ", this.viewref, () => { this.ReFocus() });
-			return;
-		}
+	if (this.CheckFinishedForSaveInstruction()) {
+  		this.modal.warning("กรุณารับเข้างานให้เสร็จ", this.viewref, () => { this.ReFocus() });
+		return;
+	}
 
     this.modal.confirm(
       (this.CheckReceiveUndone() ? "รับเข้าเบบี้การ์ดไม่เต็มจำนวน" + "<br>" : "") +
@@ -705,10 +705,12 @@ export class SNWR033Component implements OnInit {
   }
 
   private CheckFinishedForSaveInstruction() {
-		let foundfinishedInstruction = this.tableData.find(
-			(item) => item.BABYCARD_NO && item.BABY_QTY == item.RECEIVE_QTY
+	let foundUnfinishedInstruction = this.tableData
+		.filter((item) => item.STATUS_CODE == "R")
+		.some(
+			(item) => item.BABYCARD_NO && item.RECEIVE_QTY == 0
 		);
-		return foundfinishedInstruction;
+	return foundUnfinishedInstruction;
   }
 
 	private CheckReceiveUndone() {
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.html b/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.html
index bc805e14..d6deb746 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.html
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.html
@@ -98,10 +98,10 @@
                     [(ngModel)]="formData.CASE_GROUP_TEXT" [disabled]="true"/>
           </mat-form-field>
         </div>
-        <div class="col-md-2">
+        <div class="col-md-2" *ngIf="formData.CASE_GROUP == 'OT'">
           <mat-form-field class="w-100" floatLabel="always">
             <mat-label>Can Config</mat-label>
-            <mat-select class="can-input" [(ngModel)]="formData.CAN_CONFIG">
+            <mat-select class="can-input" [(ngModel)]="formData.CAN_CONFIG" required>
               <mat-option [value]="'Y'">Yes</mat-option>
               <mat-option [value]="'N'">No</mat-option>
             </mat-select>
@@ -142,26 +142,26 @@
       <div class="row">
         <div class="col-md-6">
           <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>Width(mm)</mat-label>
+            <mat-label>Width (mm)</mat-label>
             <input type="number" class="can-input text-right" min="0" max="99999" maxlength="5" matInput autocompleteOff [ngModelOptions]="{updateOn: 'blur'}" 
               oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" 
-                    [(ngModel)]="formData.CASE_WIDTH"/>
+                    [(ngModel)]="formData.CASE_WIDTH" [required]="formData.CAN_CONFIG == 'N'"/>
           </mat-form-field>
         </div>
         <div class="col-md-6">
           <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>Length</mat-label>
+            <mat-label>Depth (mm)</mat-label>
             <input type="number" class="can-input text-right" min="0" max="99999" maxlength="5" matInput autocompleteOff  [ngModelOptions]="{updateOn: 'blur'}" 
               oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" 
-                  [(ngModel)]="formData.CASE_LENGTH" [disabled]="formData.LEVEL_4"/>
+                  [(ngModel)]="formData.CASE_DEPTH" [required]="formData.CAN_CONFIG == 'N'"/>
           </mat-form-field>
         </div>
         <div class="col-md-6">
           <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>Height</mat-label>
+            <mat-label>Height (mm)</mat-label>
             <input type="number" class="can-input text-right" min="0" max="99999" maxlength="5" matInput autocompleteOff [ngModelOptions]="{updateOn: 'blur'}"
               oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" 
-                     [(ngModel)]="formData.CASE_HEIGHT"/>
+                     [(ngModel)]="formData.CASE_HEIGHT" [required]="formData.CAN_CONFIG == 'N'"/>
           </mat-form-field>
         </div>
         <div class="col-md-6">
@@ -194,7 +194,7 @@
     <div class="col-md-12">
       <div class="row justify-content-center" *ngIf="formData.TYPE == 'ADD'">
         <div class="col-md-4">
-          <button mat-raised-button color="primary" (click)="SaveAdd()" [disabled]="!formData || formData.LEVEL_4 > formData.LEVEL_1">
+          <button mat-raised-button color="primary" (click)="SaveAdd()" [disabled]="!formData">
             <i class="material-icons">save</i>
             Save
           </button>
@@ -209,7 +209,7 @@
       
       <div class="row justify-content-center" *ngIf="formData.TYPE == 'EDIT'">
         <div class="col-md-4">
-          <button mat-raised-button color="primary" (click)="SaveEdit()" [disabled]="!formData || formData.LEVEL_4 > formData.LEVEL_1">
+          <button mat-raised-button color="primary" (click)="SaveEdit()" [disabled]="!formData">
             <i class="material-icons">save</i>
             Save
           </button>
@@ -229,37 +229,54 @@
   <ng-template #content>
     <fieldset class="form-box mt-3">
       <div class="row">
-        <div class="col-md-9" *ngIf="formDataPrint.CASE_GROUP == 'OT'">
+        <div class="col-md-3">
           <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>{{caseGroup.TEXT}} Name</mat-label>
-            <input matInput autocompleteOff required class="can-input" [(ngModel)]="formDataPrint.CASE_NAME" (change)="autoCompleteOuterCaseName.query()" />
-            <auto-complete-query matSuffix [config]="lookupOuterCaseNameConfig" [textInput]="formDataPrint.CASE_NAME"
-                                 (datacallback)="SetSelectedCaseName($event)" #autoCompleteOuterCaseName></auto-complete-query>
+            <mat-label>ETG Code</mat-label>
+            <input type="text" class="can-input text-uppercase" maxlength="20" matInput autocompleteOff [ngModelOptions]="{updateOn: 'blur'}" 
+                    [(ngModel)]="formDataPrint.ETG_CODE" disabled/>
           </mat-form-field>
         </div>
-        <div class="col-md-9" *ngIf="formDataPrint.CASE_GROUP == 'IN'">
-          <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>{{caseGroup.TEXT}} Name</mat-label>
-            <input matInput autocompleteOff required class="can-input" [(ngModel)]="formDataPrint.CASE_NAME" (change)="autoCompleteInnerCaseName.query()" />
-            <auto-complete-query matSuffix [config]="lookupInnerCaseNameConfig" [textInput]="formDataPrint.CASE_NAME"
-                                 (datacallback)="SetSelectedCaseName($event)" #autoCompleteInnerCaseName></auto-complete-query>
-          </mat-form-field>
-        </div>
-      </div>
-      <div class="row mt-2">
-        <div class="col-md-6">
+        <div class="col-md-3">
           <mat-form-field class="w-100" floatLabel="always">
             <mat-label>Case Type</mat-label>
             <input type="text" class="can-input text-uppercase" maxlength="20" matInput autocompleteOff [ngModelOptions]="{updateOn: 'blur'}" 
                     [(ngModel)]="formDataPrint.CASE_TYPE" disabled/>
           </mat-form-field>
         </div>
-        <div class="col-md-6">
-          <mat-form-field class="w-100" floatLabel="always">
-            <mat-label>ETG Code</mat-label>
-            <input type="text" class="can-input text-uppercase" maxlength="20" matInput autocompleteOff [ngModelOptions]="{updateOn: 'blur'}" 
-                    [(ngModel)]="formDataPrint.ETG_CODE" disabled/>
-          </mat-form-field>
+        <div class="col-md-4">
+          <ng-template [ngIf]="formDataPrint.CASE_GROUP == 'OT'">
+            <mat-form-field class="w-100" floatLabel="always">
+              <mat-label>{{caseGroup.TEXT}} Name</mat-label>
+              <input matInput autocompleteOff required class="can-input" [(ngModel)]="formDataPrint.CASE_NAME" (change)="autoCompleteOuterCaseName.query()" />
+              <auto-complete-query matSuffix [config]="lookupOuterCaseNameConfig" [textInput]="formDataPrint.CASE_NAME"
+                                   (datacallback)="SetSelectedCaseName($event)" #autoCompleteOuterCaseName></auto-complete-query>
+            </mat-form-field>
+          </ng-template>
+          <ng-template [ngIf]="formDataPrint.CASE_GROUP == 'IN'">
+            <mat-form-field class="w-100" floatLabel="always">
+              <mat-label>{{caseGroup.TEXT}} Name</mat-label>
+              <input matInput autocompleteOff required class="can-input" [(ngModel)]="formDataPrint.CASE_NAME" (change)="autoCompleteInnerCaseName.query()" />
+              <auto-complete-query matSuffix [config]="lookupInnerCaseNameConfig" [textInput]="formDataPrint.CASE_NAME"
+                                   (datacallback)="SetSelectedCaseName($event)" #autoCompleteInnerCaseName></auto-complete-query>
+            </mat-form-field>
+          </ng-template>
+        </div>
+        <div class="col-md-2">
+          <mat-form-field class="w-100" floatLabel="always"> 
+            <mat-label>No. to print</mat-label>      
+            <input type="number" class="can-input text-right" step="1" min="0" max="10000" 
+              matInput autocompleteOff [(ngModel)]="formDataPrint.QTY" 
+              onchange="this.value = Math.abs(this.value) >= this.max ? Math.abs(this.max) : Math.abs(this.value)">
+          </mat-form-field> 
+        </div>
+      </div>
+      <div class="row">
+        <div class="col-md-12">
+          <div class="w-100 flex-fill" *ngIf="fileUrl">
+            <iframe [src]="fileUrl | safe: 'RESOURCE_URL'"
+                    style="width: 100%; height: 400px"
+                    #iframe></iframe>
+          </div>
         </div>
       </div>
     </fieldset>
@@ -268,10 +285,14 @@
     <div class="col-md-12">
       <div class="row justify-content-center">
         <div class="col-md-4">
-          <button mat-raised-button color="primary" (click)="PrintCaseNameQRCode()" [disabled]="!formDataPrint.CASE_NAME">
+          <button mat-raised-button color="primary" (click)="PreviewCaseNameQRCode()" [disabled]="!formDataPrint.CASE_NAME">
             <i class="material-icons">print</i>
-            Print
+            Preview QR Code
           </button>
+          <!-- <button mat-raised-button color="primary" (click)="PrintCaseNameQRCode()" [disabled]="!formDataPrint.CASE_NAME">
+            <i class="material-icons">print</i>
+            Print
+          </button> -->
         </div>
         <div class="col-md-4">
           <button mat-raised-button (click)="dialogPrint.Close();">
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.ts
index 91e633c0..88b86a45 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR037/SNWR037.component.ts
@@ -39,7 +39,7 @@ export class SNWR037Component implements OnInit {
 
   //File Upload
   public FileName: string = "";
-  private File : any;
+  public fileUrl;
   public tableUpload = []
   public tableUploadFilter = []
   public selection = new SelectionModel<any>(true, []);
@@ -219,6 +219,10 @@ export class SNWR037Component implements OnInit {
       this.modal.warning("Please input ETG Code",this.viewref);
       return;
     }
+    else if(this.formData.CAN_CONFIG == 'N' && (!this.formData.CASE_WIDTH || !this.formData.CASE_DEPTH || !this.formData.CASE_HEIGHT)){
+      this.modal.warning("If Can Config = 'N'<br>Please input all units<br>Width, Depth, Height",this.viewref);
+      return;
+    }
 
     this.modal.confirm("Do you want to save change you have made?", this.viewref, () => ConfirmEdit());
 
@@ -242,6 +246,7 @@ export class SNWR037Component implements OnInit {
   public CancleEdit() {
     this.dialogAction.Close();
   }
+
   public lookupOuterCaseNameConfig: any = {
     ColName: "LOOKUP_CASE_NAME",
     PlaceholderText: "Select Outer Case Name",
@@ -251,6 +256,7 @@ export class SNWR037Component implements OnInit {
     MinLengthSearch: 0,
     UpperCase: true
   }
+
   public lookupInnerCaseNameConfig: any = {
     ColName: "LOOKUP_CASE_NAME",
     PlaceholderText: "Select Inner Case Name",
@@ -260,20 +266,25 @@ export class SNWR037Component implements OnInit {
     MinLengthSearch: 0,
     UpperCase: true
   }
+
   public SetSelectedCaseName(values: any) {
     this.formDataPrint.CASE_NAME = values.CASE_NAME;
     this.formDataPrint.CASE_TYPE = values.CASE_TYPE;
     this.formDataPrint.ETG_CODE = values.ETG_CODE;
   }
+
   public OpenPrintDialog(){
+    this.fileUrl = null;
     this.formDataPrint = {};
     this.formDataPrint.CASE_GROUP = this.caseGroup.VALUE;
     this.formDataPrint.CASE_GROUP_TEXT = this.caseGroup.TEXT;
-    this.dialogPrint.width ="475px";
-    this.dialogPrint.height = "325px"; 
+    this.formDataPrint.QTY = 1;
+    this.dialogPrint.width ="840px";
+    this.dialogPrint.height = "625px"; 
     this.dialogPrint.title = "Print " + this.caseGroup.TEXT + " QR code";
     this.dialogPrint.OpenDialog();
   }
+
   public PrintCaseNameQRCode(){
     if(!this.formDataPrint.CASE_NAME ){
       this.modal.warning("Please select Case Name to print.",this.viewref);
@@ -299,4 +310,42 @@ export class SNWR037Component implements OnInit {
       });
     }
   }
+  
+  public PreviewCaseNameQRCode() {
+    let params: any;
+    if(this.formDataPrint.CASE_GROUP == "OT"){
+      params = {
+        ReportName: "PMS_RPT_WMS_SNWR037_PRINT_OUTER_CASE",
+        ReportType: "PDF",
+        ReportPrefix: this.formDataPrint.CASE_TYPE + "_" + this.formDataPrint.CASE_NAME,
+        ReportSuffix: ".PDF",
+        P_COMPANY_CODE: this.global.GetTokenDetail("ssComCode"),
+        P_CASE_NAME: this.formDataPrint.CASE_NAME,
+        P_QTY: this.formDataPrint.QTY,
+      };
+    }else if(this.formDataPrint.CASE_GROUP == "IN"){
+      params = {
+        ReportName: "PMS_RPT_WMS_SNWR037_PRINT_INNER_CASE",
+        ReportType: "PDF",
+        ReportPrefix: this.formDataPrint.CASE_TYPE + "_" + this.formDataPrint.CASE_NAME,
+        ReportSuffix: ".PDF",
+        P_COMPANY_CODE: this.global.GetTokenDetail("ssComCode"),
+        P_CASE_NAME: this.formDataPrint.CASE_NAME,
+        P_QTY: this.formDataPrint.QTY,
+      };
+    }
+    this.http
+      .Download("WH", "SNWR037_Preview_Case", params)
+      .subscribe((res) => {
+        if (res) {
+          this.SetIFrameContent(res);
+        }
+      });
+  }
+
+  private SetIFrameContent(content: any) {
+    const file = new Blob([content], { type: content.type });
+    const fileUrl = URL.createObjectURL(file);
+    this.fileUrl = fileUrl;
+  }
 }
\ No newline at end of file
diff --git a/PMS/ClientApp/src/app/pages/warehouse/SNWR038/SNWR038.component.ts b/PMS/ClientApp/src/app/pages/warehouse/SNWR038/SNWR038.component.ts
index b7bd383f..90a45f17 100644
--- a/PMS/ClientApp/src/app/pages/warehouse/SNWR038/SNWR038.component.ts
+++ b/PMS/ClientApp/src/app/pages/warehouse/SNWR038/SNWR038.component.ts
@@ -71,7 +71,7 @@ export class SNWR038Component implements OnInit {
           if (res.Result == "Done") {
             this.noFrom = res.NoFrom;
             this.noTo = res.NoTo;
-            this.modal.info(`Preview inner case number : ${res.NoFrom} to ${res.NoTo}`, this.viewRef,
+            this.modal.info(`Preview inner case number : <BR> ${res.NoFrom} to ${res.NoTo}`, this.viewRef,
               () => {
                 this.Preview();
                 //this.params.PRINT_NUMBER = 0;
-- 
GitLab