update inv master > inv master , to/last
This commit is contained in:
parent
b8540d6f0b
commit
2735cfdf99
@ -9,9 +9,9 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int? ItemId { get; set; }
|
||||
public int? ToStation { get; set; }
|
||||
public int? ToStore { get; set; }
|
||||
public int? ToUser { get; set; }
|
||||
public int? LastStation { get; set; }
|
||||
public int? LastStore { get; set; }
|
||||
public int? LastUser { get; set; }
|
||||
[Comment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery")]
|
||||
public string? ToOther { get; set; }
|
||||
public DateTime? sendDate { get; set; }
|
||||
@ -21,15 +21,15 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
public string? Remark { get; set; }
|
||||
public string? ConsignmentNote { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public int? LastUser { get; set; }
|
||||
public int? LastStore{ get; set; }
|
||||
public int? LastStation{ get; set; }
|
||||
public int? ToUser { get; set; }
|
||||
public int? ToStore{ get; set; }
|
||||
public int? ToStation{ get; set; }
|
||||
[Comment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery")]
|
||||
public string? LatestStatus { get; set; }
|
||||
public DateTime? receiveDate { get; set; }
|
||||
public bool MovementComplete { get; set; } = false;
|
||||
//public virtual ItemModel? Item { get; set; }
|
||||
//[ForeignKey("ToStore")]
|
||||
//[ForeignKey("LastStore")]
|
||||
[ForeignKey("ItemId")]
|
||||
public virtual ItemModel? Item { get; set; }
|
||||
[ForeignKey("ToStore")]
|
||||
|
||||
@ -228,12 +228,12 @@
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null,
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null,
|
||||
'text-numb': movement.toOther === 'Faulty' || movement.toOther === 'Calibration' || movement.toOther === 'Repair',
|
||||
'text-weird': movement.action === 'Register'}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:140px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -278,13 +278,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render Start Icon -->
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
@ -303,13 +303,13 @@
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -327,13 +327,13 @@
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null,
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null,
|
||||
'text-numb': movement.toOther === 'Faulty' || movement.toOther === 'Calibration' || movement.toOther === 'Repair',
|
||||
'text-weird': movement.action === 'Register'}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:140px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' :
|
||||
( movement.toStation !== null ? 'Change' :
|
||||
( movement.lastStation !== null ? 'Change' :
|
||||
( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther :
|
||||
( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
</h3>
|
||||
@ -384,13 +384,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render Start Icon -->
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
@ -409,13 +409,13 @@
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -458,12 +458,12 @@
|
||||
<strong>Latest Movement</strong>
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null,
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null,
|
||||
'text-numb': movement.toOther === 'Faulty' || movement.toOther === 'Calibration' || movement.toOther === 'Repair',
|
||||
'text-weird': movement.action === 'Register'}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:140px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -506,13 +506,13 @@
|
||||
<div v-show="detailsVisible[movement.id]" class="col-md-12 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<i class="fas fa-arrow-right fa-2x"></i>
|
||||
@ -529,13 +529,13 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -552,12 +552,12 @@
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null,
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null,
|
||||
'text-numb': movement.toOther === 'Faulty' || movement.toOther === 'Calibration' || movement.toOther === 'Repair',
|
||||
'text-weird': movement.action === 'Register'}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:140px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -606,9 +606,9 @@
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
@ -627,13 +627,13 @@
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -741,7 +741,7 @@
|
||||
selectedCompany: "",
|
||||
selectedDepartment: "",
|
||||
selectedTeamType: "",
|
||||
selectedtoStation: "",
|
||||
selectedlastStation: "",
|
||||
consignmentNoteUrl: "",
|
||||
assignStationDatatable: null,
|
||||
showItemModal: false,
|
||||
@ -844,7 +844,7 @@
|
||||
|
||||
if (movements.length > 0) {
|
||||
let latestMovement = movements[0];
|
||||
let station = latestMovement.lastStationName || latestMovement.toStationName || "Not Assigned";
|
||||
let station = latestMovement.toStationName || latestMovement.lastStationName || "Not Assigned";
|
||||
|
||||
if (!groupedByStation[station]) { groupedByStation[station] = {}; }
|
||||
|
||||
@ -963,13 +963,13 @@
|
||||
"columns": [
|
||||
{ title: "Unique Id", data: "id" },
|
||||
{ title: "Product Code", data: "uniqueID" },
|
||||
{ title: "From User", data: "toUserName" },
|
||||
{ title: "Last User", data: "lastUserName" },
|
||||
{ title: "From User", data: "lastUserName" },
|
||||
{ title: "Last User", data: "toUserName" },
|
||||
{ title: "Completion", data: "movementComplete", render: function (data) {return data ? "Completed" : "Pending";}},
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "Last Station", data: "lastStationName" },
|
||||
{ title: "From Store", data: "toStoreName" },
|
||||
{ title: "Last Store", data: "lastStoreName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "Last Station", data: "toStationName" },
|
||||
{ title: "From Store", data: "lastStoreName" },
|
||||
{ title: "Last Store", data: "toStoreName" },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Start Status", data: "toOther" },
|
||||
{ title: "Latest Status", data: "latestStatus" },
|
||||
@ -1063,10 +1063,10 @@
|
||||
} else {
|
||||
const data = await response.json();
|
||||
this.items = data.filter(item =>
|
||||
item.toUser === this.currentUser.id ||
|
||||
item.lastUser === this.currentUser.id ||
|
||||
item.toStore === this.currentUser.store ||
|
||||
item.lastStore === this.currentUser.store
|
||||
item.toUser === this.currentUser.id ||
|
||||
item.lastStore === this.currentUser.store ||
|
||||
item.toStore === this.currentUser.store
|
||||
);
|
||||
|
||||
this.initAllTables();
|
||||
@ -1163,10 +1163,10 @@
|
||||
{ title: "Product Code", data: "uniqueID" },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Send Date", data: "sendDate" , render: this.formatDate.bind(this)},
|
||||
{ title: "From User", data: "toUserName" },
|
||||
{ title: "Last User", data: "lastUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "From Store", data: "toStoreName" },
|
||||
{ title: "From User", data: "lastUserName" },
|
||||
{ title: "Last User", data: "toUserName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "From Store", data: "lastStoreName" },
|
||||
{ title: "Start Status", data: "toOther" },
|
||||
{ title: "Product Category", data: "productCategory" },
|
||||
{ title: "Qty", data: "quantity" },
|
||||
@ -1186,12 +1186,12 @@
|
||||
{ title: "Send Date", data: "sendDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Receive Date", data: "receiveDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "From User", data: "toUserName" },
|
||||
{ title: "Last User", data: "lastUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "Last Station", data: "lastStationName" },
|
||||
{ title: "From Store", data: "toStoreName" },
|
||||
{ title: "Last Store", data: "lastStoreName" },
|
||||
{ title: "From User", data: "lastUserName" },
|
||||
{ title: "Last User", data: "toUserName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "Last Station", data: "toStationName" },
|
||||
{ title: "From Store", data: "lastStoreName" },
|
||||
{ title: "Last Store", data: "toStoreName" },
|
||||
{ title: "Start Status", data: "toOther" },
|
||||
{ title: "Latest Status", data: "latestStatus" },
|
||||
{ title: "Product Category", data: "productCategory" },
|
||||
@ -1210,9 +1210,9 @@
|
||||
{ title: "Product Code", data: "uniqueID" },
|
||||
{ title: "Assign Date", data: "sendDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Station User PIC", data: "toUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "Last Station", data: "lastStationName" },
|
||||
{ title: "Station User PIC", data: "lastUserName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "Last Station", data: "toStationName" },
|
||||
{ title: "Qty", data: "quantity" },
|
||||
{ title: "Note", data: "consignmentNote", render: renderFile },
|
||||
{ title: "Remark", data: "remark" },
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
<i class="fas fa-user me-2 text-secondary"></i>User:
|
||||
</span>
|
||||
<span class="text-muted text-end" style="max-width: 70%; word-wrap: break-word;">
|
||||
{{ thisItem.toUserName }}
|
||||
{{ thisItem.lastUserName }}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
@ -116,14 +116,14 @@
|
||||
<span class="fw-bold">
|
||||
<i class="mdi mdi-factory me-2 text-secondary"></i>Store:
|
||||
</span>
|
||||
<span class="text-muted">{{ thisItem.toStoreName }}</span>
|
||||
<span class="text-muted">{{ thisItem.lastStoreName }}</span>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span class="fw-bold">
|
||||
<i class="fas fa-map-marker-alt me-2 text-secondary"></i>Station:
|
||||
</span>
|
||||
<span class="text-muted">{{ thisItem.toStationName || 'N/A' }}</span>
|
||||
<span class="text-muted">{{ thisItem.lastStationName || 'N/A' }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
@* Inv Master Receive Item *@
|
||||
<div v-if="itemlateststatus == 'On Delivery' && this.thisItem.lastUser == this.currentUser.id">
|
||||
<div v-if="itemlateststatus == 'On Delivery' && this.thisItem.toUser == this.currentUser.id">
|
||||
<h2 class="register-heading">Receive Item</h2>
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6 offset-sm-3">
|
||||
@ -165,7 +165,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="itemlateststatus == 'On Delivery' && this.thisItem.toUser == this.currentUser.id">
|
||||
<div v-if="itemlateststatus == 'On Delivery' && this.thisItem.lastUser == this.currentUser.id">
|
||||
<h3 class="register-heading">Cancel Item Movement</h3>
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6 offset-sm-3">
|
||||
@ -185,7 +185,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="itemlateststatus == 'On Delivery' && thisItem.lastStore == currentUser.store">
|
||||
<div v-if="itemlateststatus == 'On Delivery' && thisItem.toStore == currentUser.store">
|
||||
<h2 class="register-heading">Receive Item</h2>
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6 offset-sm-3">
|
||||
@ -227,7 +227,7 @@
|
||||
</div>
|
||||
|
||||
@* Inv Master Return Item & Deploy to Station*@
|
||||
<div v-if="itemlateststatus == 'Delivered' && thisItem.lastUser == currentUser.id">
|
||||
<div v-if="itemlateststatus == 'Delivered' && thisItem.toUser == currentUser.id">
|
||||
<h2 class="text-center register-heading">Item Actions</h2>
|
||||
<div class="col-sm-12 d-flex justify-content-center mt-3">
|
||||
<button type="button" v-on:click="ReturnMessage" class="btn btn-warning m-2" style="width: 200px; padding: 10px;">
|
||||
@ -256,7 +256,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="itemlateststatus == 'Faulty' && this.itemassignedtouser">
|
||||
@* <div v-if="itemlateststatus == 'Faulty' && this.itemassignedtouser">
|
||||
<h2 class="register-heading">Add Item Movement</h2>
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6 offset-sm-3">
|
||||
@ -268,7 +268,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
<div v-if="itemlateststatus == 'Ready To Deploy' && this.itemassignedtouser">
|
||||
<h2 class="register-heading">Add Item Movement</h2>
|
||||
@ -652,7 +652,7 @@
|
||||
<div class="col-sm-8">
|
||||
<select class="form-select" v-model="selectedStation" required>
|
||||
<option value="" disabled>-- Select Station --</option>
|
||||
<option v-for="station in stationlist" :key="station.stationId" :value="station.stationId">
|
||||
<option v-for="station in filteredStationList" :key="station.stationId" :value="station.stationId">
|
||||
{{ station.stationName }}
|
||||
</option>
|
||||
</select>
|
||||
@ -804,6 +804,19 @@
|
||||
showSerialNumber() {
|
||||
return this.showProduct.category === 'Asset' || this.showProduct.category === 'Part';
|
||||
},
|
||||
filteredStationList() {
|
||||
if (!this.stationlist || !this.currentUser) return [];
|
||||
|
||||
return this.stationlist.filter(station => {
|
||||
// Check 1: Must match User's Department
|
||||
// const isSameDept = station.departmentId === this.selectedDepartment;
|
||||
|
||||
// Check 2: Must match User's ID as the Station PIC
|
||||
const isPIC = station.stationPicID === this.currentUser.id;
|
||||
|
||||
return isPIC;
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// Split Url dapatkan unique ID Je
|
||||
@ -960,11 +973,20 @@
|
||||
const now = new Date();
|
||||
const formData = {
|
||||
|
||||
...(this.selectedAction === 'user' ? { toStore: this.currentUser.store, toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastUser: this.selectedUser, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'station' ? { toStore: this.currentUser.store, toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastStation: this.selectedStation, lastUser: this.selectedStationPIC, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'store' ? { toStore: this.currentUser.store, toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastStore: this.selectedStore, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'supplier' ? { toStore: this.currentUser.store, toUser: this.currentUser.id, toOther: this.selectedOther, SendDate: this.assigndate, Remark: this.remark + '. Item sent to ' + this.selectedSupplier + ' for ' + this.selectedOther, ConsignmentNote: this.document, lastUser: this.currentUser.id, lastStore: this.currentUser.store, MovementComplete: false, } : {}),
|
||||
...(this.selectedAction === 'faulty' ? { toStore: this.currentUser.store, toUser: this.currentUser.id,toOther: 'Faulty', SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(), ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(), Remark: this.remark, ConsignmentNote: this.document, MovementComplete: true, } : {}),
|
||||
...(this.selectedAction === 'user' ? { lastStore: this.currentUser.store, lastUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, toUser: this.selectedUser, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'station' ? {
|
||||
lastStore: this.currentUser.store,
|
||||
lastUser: this.currentUser.id,
|
||||
toOther: 'On Delivery',
|
||||
SendDate: this.assigndate,
|
||||
toStation: this.selectedStation,
|
||||
toUser: this.selectedStationPIC,
|
||||
MovementComplete: false,
|
||||
Remark: this.remark,
|
||||
ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'store' ? { lastStore: this.currentUser.store, lastUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, toStore: this.selectedStore, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'supplier' ? { lastStore: this.currentUser.store, lastUser: this.currentUser.id, toOther: this.selectedOther, SendDate: this.assigndate, Remark: this.remark + '. Item sent to ' + this.selectedSupplier + ' for ' + this.selectedOther, ConsignmentNote: this.document, toUser: this.currentUser.id, toStore: this.currentUser.store, MovementComplete: false, } : {}),
|
||||
...(this.selectedAction === 'faulty' ? { lastStore: this.currentUser.store, lastUser: this.currentUser.id,toOther: 'Faulty', SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(), ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(), Remark: this.remark, ConsignmentNote: this.document, MovementComplete: true, } : {}),
|
||||
|
||||
ItemId: this.thisItem.itemID,
|
||||
Action: 'Stock Out',
|
||||
@ -1012,11 +1034,13 @@
|
||||
// Determine the status based on specific conditions
|
||||
let statusToSave = "";
|
||||
|
||||
// 1. YOUR NEW LOGIC: If it's On Delivery and the current user is the target lastUser, set to Delivered
|
||||
if (this.thisItem.toOther === "On Delivery" && this.thisItem.lastUser == this.currentUser.id) {
|
||||
statusToSave = "Delivered";
|
||||
}
|
||||
// 2. KEEP EXISTING LOGIC: Calibration/Repair/Return/General Delivery goes to Ready to Deploy
|
||||
// If it's On Delivery and the current user/store is the target toUser/toStore, set to Delivered
|
||||
if (this.thisItem.toOther === "On Delivery" &&
|
||||
(this.thisItem.toUser == this.currentUser.id || this.thisItem.toStore == this.currentUser.store))
|
||||
{
|
||||
statusToSave = "Delivered";
|
||||
}
|
||||
// Calibration/Repair/Return/General Delivery goes to Ready to Deploy
|
||||
else if (
|
||||
this.thisItem.toOther === "Return" ||
|
||||
this.thisItem.toOther === "Calibration" ||
|
||||
@ -1025,16 +1049,13 @@
|
||||
) {
|
||||
statusToSave = "Ready To Deploy";
|
||||
}
|
||||
// 3. KEEP EXISTING LOGIC: Store-to-Store delivery check
|
||||
else if (this.itemlateststatus == 'On Delivery' && this.thisItem.lastStore == this.currentUser.store) {
|
||||
statusToSave = "Delivered";
|
||||
}
|
||||
|
||||
const formData = {
|
||||
Id: this.thisItem.movementId,
|
||||
ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Remark: this.thisItem.remark,
|
||||
LastUser: this.thisItem.lastuser == null ? this.currentUser.id : this.thisItem.lastuser,
|
||||
ToUser: this.thisItem.touser == null ? this.currentUser.id : this.thisItem.touser,
|
||||
ToStore: this.currentUser.store,
|
||||
LatestStatus: statusToSave // Uses the prioritized status from above
|
||||
};
|
||||
|
||||
@ -1075,11 +1096,12 @@
|
||||
|
||||
this.itemlateststatus = this.thisItem.latestStatus ? this.thisItem.latestStatus : this.thisItem.toOther;
|
||||
this.itemassignedtouser = (
|
||||
(this.thisItem.toStore === this.currentUser.store || this.thisItem.lastStore === this.currentUser.store)
|
||||
&& this.currentUser.store != null
|
||||
this.thisItem.departmentId === this.selectedDepartment &&
|
||||
this.selectedDepartment != null &&
|
||||
this.selectedDepartment !== ""
|
||||
);
|
||||
// Debugging logs to help you verify in the browser console
|
||||
console.log('Item Store ID:', this.thisItem.toStore);
|
||||
console.log('Item Store ID:', this.thisItem.lastStore);
|
||||
console.log('User Master Store ID:', this.currentUser.store);
|
||||
console.log('Is User Authorized Master for this item?', this.itemassignedtouser);
|
||||
|
||||
@ -1151,16 +1173,16 @@
|
||||
// Second Movement: Re-registration/Re-stock Record
|
||||
const registrationMovementData = {
|
||||
ItemId: this.thisItem.itemID,
|
||||
ToStore: this.currentUser.store,
|
||||
ToUser: this.currentUser.id,
|
||||
LastStore: this.currentUser.store,
|
||||
LastUser: this.currentUser.id,
|
||||
ToOther: null,
|
||||
sendDate: null,
|
||||
Action: 'Register',
|
||||
Quantity: this.thisItem.movementQuantity,
|
||||
Remark: null,
|
||||
ConsignmentNote: null,
|
||||
LastUser: this.currentUser.id,
|
||||
LastStore: this.currentUser.store,
|
||||
ToUser: this.currentUser.id,
|
||||
ToStore: this.currentUser.store,
|
||||
LatestStatus: 'Ready To Deploy',
|
||||
receiveDate: null,
|
||||
MovementComplete: true,
|
||||
@ -1320,20 +1342,39 @@
|
||||
|
||||
const now = new Date();
|
||||
const formData = {
|
||||
ItemId: this.thisItem.itemID,
|
||||
ToStore: this.thisItem.toStore,
|
||||
ToUser: this.thisItem.toUser, // This will be handled by the API logic
|
||||
ToOther: "Return",
|
||||
SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Action: "StockIn",
|
||||
Quantity: this.thisItem.quantity || 1,
|
||||
Remark: this.remark + " (Returned)",
|
||||
ConsignmentNote: this.document, // The base64 string from handleFileUpload
|
||||
Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
LastUser: this.currentUser.id,
|
||||
LastStore: this.thisItem.toStore,
|
||||
LatestStatus: null,
|
||||
MovementComplete: false
|
||||
// ItemId: this.thisItem.itemID,
|
||||
// LastStore: this.thisItem.lastStore,
|
||||
// LastUser: this.thisItem.lastUser, This will be handled by the API logic
|
||||
// ToOther: "Return",
|
||||
// SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
// Action: "StockIn",
|
||||
// Quantity: this.thisItem.quantity || 1,
|
||||
// Remark: this.remark + " (Returned)",
|
||||
// ConsignmentNote: this.document, The base64 string from handleFileUpload
|
||||
// Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
// ToUser: this.currentUser.id,
|
||||
// ToStore: this.thisItem.lastStore,
|
||||
// LatestStatus: null,
|
||||
// MovementComplete: false
|
||||
|
||||
ItemId: this.thisItem.itemID,
|
||||
LastStation: this.thisItem.currentStationId,
|
||||
LastStore: this.thisItem.currentStoreId,
|
||||
LastUser: this.currentUser.id,
|
||||
ToOther: "Return",
|
||||
SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Action: "StockIn",
|
||||
// Quantity: this.thisItem.quantity,
|
||||
Quantity: this.thisItem.movementQuantity || 1,
|
||||
Remark: this.remark,
|
||||
ConsignmentNote: this.consignmentNote,
|
||||
Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
ToUser: this.thisItem.lastUser,
|
||||
ToStore: this.thisItem.lastStore,
|
||||
// ToStation: this.thisItem.lastStation,
|
||||
LatestStatus: null,
|
||||
ReceiveDate: null,
|
||||
MovementComplete: false,
|
||||
};
|
||||
|
||||
try {
|
||||
@ -1373,9 +1414,9 @@
|
||||
const now = new Date();
|
||||
const formData = {
|
||||
ItemId: this.thisItem.itemID,
|
||||
ToStation: this.thisItem.ToStation,
|
||||
ToStore: this.thisItem.toStore,
|
||||
ToUser: this.currentUser.id,
|
||||
LastStation: this.thisItem.lastStation || this.thisItem.currentStationId || null,
|
||||
LastStore: this.currentUser.store,
|
||||
LastUser: this.currentUser.id,
|
||||
ToOther: "Delivered",
|
||||
SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Action: "Assign",
|
||||
@ -1383,9 +1424,9 @@
|
||||
Remark: this.remark || "Deployed to station",
|
||||
ConsignmentNote: this.document, // Base64 from file upload
|
||||
Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
LastUser: this.currentUser.id,
|
||||
LastStore: this.thisItem.toStore,
|
||||
LastStation: this.selectedStation, // The new station ID selected in modal
|
||||
ToUser: this.currentUser.id,
|
||||
ToStore: this.currentUser.store,
|
||||
ToStation: this.selectedStation, // The new station ID selected in modal
|
||||
LatestStatus: "Delivered",
|
||||
receiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
MovementComplete: true
|
||||
|
||||
@ -172,10 +172,10 @@
|
||||
<strong>Latest Movement</strong>
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null}"
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : 'Assign')) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : 'Assign')) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -220,13 +220,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render Start Icon -->
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
@ -245,13 +245,13 @@
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -267,10 +267,10 @@
|
||||
<div v-for="(movement, i) in group.movements.slice(1)" :key="i" class="row mt-2">
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null}"
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : 'Assign')) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : 'Assign')) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -314,13 +314,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render Start Icon -->
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
@ -339,13 +339,13 @@
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -388,10 +388,10 @@
|
||||
<strong>Latest Movement</strong>
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null}"
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : 'Assign')) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : 'Assign')) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -434,13 +434,13 @@
|
||||
<div v-show="detailsVisible[movement.id]" class="col-md-12 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<i class="fas fa-arrow-right fa-2x"></i>
|
||||
@ -457,13 +457,13 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -480,10 +480,10 @@
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther === 'Return',
|
||||
'text-success': movement.toStation !== null, 'text-info': movement.action === 'Assign' && movement.toStation === null}"
|
||||
'text-success': movement.lastStation !== null, 'text-info': movement.action === 'Assign' && movement.lastStation === null}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : 'Assign')) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.lastStation !== null ? 'Change' : 'Assign')) }}
|
||||
|
||||
</h3>
|
||||
|
||||
@ -529,13 +529,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render Start Icon -->
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
@ -554,13 +554,13 @@
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-if="movement.toStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -761,7 +761,7 @@
|
||||
|
||||
if (movements.length > 0) {
|
||||
let latestMovement = movements[0];
|
||||
let station = latestMovement.lastStationName || latestMovement.toStationName || "Self Assigned";
|
||||
let station = latestMovement.toStationName || latestMovement.lastStationName || "Self Assigned";
|
||||
|
||||
if (!groupedByStation[station]) {
|
||||
groupedByStation[station] = {};
|
||||
@ -1037,10 +1037,10 @@
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Send Date", data: "sendDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Start Status", data: "toOther" },
|
||||
{ title: "From User", data: "toUserName" },
|
||||
{ title: "Last User", data: "lastUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "From Store", data: "toStoreName" },
|
||||
{ title: "From User", data: "lastUserName" },
|
||||
{ title: "Last User", data: "toUserName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "From Store", data: "lastStoreName" },
|
||||
{ title: "Quantity", data: "quantity" },
|
||||
{ title: "Note", data: "consignmentNote", render: renderFile },
|
||||
{ title: "Remark", data: "remark" },
|
||||
@ -1055,17 +1055,17 @@
|
||||
{ title: "Unique Id", data: "id" },
|
||||
{ title: "Product Name", data: "productName", render: (data, type, full) => { return `${data} <br> ${renderFile(full.productImage)}`; } },
|
||||
{ title: "Product Code", data: "uniqueID" },
|
||||
{ title: "Send Date", data: "sendDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Receive Date", data: "receiveDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Send Date", data: "sendDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Receive Date", data: "receiveDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Start Status", data: "toOther" },
|
||||
{ title: "Latest Status", data: "latestStatus" },
|
||||
{ title: "From User", data: "toUserName" },
|
||||
{ title: "Last User", data: "lastUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "Last Station", data: "lastStationName" },
|
||||
{ title: "From Store", data: "toStoreName" },
|
||||
{ title: "Last Store", data: "lastStoreName" },
|
||||
{ title: "From User", data: "lastUserName" },
|
||||
{ title: "Last User", data: "toUserName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "Last Station", data: "toStationName" },
|
||||
{ title: "From Store", data: "lastStoreName" },
|
||||
{ title: "Last Store", data: "toStoreName" },
|
||||
{ title: "Qty", data: "quantity" },
|
||||
{ title: "Note", data: "consignmentNote", render: renderFile },
|
||||
{ title: "Remark", data: "remark" },
|
||||
@ -1082,9 +1082,9 @@
|
||||
{ title: "Product Code", data: "uniqueID" },
|
||||
{ title: "Assign Date", data: "sendDate", render: this.formatDate.bind(this) },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Station User PIC", data: "toUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "Last Station", data: "lastStationName" },
|
||||
{ title: "Station User PIC", data: "lastUserName" },
|
||||
{ title: "From Station", data: "lastStationName" },
|
||||
{ title: "Last Station", data: "toStationName" },
|
||||
{ title: "Qty", data: "quantity" },
|
||||
{ title: "Note", data: "consignmentNote", render: renderFile },
|
||||
{ title: "Remark", data: "remark" },
|
||||
|
||||
@ -54,11 +54,11 @@
|
||||
|
||||
</div>
|
||||
<!--RECEIVE OR RETURN INTERFACE -->
|
||||
<div style="text-align: center; margin: 20px 0;" v-if="displayStatus === 'arrived' && thisItem.currentStationId != null">
|
||||
<div style="text-align: center; margin: 20px 0;" v-if="displayStatus === 'arrived' && thisItem?.currentStationId != null">
|
||||
<h2>Item Receive Information :</h2>
|
||||
<h3>Station Assign</h3>
|
||||
</div>
|
||||
<div style="text-align: center; margin: 20px 0;" v-if="displayStatus === 'arrived' && thisItem.currentStationId == null">
|
||||
<div style="text-align: center; margin: 20px 0;" v-if="displayStatus === 'arrived' && thisItem?.currentStationId == null">
|
||||
<h2>Item Receive Information :</h2>
|
||||
<h3>Self Assign</h3>
|
||||
</div>
|
||||
@ -220,7 +220,9 @@
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-8 offset-sm-5">
|
||||
<button type="submit" v-on:click="ReturnMessage" class="btn btn-primary m-1">Return Item</button>
|
||||
<button type="submit" v-on:click="StationMessage" class="btn btn-primary m-1">{{ thisItem?.currentStationId == null ? "Deploy Station" : "Change Station" }}</button>
|
||||
<button type="submit" v-on:click="StationMessage" class="btn btn-primary m-1">
|
||||
{{ (thisItem?.currentStationId || thisItem?.toStationId) ? "Change Station" : "Deploy Station" }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -236,7 +238,9 @@
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="stationModalLabel">{{ thisItem?.currentStationId == null ? "Deploy Station" : "Change Station" }}</h5>
|
||||
<h5 class="modal-title" id="stationModalLabel">
|
||||
{{ (thisItem?.currentStationId || thisItem?.toStationId) ? "Change Station" : "Deploy Station" }}
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" v-on:click="closeStationMessageModal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@ -446,9 +450,9 @@
|
||||
const now = new Date();
|
||||
const formData = {
|
||||
ItemId: this.thisItem.itemID,
|
||||
ToStation: this.thisItem.currentStationId,
|
||||
ToStore: this.thisItem.toStore,
|
||||
ToUser: this.currentUserId,
|
||||
LastStation: this.thisItem.currentStationId,
|
||||
LastStore: this.thisItem.lastStore,
|
||||
LastUser: this.currentUserId,
|
||||
ToOther: "Delivered",
|
||||
SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Action: "Assign",
|
||||
@ -456,9 +460,9 @@
|
||||
Remark: this.remark,
|
||||
ConsignmentNote: this.consignmentNote,
|
||||
Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
LastUser: this.currentUserId,
|
||||
LastStore: this.thisItem.toStore,
|
||||
LastStation: this.selectedStation,
|
||||
ToUser: this.currentUserId,
|
||||
ToStore: this.thisItem.lastStore,
|
||||
ToStation: this.selectedStation,
|
||||
LatestStatus: "Delivered",
|
||||
ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
MovementComplete: true,
|
||||
@ -499,7 +503,7 @@
|
||||
const now = new Date();
|
||||
const formData = {
|
||||
Id: this.thisItem.id,
|
||||
LastStore: this.thisItem.toStore,
|
||||
ToStore: this.thisItem.lastStore,
|
||||
LatestStatus: "Delivered",
|
||||
ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
MovementComplete: true,
|
||||
@ -542,9 +546,9 @@
|
||||
const now = new Date();
|
||||
const formData = {
|
||||
ItemId: this.thisItem.itemID,
|
||||
ToStation: this.thisItem.currentStationId,
|
||||
ToStore: this.thisItem.currentStoreId,
|
||||
ToUser: this.currentUserId,
|
||||
LastStation: this.thisItem.currentStationId,
|
||||
LastStore: this.thisItem.currentStoreId,
|
||||
LastUser: this.currentUserId,
|
||||
ToOther: "Return",
|
||||
SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Action: "StockIn",
|
||||
@ -553,9 +557,9 @@
|
||||
Remark: this.remark,
|
||||
ConsignmentNote: this.consignmentNote,
|
||||
Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
LastUser: this.InventoryMasterId,
|
||||
LastStore: this.thisItem.toStore,
|
||||
LastStation: this.thisItem.toStation,
|
||||
ToUser: this.InventoryMasterId,
|
||||
ToStore: this.thisItem.lastStore,
|
||||
ToStation: this.thisItem.lastStation,
|
||||
LatestStatus: null,
|
||||
ReceiveDate: null,
|
||||
MovementComplete: false,
|
||||
@ -588,21 +592,42 @@
|
||||
try {
|
||||
const response = await fetch('/InvMainAPI/GetItem/' + itemid, {
|
||||
method: 'POST',
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
|
||||
this.thisItem = await response.json();
|
||||
this.fetchStore(this.thisItem.toStore);
|
||||
// this.fetchStore(this.thisItem.lastStore);
|
||||
|
||||
console.log("Current Station ID:", this.thisItem.currentStationId);
|
||||
console.log("To Station ID:", this.thisItem.toStationId);
|
||||
|
||||
// 1. ARRIVED/RECEIVE LOGIC: Check if YOU are the "ToUser"
|
||||
if (this.thisItem.movementId != null &&
|
||||
this.thisItem.toOther === "On Delivery" &&
|
||||
this.thisItem.latestStatus == null &&
|
||||
this.thisItem.toUser == this.currentUserId && // Check ToUser, not LastUser/CurrentUserId
|
||||
this.thisItem.movementComplete == 0) {
|
||||
|
||||
if (this.thisItem.movementId != null && this.thisItem.toOther === "On Delivery" && this.thisItem.latestStatus == null && this.thisItem.currentUserId == this.currentUserId && this.thisItem.movementComplete == 0) {
|
||||
this.displayStatus = "arrived";
|
||||
} else if (this.thisItem.movementId != null && this.thisItem.latestStatus != null && this.thisItem.currentUserId == this.currentUserId && this.thisItem.latestStatus != "Ready To Deploy") {
|
||||
|
||||
// 2. RETURN/OWNED LOGIC: Check if YOU currently hold the item
|
||||
} else if (this.thisItem.movementId != null &&
|
||||
this.thisItem.latestStatus != null &&
|
||||
this.thisItem.toUser == this.currentUserId &&
|
||||
this.thisItem.latestStatus != "Ready To Deploy") {
|
||||
|
||||
this.displayStatus = "return";
|
||||
} else if (this.thisItem.movementId != null && this.thisItem.toOther === "Return" && this.thisItem.latestStatus == null && this.thisItem.toUser == this.currentUserId) {
|
||||
|
||||
// 3. REQUEST AGAIN LOGIC
|
||||
} else if (this.thisItem.movementId != null &&
|
||||
this.thisItem.toOther === "Return" &&
|
||||
this.thisItem.latestStatus == null &&
|
||||
this.thisItem.lastUser == this.currentUserId) {
|
||||
|
||||
this.displayStatus = "requestAgain";
|
||||
|
||||
} else {
|
||||
// FALLBACK: If none of the above matches, it means someone else is the ToUser
|
||||
this.displayStatus = "differentUser";
|
||||
this.thisItem = null;
|
||||
}
|
||||
|
||||
@ -85,15 +85,13 @@
|
||||
<div class="tab-content">
|
||||
@* Overview *@
|
||||
<div v-if="activeTab === 'overview'" class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="card bg-light">
|
||||
<div class="col-md-4">
|
||||
<div class="card bg-light mb-3">
|
||||
<div class="card-body text-center">
|
||||
<h6>Total Products Registered</h6>
|
||||
<h3>{{ reportData.itemCountRegistered }}</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card bg-success text-white">
|
||||
<div class="card-body text-center">
|
||||
<h6>Items Still In Stock</h6>
|
||||
@ -101,10 +99,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Chart Section *@
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<canvas id="inventoryChart" style="max-height: 250px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Stock Receive *@
|
||||
<div v-if="activeTab === 'stockReceive'">
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-white">
|
||||
<h5 class="card-title mb-0">Total Receiving Cost by Category (RM)</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<canvas id="stockReceiveChart" style="max-height: 300px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Stock Receive Listing</h5>
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead class="table-primary">
|
||||
@ -245,6 +265,7 @@
|
||||
@{
|
||||
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
||||
}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
app.mount('#invAdmin');
|
||||
@ -277,7 +298,9 @@
|
||||
selectedMonth: [],
|
||||
selectedDepartment: [],
|
||||
selectedItem: [],
|
||||
selectedCategory: []
|
||||
selectedCategory: [],
|
||||
chartInstance: null,
|
||||
receiveChartInstance: null,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -286,6 +309,15 @@
|
||||
this.fetchDepartmentsCompaniesList();
|
||||
},
|
||||
watch: {
|
||||
activeTab(val) {
|
||||
if (val === 'overview') {
|
||||
this.$nextTick(() => this.initChart());
|
||||
}
|
||||
// Add this condition
|
||||
if (val === 'stockReceive') {
|
||||
this.$nextTick(() => this.initStockReceiveChart());
|
||||
}
|
||||
},
|
||||
isMonthMode() {
|
||||
this.selectedDate = null; // Reset date when switching modes
|
||||
},
|
||||
@ -359,11 +391,106 @@
|
||||
|
||||
if (response.ok) {
|
||||
this.reportData = await response.json();
|
||||
|
||||
// Initialize chart after data is loaded and DOM updated
|
||||
if (this.activeTab === 'overview') {
|
||||
this.$nextTick(() => this.initChart());
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fetch Error:', error);
|
||||
}
|
||||
},
|
||||
initChart() {
|
||||
const ctx = document.getElementById('inventoryChart');
|
||||
if (!ctx) return;
|
||||
|
||||
// Destroy previous chart instance if it exists
|
||||
if (this.chartInstance) {
|
||||
this.chartInstance.destroy();
|
||||
}
|
||||
|
||||
const available = this.reportData.itemCountStillInStock;
|
||||
const total = this.reportData.itemCountRegistered;
|
||||
const stockOut = total - available;
|
||||
|
||||
this.chartInstance = new Chart(ctx, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
labels: ['In Stock', 'Stock Out'],
|
||||
datasets: [{
|
||||
data: [available, stockOut > 0 ? stockOut : 0],
|
||||
backgroundColor: ['#28a745', '#dc3545'],
|
||||
hoverOffset: 4
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: { position: 'bottom' },
|
||||
title: { display: true, text: 'Inventory Status' }
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
initStockReceiveChart() {
|
||||
const ctx = document.getElementById('stockReceiveChart');
|
||||
if (!ctx || !this.reportData.receivedItems) return;
|
||||
|
||||
// Destroy previous instance to prevent overlapping
|
||||
if (this.receiveChartInstance) {
|
||||
this.receiveChartInstance.destroy();
|
||||
}
|
||||
|
||||
// 1. Process Data: Group by Category and Sum (Quantity * Price)
|
||||
const summary = {};
|
||||
this.reportData.receivedItems.forEach(item => {
|
||||
const cat = item.category || 'Uncategorized';
|
||||
const total = item.quantity * item.convertPrice;
|
||||
summary[cat] = (summary[cat] || 0) + total;
|
||||
});
|
||||
|
||||
const labels = Object.keys(summary);
|
||||
const dataValues = Object.values(summary);
|
||||
|
||||
// 2. Create the Bar Chart
|
||||
this.receiveChartInstance = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Total RM',
|
||||
data: dataValues,
|
||||
backgroundColor: '#4e73df',
|
||||
borderColor: '#4e73df',
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: function(context) {
|
||||
return 'Total: RM ' + context.parsed.y.toLocaleString(undefined, {minimumFractionDigits: 2});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
ticks: {
|
||||
callback: function(value) { return 'RM ' + value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
async fetchDepartmentsCompaniesList(){
|
||||
try {
|
||||
const response = await fetch(`/AdminAPI/GetDepartmentWithCompanyList/`, {
|
||||
|
||||
@ -528,9 +528,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
item.Product!.ProductName,
|
||||
item.Product!.ProductShortName,
|
||||
item.Product!.Category,
|
||||
FromUser = item.Movement?.ToUser,
|
||||
FromStore = item.Movement?.ToStore,
|
||||
FromStation = item.Movement?.ToStation,
|
||||
FromUser = item.Movement?.LastUser,
|
||||
FromStore = item.Movement?.LastStore,
|
||||
FromStation = item.Movement?.LastStation,
|
||||
CurrentUser = item.Movement?.FromUser?.UserName,
|
||||
CurrentStore = item.Movement?.FromStore?.StoreName,
|
||||
CurrentStation = item.Movement?.FromStation?.StationName,
|
||||
@ -570,14 +570,20 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
var product = await _centralDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
|
||||
var inventoryMaster = await _centralDbContext.InventoryMasters.Include("User").FirstOrDefaultAsync(i => i.UserId == item.CreatedByUserId) ?? new InventoryMasterModel { UserId = item.CreatedByUserId };
|
||||
|
||||
// --- NEW LOGIC FOR DEPT CODE ---
|
||||
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||
string? deptCode = companyDepartment!.DepartmentCode?.ToString();
|
||||
|
||||
if (product.Category == "Disposable")
|
||||
{
|
||||
product.QuantityProduct += item.Quantity;
|
||||
UpdateQuantityJson(product, deptCode, item.Quantity); // <--- ADDED
|
||||
item.SerialNumber = null;
|
||||
}
|
||||
else if (product.Category == "Asset" || product.Category == "Part")
|
||||
{
|
||||
product.QuantityProduct = (product.QuantityProduct ?? 0) + 1;
|
||||
UpdateQuantityJson(product, deptCode, 1); // <--- ADDED
|
||||
item.Quantity = 1;
|
||||
}
|
||||
|
||||
@ -594,10 +600,10 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
ItemMovementModel itemMovement = new ItemMovementModel
|
||||
{
|
||||
ItemId = item.ItemID,
|
||||
ToUser = inventoryMaster.UserId,
|
||||
ToStore = inventoryMaster.StoreId,
|
||||
LastStore = inventoryMaster.StoreId,
|
||||
LastUser = inventoryMaster.UserId,
|
||||
LastStore = inventoryMaster.StoreId,
|
||||
ToStore = inventoryMaster.StoreId,
|
||||
ToUser = inventoryMaster.UserId,
|
||||
LatestStatus = "Ready To Deploy",
|
||||
Quantity = item.Quantity,
|
||||
Action = "Register",
|
||||
@ -614,12 +620,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
if (savedItem != null)
|
||||
{
|
||||
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||
// (Existing UniqueID logic kept exactly as provided)
|
||||
var itemProduct = _centralDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
||||
|
||||
string? companyInitial = companyDepartment!.CompanyName?.ToString().Substring(0, 1).ToUpper();
|
||||
string? departmentInitial = companyDepartment!.DepartmentName?.ToString().Substring(0, 1).ToUpper();
|
||||
string? deptCode = companyDepartment!.DepartmentCode?.ToString();
|
||||
char? initialCategory = itemProduct!.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
|
||||
string? productId = itemProduct!.ProductId.ToString("D3");
|
||||
string? itemIdString = item.ItemID.ToString("D5");
|
||||
@ -653,7 +655,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
savedItem.InvoiceDate,
|
||||
savedItem.PartNumber,
|
||||
savedItem.CreatedDate,
|
||||
savedItem.ModifiedDate // This will now be null for new items
|
||||
savedItem.ModifiedDate
|
||||
};
|
||||
return Json(updatedItem);
|
||||
}
|
||||
@ -685,42 +687,65 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
var oldProduct = savedItem.Product;
|
||||
var newProduct = await _centralDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("New Product not found");
|
||||
|
||||
// Quantity adjustment logic based on category changes
|
||||
// --- PREPARE DEPT CODES FOR JSON ---
|
||||
var oldDept = await GetDepartmentWithCompany(savedItem.CompanyId, savedItem.DepartmentId);
|
||||
var newDept = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||
string oldDeptCode = oldDept?.DepartmentCode ?? "UNKNOWN";
|
||||
string newDeptCode = newDept?.DepartmentCode ?? "UNKNOWN";
|
||||
|
||||
// Quantity adjustment logic based on category changes (JSON logic added inside each block)
|
||||
if (oldProduct?.Category == "Disposable" && newProduct.Category == "Disposable")
|
||||
{
|
||||
int quantityDifference = item.Quantity - savedItem.Quantity;
|
||||
newProduct.QuantityProduct += quantityDifference;
|
||||
|
||||
// If changing department but same product
|
||||
if (savedItem.DepartmentId != item.DepartmentId)
|
||||
{
|
||||
UpdateQuantityJson(newProduct, oldDeptCode, -savedItem.Quantity);
|
||||
UpdateQuantityJson(newProduct, newDeptCode, item.Quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateQuantityJson(newProduct, newDeptCode, quantityDifference);
|
||||
}
|
||||
}
|
||||
else if ((oldProduct?.Category == "Asset" || oldProduct?.Category == "Part") && newProduct.Category == "Disposable")
|
||||
{
|
||||
if (oldProduct != null && oldProduct.QuantityProduct > 0)
|
||||
{
|
||||
oldProduct.QuantityProduct = (oldProduct.QuantityProduct ?? 0) - 1;
|
||||
UpdateQuantityJson(oldProduct, oldDeptCode, -1); // <--- ADDED
|
||||
_centralDbContext.Products.Update(oldProduct);
|
||||
}
|
||||
newProduct.QuantityProduct += item.Quantity;
|
||||
UpdateQuantityJson(newProduct, newDeptCode, item.Quantity); // <--- ADDED
|
||||
}
|
||||
else if (oldProduct?.Category == "Disposable" && (newProduct.Category == "Asset" || newProduct.Category == "Part"))
|
||||
{
|
||||
if (oldProduct != null)
|
||||
{
|
||||
oldProduct.QuantityProduct = (oldProduct.QuantityProduct ?? 0) - savedItem.Quantity;
|
||||
UpdateQuantityJson(oldProduct, oldDeptCode, -savedItem.Quantity); // <--- ADDED
|
||||
if (oldProduct.QuantityProduct < 0) oldProduct.QuantityProduct = 0;
|
||||
_centralDbContext.Products.Update(oldProduct);
|
||||
}
|
||||
newProduct.QuantityProduct = (newProduct.QuantityProduct ?? 0) + 1;
|
||||
UpdateQuantityJson(newProduct, newDeptCode, 1); // <--- ADDED
|
||||
item.Quantity = 1;
|
||||
}
|
||||
else if ((oldProduct?.Category == "Asset" || oldProduct?.Category == "Part") && (newProduct.Category == "Asset" || newProduct.Category == "Part"))
|
||||
{
|
||||
if (savedItem.ProductId != item.ProductId)
|
||||
if (savedItem.ProductId != item.ProductId || savedItem.DepartmentId != item.DepartmentId)
|
||||
{
|
||||
if (oldProduct != null && oldProduct.QuantityProduct > 0)
|
||||
{
|
||||
oldProduct.QuantityProduct = (oldProduct.QuantityProduct ?? 0) - 1;
|
||||
UpdateQuantityJson(oldProduct, oldDeptCode, -1); // <--- ADDED
|
||||
_centralDbContext.Products.Update(oldProduct);
|
||||
}
|
||||
newProduct.QuantityProduct = (newProduct.QuantityProduct ?? 0) + 1;
|
||||
UpdateQuantityJson(newProduct, newDeptCode, 1); // <--- ADDED
|
||||
}
|
||||
item.Quantity = 1;
|
||||
}
|
||||
@ -731,7 +756,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
item.SerialNumber = null;
|
||||
}
|
||||
|
||||
// Update savedItem properties from item model
|
||||
// Update savedItem properties (Existing logic kept exactly as provided)
|
||||
savedItem.DefaultPrice = item.DefaultPrice;
|
||||
savedItem.CompanyId = item.CompanyId;
|
||||
savedItem.DepartmentId = item.DepartmentId;
|
||||
@ -753,10 +778,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
savedItem.InvoiceDate = item.InvoiceDate;
|
||||
savedItem.PartNumber = item.PartNumber;
|
||||
|
||||
// Set ModifiedDate when editing an item
|
||||
savedItem.ModifiedDate = DateTime.Now;
|
||||
|
||||
// Re-generate UniqueID based on updated fields (if PartNumber is part of it)
|
||||
var companyDepartment = await GetDepartmentWithCompany(savedItem.CompanyId, savedItem.DepartmentId);
|
||||
string? deptCode = companyDepartment!.DepartmentCode?.ToString();
|
||||
char? initialCategory = newProduct!.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
|
||||
@ -790,8 +813,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
savedItem.EndWDate,
|
||||
savedItem.InvoiceDate,
|
||||
savedItem.PartNumber,
|
||||
savedItem.CreatedDate, // Include in response
|
||||
savedItem.ModifiedDate // Include in response
|
||||
savedItem.CreatedDate,
|
||||
savedItem.ModifiedDate
|
||||
};
|
||||
return Json(updatedItem);
|
||||
}
|
||||
@ -813,25 +836,28 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
var products = _centralDbContext.Products
|
||||
.FirstOrDefault(i => i.ProductId == item.ProductId);
|
||||
|
||||
products.QuantityProduct = products.QuantityProduct - item.Quantity;
|
||||
if (products != null)
|
||||
{
|
||||
// --- ADDED JSON LOGIC ---
|
||||
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||
string? deptCode = companyDepartment?.DepartmentCode?.ToString();
|
||||
|
||||
products.QuantityProduct = products.QuantityProduct - item.Quantity;
|
||||
UpdateQuantityJson(products, deptCode, -item.Quantity); // <--- ADDED
|
||||
|
||||
_centralDbContext.Products.Update(products);
|
||||
}
|
||||
|
||||
// Get related item movements
|
||||
var itemMovements = await _centralDbContext.ItemMovements
|
||||
.Where(i => i.ItemId == item.ItemID)
|
||||
.ToListAsync();
|
||||
|
||||
// Remove all related item movements
|
||||
if (itemMovements.Any())
|
||||
{
|
||||
_centralDbContext.ItemMovements.RemoveRange(itemMovements);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//Handle Rules kalau itemMovement dia xde kat store
|
||||
|
||||
_centralDbContext.Products.Update(products);
|
||||
|
||||
// Remove the item itself
|
||||
_centralDbContext.Items.Remove(item);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
|
||||
@ -839,6 +865,39 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
}
|
||||
|
||||
|
||||
// --- ADDED THIS FUNCTION TO HANDLE JSON DATA ---
|
||||
private void UpdateQuantityJson(ProductModel product, string? deptCode, int amount)
|
||||
{
|
||||
if (string.IsNullOrEmpty(deptCode)) return;
|
||||
|
||||
var quantities = new Dictionary<string, int>();
|
||||
|
||||
if (!string.IsNullOrEmpty(product.QuantityJSON))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Explicitly use System.Text.Json to avoid the ambiguity error
|
||||
quantities = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, int>>(product.QuantityJSON) ?? new Dictionary<string, int>();
|
||||
}
|
||||
catch { quantities = new Dictionary<string, int>(); }
|
||||
}
|
||||
|
||||
if (quantities.ContainsKey(deptCode))
|
||||
{
|
||||
quantities[deptCode] += amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
quantities[deptCode] = amount;
|
||||
}
|
||||
|
||||
// Never allow negative numbers in the JSON
|
||||
if (quantities[deptCode] < 0) quantities[deptCode] = 0;
|
||||
|
||||
product.QuantityJSON = System.Text.Json.JsonSerializer.Serialize(quantities);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("GetItem/{id}")] // Endpoint to retrieve an item by its ID
|
||||
public async Task<IActionResult> GetItem(string id)
|
||||
{
|
||||
@ -900,17 +959,20 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
CurrentStore = item.Movement?.FromStore?.StoreName,
|
||||
CurrentStoreId = item.Movement?.FromStore?.Id,
|
||||
CurrentStation = item.Movement?.FromStation?.StationName,
|
||||
CurrentStationId = item.Movement?.FromStation?.StationId,
|
||||
ToUser = item.Movement?.ToUser,
|
||||
|
||||
CurrentStationId = item.Movement?.ToStation ?? item.Movement?.LastStation,
|
||||
ToStationId = item.Movement?.ToStation,
|
||||
|
||||
LastUser = item.Movement?.LastUser,
|
||||
ToUserName = item.Movement?.NextUser?.UserName,
|
||||
ToStore = item.Movement?.ToStore,
|
||||
LastStore = item.Movement?.LastStore,
|
||||
ToStoreName = item.Movement?.NextStore?.StoreName,
|
||||
ToStation = item.Movement?.ToStation,
|
||||
LastStation = item.Movement?.LastStation,
|
||||
ToStationName = item.Movement?.NextStation?.StationName,
|
||||
item.Movement?.ToOther,
|
||||
item.Movement?.LatestStatus,
|
||||
item.Movement?.LastUser,
|
||||
item.Movement?.LastStore,
|
||||
item.Movement?.ToUser,
|
||||
item.Movement?.ToStore,
|
||||
item.Movement?.MovementComplete,
|
||||
remark = item.Movement?.Remark,
|
||||
QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.UniqueID}", // Generate QR String
|
||||
@ -959,9 +1021,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
i.Id,
|
||||
i.ItemId,
|
||||
i.ToStation,
|
||||
i.ToStore,
|
||||
i.ToUser,
|
||||
i.LastStation,
|
||||
i.LastStore,
|
||||
i.LastUser,
|
||||
UniqueID = i.Item?.UniqueID,
|
||||
ProductName = i.Item?.Product?.ProductName,
|
||||
ProductCategory = i.Item?.Product?.Category,
|
||||
@ -979,9 +1041,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
i.Remark,
|
||||
i.ConsignmentNote,
|
||||
i.Date,
|
||||
i.LastUser,
|
||||
i.LastStore,
|
||||
i.LastStation,
|
||||
i.ToUser,
|
||||
i.ToStore,
|
||||
i.ToStation,
|
||||
i.LatestStatus,
|
||||
i.receiveDate,
|
||||
i.MovementComplete
|
||||
@ -1001,10 +1063,10 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
itemmovement.sendDate = DateTime.Now; // This ensures hours/minutes/seconds are captured
|
||||
itemmovement.Date = DateTime.Now; // Set the general record date as well
|
||||
|
||||
var inventoryMaster = await _centralDbContext.InventoryMasters.Include("User").FirstOrDefaultAsync(i => i.UserId == itemmovement.ToUser);
|
||||
var inventoryMaster = await _centralDbContext.InventoryMasters.Include("User").FirstOrDefaultAsync(i => i.UserId == itemmovement.LastUser);
|
||||
if (inventoryMaster != null)
|
||||
{
|
||||
itemmovement.ToStore = inventoryMaster.StoreId;
|
||||
itemmovement.LastStore = inventoryMaster.StoreId;
|
||||
}
|
||||
|
||||
|
||||
@ -1084,9 +1146,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
itemmovement.Id,
|
||||
itemmovement.ItemId,
|
||||
itemmovement.ToStation,
|
||||
itemmovement.ToStore,
|
||||
itemmovement.ToUser,
|
||||
itemmovement.LastStation,
|
||||
itemmovement.LastStore,
|
||||
itemmovement.LastUser,
|
||||
itemmovement.ToOther,
|
||||
itemmovement.sendDate,
|
||||
itemmovement.Action,
|
||||
@ -1094,9 +1156,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
itemmovement.Remark,
|
||||
itemmovement.ConsignmentNote,
|
||||
itemmovement.Date,
|
||||
itemmovement.LastUser,
|
||||
itemmovement.LastStore,
|
||||
itemmovement.LastStation,
|
||||
itemmovement.ToUser,
|
||||
itemmovement.ToStore,
|
||||
itemmovement.ToStation,
|
||||
itemmovement.LatestStatus,
|
||||
itemmovement.receiveDate,
|
||||
itemmovement.MovementComplete
|
||||
@ -1122,7 +1184,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
return NotFound("Item movement record not found.");
|
||||
}
|
||||
|
||||
updatedList.LastUser = receiveMovement.LastUser;
|
||||
updatedList.ToUser = receiveMovement.ToUser;
|
||||
updatedList.ToStore = receiveMovement.ToStore;
|
||||
updatedList.LatestStatus = receiveMovement.LatestStatus;
|
||||
updatedList.receiveDate = receiveMovement.receiveDate;
|
||||
updatedList.Remark = receiveMovement.Remark;
|
||||
@ -1248,16 +1311,16 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
.Include(i => i.NextStore)
|
||||
.Include(i => i.NextStation)
|
||||
.Include(i => i.NextUser)
|
||||
.Where(i => i.ToUser == user.Id || i.LastUser == user.Id)
|
||||
.Where(i => i.LastUser == user.Id || i.ToUser == user.Id)
|
||||
.ToListAsync();
|
||||
|
||||
return Json(itemMovementUser.Select(i => new
|
||||
{
|
||||
i.Id,
|
||||
i.ItemId,
|
||||
i.ToStation,
|
||||
i.ToStore,
|
||||
i.ToUser,
|
||||
i.LastStation,
|
||||
i.LastStore,
|
||||
i.LastUser,
|
||||
UniqueID = i.Item?.UniqueID,
|
||||
ProductName = i.Item?.Product?.ProductName,
|
||||
ProductImage = i.Item?.Product?.ImageProduct,
|
||||
@ -1274,9 +1337,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
i.Remark,
|
||||
i.ConsignmentNote,
|
||||
i.Date,
|
||||
i.LastUser,
|
||||
i.LastStore,
|
||||
i.LastStation,
|
||||
i.ToUser,
|
||||
i.ToStore,
|
||||
i.ToStation,
|
||||
i.LatestStatus,
|
||||
i.receiveDate,
|
||||
i.MovementComplete
|
||||
@ -1874,7 +1937,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
if (!string.IsNullOrEmpty(returnMovement.ConsignmentNote))
|
||||
{
|
||||
var findUniqueCode = _centralDbContext.Items.Include(i => i.Product).FirstOrDefault(r => r.ItemID == returnMovement.ItemId);
|
||||
var findUniqueUser = _centralDbContext.Users.FirstOrDefault(r => r.Id == returnMovement.ToUser);
|
||||
var findUniqueUser = _centralDbContext.Users.FirstOrDefault(r => r.Id == returnMovement.LastUser);
|
||||
|
||||
var bytes = Convert.FromBase64String(returnMovement.ConsignmentNote);
|
||||
|
||||
@ -1922,9 +1985,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
updateItemIdMovement.Id,
|
||||
updateItemIdMovement.ItemId,
|
||||
updateItemIdMovement.ToStation,
|
||||
updateItemIdMovement.ToStore,
|
||||
updateItemIdMovement.ToUser,
|
||||
updateItemIdMovement.LastStation,
|
||||
updateItemIdMovement.LastStore,
|
||||
updateItemIdMovement.LastUser,
|
||||
updateItemIdMovement.ToOther,
|
||||
updateItemIdMovement.sendDate,
|
||||
updateItemIdMovement.Action,
|
||||
@ -1932,9 +1995,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
updateItemIdMovement.Remark,
|
||||
updateItemIdMovement.ConsignmentNote,
|
||||
updateItemIdMovement.Date,
|
||||
updateItemIdMovement.LastUser,
|
||||
updateItemIdMovement.LastStore,
|
||||
updateItemIdMovement.LastStation,
|
||||
updateItemIdMovement.ToUser,
|
||||
updateItemIdMovement.ToStore,
|
||||
updateItemIdMovement.ToStation,
|
||||
updateItemIdMovement.LatestStatus,
|
||||
updateItemIdMovement.receiveDate,
|
||||
updateItemIdMovement.MovementComplete
|
||||
@ -1960,7 +2023,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
if (!string.IsNullOrEmpty(stationMovement.ConsignmentNote))
|
||||
{
|
||||
var findUniqueCode = _centralDbContext.Items.Include(i => i.Product).FirstOrDefault(r => r.ItemID == stationMovement.ItemId);
|
||||
var findUniqueUser = _centralDbContext.Users.FirstOrDefault(r => r.Id == stationMovement.ToUser);
|
||||
var findUniqueUser = _centralDbContext.Users.FirstOrDefault(r => r.Id == stationMovement.LastUser);
|
||||
|
||||
var bytes = Convert.FromBase64String(stationMovement.ConsignmentNote);
|
||||
string filePath = "";
|
||||
@ -2012,9 +2075,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
updateItemIdMovement.Id,
|
||||
updateItemIdMovement.ItemId,
|
||||
updateItemIdMovement.Item?.UniqueID,
|
||||
updateItemIdMovement.ToStation,
|
||||
updateItemIdMovement.ToStore,
|
||||
updateItemIdMovement.ToUser,
|
||||
updateItemIdMovement.LastStation,
|
||||
updateItemIdMovement.LastStore,
|
||||
updateItemIdMovement.LastUser,
|
||||
updateItemIdMovement.ToOther,
|
||||
updateItemIdMovement.sendDate,
|
||||
updateItemIdMovement.Action,
|
||||
@ -2022,9 +2085,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
updateItemIdMovement.Remark,
|
||||
updateItemIdMovement.ConsignmentNote,
|
||||
updateItemIdMovement.Date,
|
||||
updateItemIdMovement.LastUser,
|
||||
updateItemIdMovement.LastStore,
|
||||
updateItemIdMovement.LastStation,
|
||||
updateItemIdMovement.ToUser,
|
||||
updateItemIdMovement.ToStore,
|
||||
updateItemIdMovement.ToStation,
|
||||
updateItemIdMovement.LatestStatus,
|
||||
updateItemIdMovement.receiveDate,
|
||||
updateItemIdMovement.MovementComplete
|
||||
|
||||
Loading…
Reference in New Issue
Block a user