add po status flag to the po edit screen and po online status screen
parent
77887df4ce
commit
9b8d525833
|
@ -27,18 +27,20 @@ public class PurchaseOrderCTPDao {
|
|||
private final String SELECT_BY_PO_CODE = String.format( "SELECT * FROM %s WHERE purchase_order_code = :purchase_order_code", TABLE_NAME );
|
||||
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
|
||||
private final String INSERT_QUERY = String.format(
|
||||
"INSERT INTO %s (id, purchase_order_code, purchase_order_quantity, purchase_order_quantity_required, article_name, created_by, status) " +
|
||||
"VALUES (:id, :purchase_order_code, :purchase_order_quantity, :purchase_order_quantity_required, :article_name, :created_by, :status) " +
|
||||
"INSERT INTO %s (id, purchase_order_code, purchase_order_quantity, purchase_order_quantity_required, article_name, created_by, status, po_status) " +
|
||||
"VALUES (:id, :purchase_order_code, :purchase_order_quantity, :purchase_order_quantity_required, :article_name, :created_by, :status, :po_status) " +
|
||||
"ON DUPLICATE KEY UPDATE " +
|
||||
"purchase_order_code = VALUES(purchase_order_code), " +
|
||||
"purchase_order_quantity = VALUES(purchase_order_quantity), " +
|
||||
"purchase_order_quantity_required = VALUES(purchase_order_quantity_required), " +
|
||||
"article_name = VALUES(article_name), " +
|
||||
"created_by = VALUES(created_by), " +
|
||||
"status = VALUES(status)",
|
||||
"status = VALUES(status)," +
|
||||
"po_status = VALUES(po_status)",
|
||||
TABLE_NAME);
|
||||
|
||||
private final String SELECT_BY_LIMIT = String.format( "SELECT * FROM %s WHERE created_by = :created_by ORDER BY id ASC limit :limit", TABLE_NAME );
|
||||
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE purchase_order_code LIKE :term limit 100 offset 0", TABLE_NAME );
|
||||
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE purchase_order_code LIKE :term AND po_status = false limit 100 offset 0", TABLE_NAME );
|
||||
|
||||
|
||||
// prepare query params
|
||||
|
@ -50,7 +52,8 @@ public class PurchaseOrderCTPDao {
|
|||
.addValue("purchase_order_quantity_required", purchaseOrderCTP.getPurchaseOrderQuantityRequired())
|
||||
.addValue("article_name", purchaseOrderCTP.getArticleName())
|
||||
.addValue("created_by", purchaseOrderCTP.getCreatedBy())
|
||||
.addValue("status", purchaseOrderCTP.getStatus());
|
||||
.addValue("status", purchaseOrderCTP.getStatus())
|
||||
.addValue("po_status", purchaseOrderCTP.getPoStatus());
|
||||
return params;
|
||||
}
|
||||
|
||||
|
@ -96,10 +99,16 @@ public class PurchaseOrderCTPDao {
|
|||
return namedParameterJdbcTemplate.update( DELETE_QUERY, params ) > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* find by query
|
||||
* */
|
||||
public List<PurchaseOrderCTP> findByQuery(String query ){
|
||||
return namedParameterJdbcTemplate.query( query, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
/*
|
||||
* find by created by
|
||||
* */
|
||||
public List<PurchaseOrderCTP> findByUserAndLimit(String createdBy, Long limit ){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("limit", limit.intValue() );
|
||||
|
@ -107,6 +116,9 @@ public class PurchaseOrderCTPDao {
|
|||
return namedParameterJdbcTemplate.query( SELECT_BY_LIMIT, params, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
/*
|
||||
* find by po code
|
||||
* */
|
||||
public List<PurchaseOrderCTP> findByPoCode(String poCode){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("purchase_order_code", poCode);
|
||||
|
|
|
@ -19,6 +19,7 @@ public class PurchaseOrderCTPRowMapper implements RowMapper<PurchaseOrderCTP> {
|
|||
}
|
||||
PurchaseOrderCTP.setCreatedBy(rs.getString("created_by"));
|
||||
PurchaseOrderCTP.setStatus(rs.getString("status"));
|
||||
PurchaseOrderCTP.setPoStatus(rs.getBoolean("po_status"));
|
||||
return PurchaseOrderCTP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class PurchaseOrderCTP {
|
|||
private long purchaseOrderQuantity;
|
||||
private long purchaseOrderQuantityRequired;
|
||||
private String articleName;
|
||||
private boolean poStatus;
|
||||
private String createdBy;
|
||||
private LocalDateTime createdAt;
|
||||
private String status;
|
||||
|
@ -81,4 +82,12 @@ public class PurchaseOrderCTP {
|
|||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public boolean getPoStatus() {
|
||||
return poStatus;
|
||||
}
|
||||
|
||||
public void setPoStatus(boolean poStatus) {
|
||||
this.poStatus = poStatus;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -437,6 +437,9 @@ public class ReportingService {
|
|||
return barChartData;
|
||||
}
|
||||
|
||||
/*
|
||||
* find all po for po-online-status
|
||||
* */
|
||||
public List<POsDetails> getAllPOs(String poCode, String size, String color) {
|
||||
|
||||
List<POsDetails> pOsDetailsList = new ArrayList<>();
|
||||
|
@ -523,13 +526,16 @@ public class ReportingService {
|
|||
pOsDetails.setShippedScan(packagingItems);
|
||||
pOsDetails.setShippedNet(packagingItems);
|
||||
pOsDetails.setPackagingStock(0);
|
||||
pOsDetails.setPoStatus(false);
|
||||
pOsDetails.setPoStatus(pos.getPoStatus());
|
||||
pOsDetailsList.add(pOsDetails);
|
||||
}
|
||||
}
|
||||
return pOsDetailsList;
|
||||
}
|
||||
|
||||
/*
|
||||
* find all job cards of specific po
|
||||
* */
|
||||
public HashMap<String, Map<String, Integer>> getAllPoJobCards(long poId, String selectDate) {
|
||||
String startDate = selectDate != null && !selectDate.isEmpty() ? selectDate + " 00:00:01": null;
|
||||
String endDate = selectDate != null && !selectDate.isEmpty() ? selectDate + " 23:59:59": null;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<div th:replace="_notices :: page-notices"></div>
|
||||
<form th:action="${purchaseOrder.id} != null ? @{/purchase-order/edit/(id=${purchaseOrder.id})} : @{/purchase-order/edit}"
|
||||
method="POST"
|
||||
th:object="${purchaseOrder}"
|
||||
id="jobCardApp">
|
||||
<div class="bg-light p-3 mb-3">
|
||||
<h6 class="mb-3">Info</h6>
|
||||
|
@ -34,6 +33,12 @@
|
|||
<label>Article Name</label>
|
||||
<input type="text" class="form-control" th:field="${purchaseOrder.articleName}" required>
|
||||
</div>
|
||||
<div class="col-sm-1 form-group">
|
||||
<label for="active">Status OPEN/CLOSE</label>
|
||||
<div class="form-check">
|
||||
<input class="custom-control-label:" type="checkbox" id="active" th:field="*{purchaseOrder.poStatus}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<th>Created At</th>
|
||||
<th>Created By</th>
|
||||
<th>Status</th>
|
||||
<th>PO Status</th>
|
||||
<th>Action</th>
|
||||
|
||||
</tr>
|
||||
|
@ -44,6 +45,12 @@
|
|||
<span class="badge font-sm" th:classappend="'badge-' + ${order.status}" th:if="${order.status}" th:text="${order.status}"></span>
|
||||
<span th:unless="${order.status}">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span th:if="${!order.poStatus}" class="badge badge-APPROVED">OPEN</span>
|
||||
<div th:if="${order.poStatus}">
|
||||
<span class="badge badge-danger" >CLOSE</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<th:block >
|
||||
<a th:href="@{'/purchase-order/edit/' + ${order.id}}" class="btn btn-sm btn-secondary" title="Edit">
|
||||
|
|
Loading…
Reference in New Issue