Added features
This commit is contained in:
@@ -79,11 +79,17 @@ namespace Step.Database.Controllers
|
||||
|
||||
public MaintenanceModel Create(DTONewMaintenanceModel newMaint, int userId)
|
||||
{
|
||||
int counter = 0;
|
||||
|
||||
//fix the maintenance number to 1 (machine Counter)
|
||||
if (newMaint.Type == MAINTENANCE_TYPE.MACHINE_INTERVAL)
|
||||
counter = 1;
|
||||
|
||||
MaintenanceModel dbMaint = new MaintenanceModel()
|
||||
{
|
||||
MaintenanceId = GetUserMaintenanceId(dbCtx.Maintenances),
|
||||
CreationDate = DateTime.Now,
|
||||
CounterId = 0,
|
||||
CounterId = counter,
|
||||
Interval = newMaint.Interval,
|
||||
Deadline = newMaint.Deadline,
|
||||
Description = newMaint.Description,
|
||||
@@ -98,7 +104,6 @@ namespace Step.Database.Controllers
|
||||
dbCtx.Maintenances.Add(dbMaint);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
return dbMaint;
|
||||
}
|
||||
|
||||
|
||||
@@ -595,6 +595,11 @@ namespace Step.NC
|
||||
}
|
||||
}
|
||||
|
||||
if(performed != null && performed.ControlWord == -2)
|
||||
{
|
||||
performed = null;
|
||||
}
|
||||
|
||||
dtoMaintenancesModel.Add(new DTOMaintenanceModel()
|
||||
{
|
||||
Id = currMaintenance.MaintenanceId,
|
||||
|
||||
@@ -53,21 +53,49 @@ namespace Step.Controllers.WebApi
|
||||
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
// Find user id from the bearer token
|
||||
var userId = identity.Claims.FirstOrDefault(c => c.Type == USER_ID_KEY);
|
||||
|
||||
var userId = identity.Claims.FirstOrDefault(c => c.Type == USER_ID_KEY);
|
||||
|
||||
using (MaintenancesController maintenancesController = new MaintenancesController())
|
||||
{
|
||||
MaintenanceModel dbMaint = maintenancesController.Create(newMaint, Convert.ToInt32(userId.Value));
|
||||
|
||||
using (NcAdapter ncAdapter = new NcAdapter())
|
||||
{
|
||||
ncAdapter.Connect();
|
||||
CmsError cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok(maintenance);
|
||||
if(dbMaint.Type == MAINTENANCE_TYPE.MACHINE_INTERVAL)
|
||||
{
|
||||
|
||||
// Update data
|
||||
using (NcAdapter ncAdapter = new NcAdapter())
|
||||
{
|
||||
ncAdapter.Connect();
|
||||
CmsError cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
maintenancesController.Delete(dbMaint);
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
}
|
||||
|
||||
PerformedMaintenanceModel performed = maintenancesController.PerformeMaintenance(maintenance.PlcCounter / 60, dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), -2);
|
||||
if (performed == null)
|
||||
{
|
||||
maintenancesController.Delete(dbMaint);
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(maintenance);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (NcAdapter ncAdapter = new NcAdapter())
|
||||
{
|
||||
ncAdapter.Connect();
|
||||
CmsError cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok(maintenance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,33 +74,38 @@
|
||||
left: 0%;
|
||||
width: 100%;
|
||||
}
|
||||
.estimated-time, .expiring{
|
||||
.estimated-time,.expiring{
|
||||
height: calc(~'96px - 20px');
|
||||
border-radius: 2px;
|
||||
background-color: @color-white2;
|
||||
margin: 20px 0 20px 0;
|
||||
padding: 10px;
|
||||
.title{
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: @color-greyish-brown;
|
||||
}
|
||||
.time{
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
line-height: 0.75px;
|
||||
color: @color-clear-blue;
|
||||
&.yellow{
|
||||
color: @color-squash;
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
justify-content: space-around;
|
||||
.internalExpiring{
|
||||
.title{
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: @color-greyish-brown;
|
||||
}
|
||||
&.red{
|
||||
color: @color-scarlet;
|
||||
.time{
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
line-height: 0.75px;
|
||||
color: @color-clear-blue;
|
||||
&.yellow{
|
||||
color: @color-squash;
|
||||
}
|
||||
&.red{
|
||||
color: @color-scarlet;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.row-wizard{
|
||||
|
||||
@@ -852,8 +852,8 @@
|
||||
margin-top: 17px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.modal.create-maintenance .typology .radiobutton label[for="datefixed"] {
|
||||
margin-right: 209px;
|
||||
.modal.create-maintenance .typology .radiobutton label {
|
||||
width: 220px;
|
||||
}
|
||||
.modal.create-maintenance .typology .radiobutton [type="radio"]:checked,
|
||||
.modal.create-maintenance .typology .radiobutton [type="radio"]:not(:checked) {
|
||||
@@ -1113,6 +1113,9 @@
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
background: url(/assets/icons/_png/carets-up-down-blu-25x25.png) no-repeat 99% 50%;
|
||||
font-family: 'Work Sans', sans-serif;
|
||||
color: #4b4b4b;
|
||||
font-size: 18px;
|
||||
}
|
||||
.modal.info-equipment-box {
|
||||
width: 896px;
|
||||
@@ -18015,17 +18018,20 @@ footer .container button.big:before {
|
||||
background-color: #f1f1f1;
|
||||
margin: 20px 0 20px 0;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
justify-content: space-around;
|
||||
}
|
||||
.maintenance-card .body .box .info .estimated-time .title,
|
||||
.maintenance-card .body .box .info .expiring .title {
|
||||
.maintenance-card .body .box .info .estimated-time .internalExpiring .title,
|
||||
.maintenance-card .body .box .info .expiring .internalExpiring .title {
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #4b4b4b;
|
||||
}
|
||||
.maintenance-card .body .box .info .estimated-time .time,
|
||||
.maintenance-card .body .box .info .expiring .time {
|
||||
.maintenance-card .body .box .info .estimated-time .internalExpiring .time,
|
||||
.maintenance-card .body .box .info .expiring .internalExpiring .time {
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
text-align: center;
|
||||
@@ -18033,12 +18039,12 @@ footer .container button.big:before {
|
||||
line-height: 0.75px;
|
||||
color: #1791ff;
|
||||
}
|
||||
.maintenance-card .body .box .info .estimated-time .time.yellow,
|
||||
.maintenance-card .body .box .info .expiring .time.yellow {
|
||||
.maintenance-card .body .box .info .estimated-time .internalExpiring .time.yellow,
|
||||
.maintenance-card .body .box .info .expiring .internalExpiring .time.yellow {
|
||||
color: #f5a623;
|
||||
}
|
||||
.maintenance-card .body .box .info .estimated-time .time.red,
|
||||
.maintenance-card .body .box .info .expiring .time.red {
|
||||
.maintenance-card .body .box .info .estimated-time .internalExpiring .time.red,
|
||||
.maintenance-card .body .box .info .expiring .internalExpiring .time.red {
|
||||
color: #d0021b;
|
||||
}
|
||||
.maintenance-card .body .box .row-wizard {
|
||||
|
||||
@@ -40,6 +40,10 @@ export default class MaintenanceCard extends Vue {
|
||||
|
||||
@Prop({ default: false })
|
||||
canPerform:boolean;
|
||||
|
||||
@Prop({ default: "" })
|
||||
plcCounter:string;
|
||||
|
||||
// enableModifyNote: {default: true}
|
||||
|
||||
|
||||
|
||||
@@ -25,8 +25,22 @@
|
||||
{{'maintenance_card_created_timestamp' | localize("Manutenzione creata in data %s alle ore %s",convertDate(selectedMaintenance.creationDate),convertDateToTime(selectedMaintenance.creationDate))}}
|
||||
</div>
|
||||
<div class="expiring">
|
||||
<div class="title" v-if="selectedMaintenance.state">{{'maintenance_state_'+selectedMaintenance.state | localize("Stato")}}</div>
|
||||
<div class="time" :class="{'red':this.setRedColor(selectedMaintenance.percentageOfCompletion),'yellow':this.setYellowColor(selectedMaintenance.percentageOfCompletion)}" >{{expiration}}</div>
|
||||
<div class="internalExpiring">
|
||||
<div class="title" v-if="selectedMaintenance.state">
|
||||
{{'maintenance_state_'+selectedMaintenance.state | localize("Stato")}}
|
||||
</div>
|
||||
<div class="time" :class="{'red':this.setRedColor(selectedMaintenance.percentageOfCompletion),'yellow':this.setYellowColor(selectedMaintenance.percentageOfCompletion)}" >
|
||||
{{expiration}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="internalExpiring" v-if="selectedMaintenance && selectedMaintenance.type=='MACHINE_INTERVAL'">
|
||||
<div class="title" v-if="selectedMaintenance.state">
|
||||
{{'maintenance_machine_timer' | localize("Machine timer value")}}
|
||||
</div>
|
||||
<div class="time" >
|
||||
{{plcCounter}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row-wizard">
|
||||
|
||||
@@ -31,7 +31,6 @@ export default class Maintenance extends Vue {
|
||||
get isSCMVisualStyle() {
|
||||
return this.$store.state.machineInfo.isSCMVisualStyle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
get noteMaintenance() {
|
||||
@@ -126,6 +125,10 @@ export default class Maintenance extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public getPlcValue(seconds) {
|
||||
return Math.floor(seconds/60) + "h";
|
||||
}
|
||||
|
||||
public expirationDate(type, missingDays) {
|
||||
|
||||
if (type == "EXP_DATE" || type == "TIME_INTERVAL") {
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
'border-yellow' : selectedMaintenance != null ? setBorderYellowCard(selectedMaintenance.percentageOfCompletion): false}"
|
||||
:can-perform="selectedMaintenance != null ? canPerform(selectedMaintenance.canPerform,selectedMaintenance.type,selectedMaintenance.lastPerformedDate) : false"
|
||||
:expiration="selectedMaintenance != null ? expirationDate(selectedMaintenance.type, selectedMaintenance.missingDays) : ''"
|
||||
:plcCounter="(selectedMaintenance && selectedMaintenance.plcCounter) ? getPlcValue(selectedMaintenance.plcCounter): getPlcValue(0) "
|
||||
:selectedMaintenance="selectedMaintenance ? selectedMaintenance : {}"
|
||||
:note-maintenance="selectedMaintenance ? noteMaintenance : []"
|
||||
:attachments-maintenance="selectedMaintenance ? attachmentsMaintenance : []"
|
||||
|
||||
Reference in New Issue
Block a user