Compare commits
No commits in common. "main" and "add_QRCode" have entirely different histories.
main
...
add_QRCode
|
@ -31,10 +31,5 @@
|
||||||
<option name="name" value="In project repo" />
|
<option name="name" value="In project repo" />
|
||||||
<option name="url" value="file:///D:\Project\cut-to-pack-service/libs" />
|
<option name="url" value="file:///D:\Project\cut-to-pack-service/libs" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="in-project" />
|
|
||||||
<option name="name" value="In project repo" />
|
|
||||||
<option name="url" value="file:///D:\ctp\Project\Cut-to-pack\cut-to-pack-service/libs" />
|
|
||||||
</remote-repository>
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MavenProjectsManager">
|
<component name="MavenProjectsManager">
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -395,7 +395,7 @@
|
||||||
<jvmArguments>-Xms1024m</jvmArguments>
|
<jvmArguments>-Xms1024m</jvmArguments>
|
||||||
<jvmArguments>-Xmx8g</jvmArguments>
|
<jvmArguments>-Xmx8g</jvmArguments>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>9</source><target>9</target></configuration></plugin>
|
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>8</source><target>8</target></configuration></plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -9,6 +9,6 @@ import java.lang.annotation.Target;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||||
@PreAuthorize("hasAnyRole('ROLE_ADMIN')")
|
@PreAuthorize( "hasAnyRole('ROLE_ADMIN')")
|
||||||
public @interface AdminRole {
|
public @interface AdminRole {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.utopiaindustries.auth;
|
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
|
||||||
@PreAuthorize("hasAnyRole('ROLE_INVENTORY_ACCOUNT','ROLE_ADMIN')")
|
|
||||||
public @interface InventoryAccountRole {
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.utopiaindustries.auth;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
|
||||||
@PreAuthorize( "hasAnyRole('ROLE_PURCHASE_ORDER','ROLE_ADMIN')")
|
|
||||||
public @interface PurchaseOrderCTPRole {
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.utopiaindustries.auth;
|
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
|
||||||
@PreAuthorize( "hasAnyRole('ROLE_STORE','ROLE_ADMIN')")
|
|
||||||
public @interface StoreRole {
|
|
||||||
}
|
|
|
@ -35,22 +35,22 @@ public class DataSourceConfiguration {
|
||||||
|
|
||||||
/* COSMOS */
|
/* COSMOS */
|
||||||
|
|
||||||
// @Bean(name = "dataSourceCosmos")
|
@Bean(name = "dataSourceCosmos")
|
||||||
// @ConfigurationProperties(prefix = "spring.cosmosdatasource")
|
@ConfigurationProperties(prefix = "spring.cosmosdatasource")
|
||||||
// public DataSource cosmosDataSource() {
|
public DataSource cosmosDataSource() {
|
||||||
// return DataSourceBuilder.create().build();
|
return DataSourceBuilder.create().build();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Bean(name = "jdbcTemplateCosmos")
|
@Bean(name = "jdbcTemplateCosmos")
|
||||||
// public JdbcTemplate cosmosJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
|
public JdbcTemplate cosmosJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
|
||||||
// return new JdbcTemplate( ds );
|
return new JdbcTemplate( ds );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Bean(name = "namedParameterJdbcTemplateCosmos")
|
@Bean(name = "namedParameterJdbcTemplateCosmos")
|
||||||
// public NamedParameterJdbcTemplate cosmosNamedParameterJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
|
public NamedParameterJdbcTemplate cosmosNamedParameterJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
|
||||||
// return new NamedParameterJdbcTemplate( ds );
|
return new NamedParameterJdbcTemplate( ds );
|
||||||
// }
|
}
|
||||||
|
|
||||||
/* LOCAL */
|
/* LOCAL */
|
||||||
|
|
||||||
|
@ -73,4 +73,6 @@ public class DataSourceConfiguration {
|
||||||
public NamedParameterJdbcTemplate localNamedParameterJdbcTemplate( @Qualifier( "dataSourceLocal" ) DataSource ds ) {
|
public NamedParameterJdbcTemplate localNamedParameterJdbcTemplate( @Qualifier( "dataSourceLocal" ) DataSource ds ) {
|
||||||
return new NamedParameterJdbcTemplate( ds );
|
return new NamedParameterJdbcTemplate( ds );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.csrf().disable()
|
http.csrf().disable()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.antMatchers("/login", "/rest/**","/dashboard/**")
|
.antMatchers("/login", "/rest/**")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.antMatchers("/**")
|
.antMatchers("/**")
|
||||||
.hasAnyRole("USER", "ADMIN")
|
.hasAnyRole("USER", "ADMIN")
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.utopiaindustries.controller;
|
|
||||||
|
|
||||||
import com.utopiaindustries.service.DashboardService;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/dashboard")
|
|
||||||
public class DashboardController {
|
|
||||||
|
|
||||||
private final DashboardService dashboardService;
|
|
||||||
|
|
||||||
public DashboardController(DashboardService dashboardService) {
|
|
||||||
this.dashboardService = dashboardService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{lineNumber}")
|
|
||||||
public String getDashboard(@PathVariable("lineNumber") String lineNumber, Model model) {
|
|
||||||
model.addAttribute("refresh", true);
|
|
||||||
model.addAttribute("phases", dashboardService.getPhasesProgressDayWise(lineNumber));
|
|
||||||
model.addAttribute("date", LocalDate.now());
|
|
||||||
model.addAttribute("day", LocalDate.now().getDayOfWeek());
|
|
||||||
model.addAttribute("detail", dashboardService.getLineDetails(lineNumber) );
|
|
||||||
|
|
||||||
return "dashboard";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@FinishingRole
|
@FinishingRole
|
||||||
@RequestMapping("/finishing")
|
@RequestMapping( "/finishing" )
|
||||||
public class FinishingController {
|
public class FinishingController {
|
||||||
|
|
||||||
private final FinishedItemDAO finishedItemDAO;
|
private final FinishedItemDAO finishedItemDAO;
|
||||||
|
@ -37,26 +37,26 @@ public class FinishingController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String showHome(Model model) {
|
public String showHome(Model model ){
|
||||||
return "redirect:/finishing/finished-items";
|
return "redirect:/finishing/finished-items";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/finished-items")
|
@GetMapping( "/finished-items" )
|
||||||
public String showFinishedItems(@RequestParam(value = "id", required = false) String id,
|
public String showFinishedItems( @RequestParam(value = "id", required = false ) String id,
|
||||||
@RequestParam(value = "item-id", required = false) String itemId,
|
@RequestParam(value = "item-id", required = false ) String itemId,
|
||||||
@RequestParam(value = "sku", required = false) String sku,
|
@RequestParam( value = "sku", required = false ) String sku,
|
||||||
@RequestParam(value = "start-date", required = false) String startDate,
|
@RequestParam( value = "start-date", required = false) String startDate,
|
||||||
@RequestParam(value = "end-date", required = false) String endDate,
|
@RequestParam( value = "end-date", required = false ) String endDate,
|
||||||
@RequestParam(value = "job-card-id", required = false) String jobCardId,
|
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
|
||||||
@RequestParam(value = "count", required = false) Long count,
|
@RequestParam( value = "count", required = false ) Long count,
|
||||||
Model model) {
|
Model model ){
|
||||||
|
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
|
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
||||||
model.addAttribute("startDate", startDate1);
|
model.addAttribute("startDate", startDate1);
|
||||||
model.addAttribute("endDate", endDate1);
|
model.addAttribute("endDate", endDate1);
|
||||||
List<FinishedItem> itemList = bundleService.getFinishedItem(id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId, count);
|
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId ,count );
|
||||||
model.addAttribute("items", itemList);
|
model.addAttribute("items", itemList ) ;
|
||||||
|
|
||||||
return "finishing/finished-item-list";
|
return "finishing/finished-item-list";
|
||||||
}
|
}
|
||||||
|
@ -65,40 +65,41 @@ public class FinishingController {
|
||||||
/*
|
/*
|
||||||
* get finishing inventory accounts
|
* get finishing inventory accounts
|
||||||
* */
|
* */
|
||||||
@GetMapping("/inventory-accounts")
|
@GetMapping( "/inventory-accounts" )
|
||||||
public String getInventoryAccounts(@RequestParam(value = "id", required = false) String id,
|
public String getInventoryAccounts( @RequestParam( value = "id", required = false ) String id,
|
||||||
@RequestParam(value = "title", required = false) String title,
|
@RequestParam( value = "title", required = false) String title,
|
||||||
@RequestParam(value = "active", required = false) String active,
|
@RequestParam( value = "active", required = false ) String active,
|
||||||
@RequestParam(value = "created-by", required = false) String createdBy,
|
@RequestParam( value = "created-by", required = false ) String createdBy,
|
||||||
@RequestParam(value = "start-date", required = false) String startDate,
|
@RequestParam( value = "start-date", required = false ) String startDate,
|
||||||
@RequestParam(value = "end-date", required = false) String endDate,
|
@RequestParam( value = "end-date", required = false ) String endDate,
|
||||||
@RequestParam(value = "site-id", required = false) String siteId,
|
@RequestParam( value = "site-id", required = false ) String siteId,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "100") Long count,
|
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
|
||||||
Model model) {
|
Model model ) {
|
||||||
// 5 for Finishing
|
// 5 for Finishing
|
||||||
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts(id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "5", false));
|
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "5" , false ));
|
||||||
model.addAttribute("locations", locationService.findAll());
|
model.addAttribute("locations", locationService.findAll() );
|
||||||
return "/finishing/inventory-accounts";
|
return "/finishing/inventory-accounts";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("segregate-inventory")
|
@GetMapping( "segregate-inventory" )
|
||||||
public String segregateFinishedItems(Model model) {
|
public String segregateFinishedItems( Model model ){
|
||||||
model.addAttribute("wrapper", new FinishedItemWrapper());
|
model.addAttribute("accounts", inventoryAccountService.findInventoryAccountsForFinishedItems() );
|
||||||
|
model.addAttribute("wrapper", new FinishedItemWrapper() );
|
||||||
return "/finishing/segregate-inventory";
|
return "/finishing/segregate-inventory";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("segregate-inventory")
|
@PostMapping( "segregate-inventory" )
|
||||||
public String segregateFinishItemsInventory(@ModelAttribute FinishedItemWrapper wrapper,
|
public String segregateFinishItemsInventory( @ModelAttribute FinishedItemWrapper wrapper,
|
||||||
RedirectAttributes redirectAttributes,
|
RedirectAttributes redirectAttributes,
|
||||||
Model model) {
|
Model model ){
|
||||||
try {
|
try {
|
||||||
inventoryService.segregateFinishedItems(wrapper, wrapper.getQaStatus());
|
inventoryService.segregateFinishedItems( wrapper );
|
||||||
redirectAttributes.addFlashAttribute("success", "Items Successfully saved !");
|
redirectAttributes.addFlashAttribute("success", "Items Successfully saved !" );
|
||||||
} catch (Exception e) {
|
} catch ( Exception e ){
|
||||||
redirectAttributes.addFlashAttribute("error", e.getMessage());
|
redirectAttributes.addFlashAttribute("error", e.getMessage() );
|
||||||
}
|
}
|
||||||
return "redirect:/finishing/segregate-inventory";
|
return "redirect:/finishing/finished-items";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
package com.utopiaindustries.controller;
|
package com.utopiaindustries.controller;
|
||||||
|
|
||||||
import com.utopiaindustries.auth.InventoryAccountRole;
|
import com.utopiaindustries.auth.AdminRole;
|
||||||
import com.utopiaindustries.model.ctp.InventoryAccount;
|
import com.utopiaindustries.model.ctp.InventoryAccount;
|
||||||
import com.utopiaindustries.service.InventoryAccountService;
|
import com.utopiaindustries.service.InventoryAccountService;
|
||||||
|
import com.utopiaindustries.util.StringUtils;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@InventoryAccountRole
|
@AdminRole
|
||||||
@RequestMapping( "/inventory-accounts" )
|
@RequestMapping( "/inventory-accounts" )
|
||||||
public class InventoryAccountController {
|
public class InventoryAccountController {
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,6 @@ import com.utopiaindustries.service.InventoryAccountService;
|
||||||
import com.utopiaindustries.service.JobCardService;
|
import com.utopiaindustries.service.JobCardService;
|
||||||
import com.utopiaindustries.service.LocationService;
|
import com.utopiaindustries.service.LocationService;
|
||||||
import com.utopiaindustries.util.StringUtils;
|
import com.utopiaindustries.util.StringUtils;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -176,11 +173,6 @@ public class JobCardController {
|
||||||
return "job-card-view";
|
return "job-card-view";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping( value = "/pdf/{id}", produces = MediaType.APPLICATION_PDF_VALUE )
|
|
||||||
public ResponseEntity<InputStreamResource> generateJobCardPdf(@PathVariable long id, Model model ) throws Exception {
|
|
||||||
return jobCardService.getJobCardReceivingPdf(id,model);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
|
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
|
||||||
ArrayList<LocalDate> localDates = new ArrayList<>();
|
ArrayList<LocalDate> localDates = new ArrayList<>();
|
||||||
while (start.isBefore(end)) {
|
while (start.isBefore(end)) {
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package com.utopiaindustries.controller;
|
|
||||||
|
|
||||||
import com.utopiaindustries.auth.PurchaseOrderCTPRole;
|
|
||||||
import com.utopiaindustries.model.ctp.POsDetails;
|
|
||||||
import com.utopiaindustries.service.InventoryAccountService;
|
|
||||||
import com.utopiaindustries.service.PurchaseOrderService;
|
|
||||||
import com.utopiaindustries.service.ReportingService;
|
|
||||||
import com.utopiaindustries.service.SummaryInventoryReportService;
|
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/po-status")
|
|
||||||
@PurchaseOrderCTPRole
|
|
||||||
public class POStatusController {
|
|
||||||
|
|
||||||
private final ReportingService reportingService;
|
|
||||||
private final PurchaseOrderService purchaseOrderService;
|
|
||||||
|
|
||||||
|
|
||||||
public POStatusController(ReportingService reportingService, PurchaseOrderService purchaseOrderService) {
|
|
||||||
this.reportingService = reportingService;
|
|
||||||
this.purchaseOrderService = purchaseOrderService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public String homePage( Model model ){
|
|
||||||
return "redirect:/po-status/all-pos";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( "/all-pos")
|
|
||||||
public String poReport(@RequestParam(value = "poName", required = false) String poName, Model model){
|
|
||||||
|
|
||||||
model.addAttribute("allPOs", reportingService.getAllPOs(poName));
|
|
||||||
return "/reporting/po-report";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( value = "/po-report-view/{poId}" )
|
|
||||||
public String showJobCardDetail(@PathVariable("poId") long poId, @RequestParam(value = "select-date", required = false) String selectDate ,
|
|
||||||
Model model ){
|
|
||||||
model.addAttribute("allJobCard", reportingService.getAllPoJobCards(poId, selectDate));
|
|
||||||
return "/reporting/po-job-card-report";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "/generate-po-pdf", produces = MediaType.APPLICATION_PDF_VALUE)
|
|
||||||
public ResponseEntity<InputStreamResource> sendPoAndReturnPdf(@ModelAttribute POsDetails pOsDetails,
|
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean includeJobCard,
|
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean includeStoreDetails,
|
|
||||||
Model model) throws Exception{
|
|
||||||
return purchaseOrderService.generatePOPdf(pOsDetails, model, includeJobCard, includeStoreDetails);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +1,14 @@
|
||||||
package com.utopiaindustries.controller;
|
package com.utopiaindustries.controller;
|
||||||
|
|
||||||
import com.utopiaindustries.auth.PackagingRole;
|
import com.utopiaindustries.auth.PackagingRole;
|
||||||
import com.utopiaindustries.model.ctp.FinishedItemWrapper;
|
|
||||||
import com.utopiaindustries.service.InventoryAccountService;
|
import com.utopiaindustries.service.InventoryAccountService;
|
||||||
import com.utopiaindustries.service.LocationService;
|
import com.utopiaindustries.service.LocationService;
|
||||||
import com.utopiaindustries.service.PackagingService;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
import com.utopiaindustries.util.StringUtils;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@ -18,40 +17,19 @@ import java.time.LocalDate;
|
||||||
@RequestMapping("/packaging" )
|
@RequestMapping("/packaging" )
|
||||||
public class PackagingController {
|
public class PackagingController {
|
||||||
|
|
||||||
|
|
||||||
private final InventoryAccountService inventoryAccountService;
|
private final InventoryAccountService inventoryAccountService;
|
||||||
private final PackagingService packagingService;
|
|
||||||
private final LocationService locationService;
|
private final LocationService locationService;
|
||||||
|
|
||||||
public PackagingController(InventoryAccountService inventoryAccountService, PackagingService packagingService, LocationService locationService) {
|
public PackagingController(InventoryAccountService inventoryAccountService, LocationService locationService) {
|
||||||
this.inventoryAccountService = inventoryAccountService;
|
this.inventoryAccountService = inventoryAccountService;
|
||||||
this.packagingService = packagingService;
|
|
||||||
this.locationService = locationService;
|
this.locationService = locationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String showHome(Model model ){
|
public String showHome( Model model ){
|
||||||
return "redirect:/packaging/receive-inventory";
|
return "redirect:/packaging/inventory-accounts";
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/receive-inventory")
|
|
||||||
public String packagingItemReceive( Model model ){
|
|
||||||
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(6L));
|
|
||||||
model.addAttribute("wrapper", new FinishedItemWrapper() );
|
|
||||||
return "/packaging/receive-inventory-form";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping( "/packaging-items" )
|
|
||||||
public String packagingItems( @ModelAttribute FinishedItemWrapper wrapper,
|
|
||||||
RedirectAttributes redirectAttributes,
|
|
||||||
Model model ){
|
|
||||||
try {
|
|
||||||
packagingService.createPackagingItem( wrapper );
|
|
||||||
redirectAttributes.addFlashAttribute("success", "Items Successfully received !" );
|
|
||||||
} catch ( Exception e ){
|
|
||||||
redirectAttributes.addFlashAttribute("error", e.getMessage() );
|
|
||||||
}
|
|
||||||
return "redirect:/packaging/receive-inventory";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping( "/inventory-accounts" )
|
@GetMapping( "/inventory-accounts" )
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
package com.utopiaindustries.controller;
|
|
||||||
|
|
||||||
import com.utopiaindustries.auth.PurchaseOrderCTPRole;
|
|
||||||
import com.utopiaindustries.model.ctp.JobCard;
|
|
||||||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
|
||||||
import com.utopiaindustries.service.PurchaseOrderCTPService;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
|
||||||
import org.springframework.security.core.parameters.P;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/purchase-order")
|
|
||||||
@PurchaseOrderCTPRole
|
|
||||||
|
|
||||||
public class PurchaseOrderCTPController {
|
|
||||||
private final PurchaseOrderCTPService purchaseOrderCTPService;
|
|
||||||
|
|
||||||
public PurchaseOrderCTPController(PurchaseOrderCTPService purchaseOrderCTPService) {
|
|
||||||
this.purchaseOrderCTPService = purchaseOrderCTPService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public String showJobCardList( @RequestParam( value = "purchaseOrderCode", required = false ) String purchaseOrderCode,
|
|
||||||
@RequestParam( value = "articleName", required = false ) String articleName,
|
|
||||||
@RequestParam( value = "created-start-date", required = false ) String createdStartDate,
|
|
||||||
@RequestParam( value = "created-end-date", required = false ) String createdEndDate,
|
|
||||||
@RequestParam( value = "limit" , required = false) Long limit,
|
|
||||||
Model model ){
|
|
||||||
|
|
||||||
LocalDate startDate = StringUtils.isNullOrEmpty(createdStartDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(createdStartDate);
|
|
||||||
LocalDate endDate = StringUtils.isNullOrEmpty(createdEndDate) ? LocalDate.now() : LocalDate.parse(createdEndDate);
|
|
||||||
model.addAttribute("purchaseOrder", purchaseOrderCTPService.getAllPurchaseOrderCtp(purchaseOrderCode, articleName, startDate.toString(), endDate.toString(), limit) );
|
|
||||||
model.addAttribute("startDate", startDate);
|
|
||||||
model.addAttribute("endDate", endDate);
|
|
||||||
return "/purchaseOrder/purchase-order-list";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( "/new" )
|
|
||||||
public String showPurchaseOrderCTPForm( Model model ){
|
|
||||||
model.addAttribute("purchaseOrder", purchaseOrderCTPService.createNewPurchaseOrderCTP() );
|
|
||||||
return "/purchaseOrder/purchase-order-form";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( value = "/edit/{id}" )
|
|
||||||
public String showJobCardEditForm( @PathVariable("id") long id,
|
|
||||||
Model model ){
|
|
||||||
model.addAttribute("purchaseOrder", purchaseOrderCTPService.searchPurchaseOrderById( id ) );
|
|
||||||
return "/purchaseOrder/purchase-order-form";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* draft
|
|
||||||
* */
|
|
||||||
@PostMapping( value ="/edit" , params = "user=draft" )
|
|
||||||
public String saveJobCard( @ModelAttribute PurchaseOrderCTP purchaseOrderCTP,
|
|
||||||
RedirectAttributes redirectAttributes,
|
|
||||||
Model model ){
|
|
||||||
try {
|
|
||||||
purchaseOrderCTP.setStatus( PurchaseOrderCTP.Status.DRAFT.name() );
|
|
||||||
purchaseOrderCTPService.save( purchaseOrderCTP );
|
|
||||||
redirectAttributes.addFlashAttribute("success", "Successfully saved!" );
|
|
||||||
} catch ( Exception ex ){
|
|
||||||
redirectAttributes.addFlashAttribute("error", ex.getMessage() );
|
|
||||||
}
|
|
||||||
return "redirect:/purchase-order";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping( value ="/edit" , params = "user=post" )
|
|
||||||
public String postJobCard( @ModelAttribute PurchaseOrderCTP purchaseOrderCTP,
|
|
||||||
RedirectAttributes redirectAttributes,
|
|
||||||
Model model ){
|
|
||||||
|
|
||||||
try {
|
|
||||||
purchaseOrderCTP.setStatus( PurchaseOrderCTP.Status.POSTED.name() );
|
|
||||||
purchaseOrderCTPService.save( purchaseOrderCTP );
|
|
||||||
redirectAttributes.addFlashAttribute("success", "Successfully saved!" );
|
|
||||||
} catch ( Exception ex ){
|
|
||||||
redirectAttributes.addFlashAttribute("error", ex.getMessage() );
|
|
||||||
}
|
|
||||||
return "redirect:/purchase-order";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( "/store-items/{id}" )
|
|
||||||
public String getPOStoreItems( @PathVariable("id") long poId,
|
|
||||||
Model model ){
|
|
||||||
model.addAttribute("storeItems", purchaseOrderCTPService.getStoreItemsByPoId( poId ));
|
|
||||||
return "/reporting/po-store-items-table";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@QCRole
|
@QCRole
|
||||||
@RequestMapping("/quality-control")
|
@RequestMapping( "/quality-control" )
|
||||||
public class QualityControlController {
|
public class QualityControlController {
|
||||||
|
|
||||||
private final InventoryAccountService inventoryAccountService;
|
private final InventoryAccountService inventoryAccountService;
|
||||||
|
@ -34,64 +34,64 @@ public class QualityControlController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String homePage(Model model) {
|
public String homePage( Model model ){
|
||||||
return "redirect:/quality-control/qc-finished-items";
|
return "redirect:/quality-control/qc-finished-items";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get stitching inventory accounts
|
* get stitching inventory accounts
|
||||||
* */
|
* */
|
||||||
@GetMapping("/inventory-accounts")
|
@GetMapping( "/inventory-accounts" )
|
||||||
public String getInventoryAccounts(@RequestParam(value = "id", required = false) String id,
|
public String getInventoryAccounts( @RequestParam( value = "id", required = false ) String id,
|
||||||
@RequestParam(value = "title", required = false) String title,
|
@RequestParam( value = "title", required = false) String title,
|
||||||
@RequestParam(value = "active", required = false) String active,
|
@RequestParam( value = "active", required = false ) String active,
|
||||||
@RequestParam(value = "created-by", required = false) String createdBy,
|
@RequestParam( value = "created-by", required = false ) String createdBy,
|
||||||
@RequestParam(value = "start-date", required = false) String startDate,
|
@RequestParam( value = "start-date", required = false ) String startDate,
|
||||||
@RequestParam(value = "end-date", required = false) String endDate,
|
@RequestParam( value = "end-date", required = false ) String endDate,
|
||||||
@RequestParam(value = "site-id", required = false) String siteId,
|
@RequestParam( value = "site-id", required = false ) String siteId,
|
||||||
@RequestParam(value = "count", required = false) Long count,
|
@RequestParam( value = "count", required = false ) Long count,
|
||||||
Model model) {
|
Model model ) {
|
||||||
// 24 for Packaging
|
// 24 for Packaging
|
||||||
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts(id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "4", false));
|
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts(id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "4", false));
|
||||||
model.addAttribute("locations", locationService.findAll());
|
model.addAttribute("locations", locationService.findAll() );
|
||||||
return "/quality-control/inventory-accounts";
|
return "/quality-control/inventory-accounts";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/qc-finished-items")
|
@GetMapping( "/qc-finished-items" )
|
||||||
public String getFinishedItems(@RequestParam(value = "id", required = false) String id,
|
public String getFinishedItems( @RequestParam(value = "id", required = false ) String id,
|
||||||
@RequestParam(value = "item-id", required = false) String itemId,
|
@RequestParam(value = "item-id", required = false ) String itemId,
|
||||||
@RequestParam(value = "sku", required = false) String sku,
|
@RequestParam( value = "sku", required = false ) String sku,
|
||||||
@RequestParam(value = "start-date", required = false) String startDate,
|
@RequestParam( value = "start-date", required = false) String startDate,
|
||||||
@RequestParam(value = "end-date", required = false) String endDate,
|
@RequestParam( value = "end-date", required = false ) String endDate,
|
||||||
@RequestParam(value = "job-card-id", required = false) String jobCardId,
|
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "100") Long count,
|
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
|
||||||
Model model) {
|
Model model ){
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
|
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
||||||
model.addAttribute("startDate", startDate1);
|
model.addAttribute("startDate", startDate1);
|
||||||
model.addAttribute("endDate", endDate1);
|
model.addAttribute("endDate", endDate1);
|
||||||
List<FinishedItem> itemList = bundleService.getFinishedItem(id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId, count);
|
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId ,count );
|
||||||
model.addAttribute("items", itemList);
|
model.addAttribute("items", itemList ) ;
|
||||||
return "/quality-control/qc-items-list";
|
return "/quality-control/qc-items-list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/qc-finished-item")
|
@GetMapping( "/qc-finished-item" )
|
||||||
public String getAddFinishedItemForQCForm(Model model) {
|
public String getAddFinishedItemForQCForm( Model model ){
|
||||||
// 4 for packaging
|
// 4 for packaging
|
||||||
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(5L));
|
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(5L) );
|
||||||
model.addAttribute("wrapper", new StitchedItemWrapper());
|
model.addAttribute("wrapper", new StitchedItemWrapper() );
|
||||||
return "/quality-control/qc-items-form";
|
return "/quality-control/qc-items-form";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/qc-finished-item")
|
@PostMapping( "/qc-finished-item" )
|
||||||
public String postFinishedItemsAfterQc(@ModelAttribute StitchedItemWrapper wrapper,
|
public String postFinishedItemsAfterQc( @ModelAttribute StitchedItemWrapper wrapper,
|
||||||
RedirectAttributes redirectAttributes) {
|
RedirectAttributes redirectAttributes ){
|
||||||
try {
|
try {
|
||||||
inventoryService.createFinishedItemsAgainstStitchedItems(wrapper, wrapper.getQaStatus());
|
inventoryService.createFinishedItemsAgainstStitchedItems( wrapper );
|
||||||
redirectAttributes.addFlashAttribute("success", " Finished Items Are Generated Against Stitched Items");
|
redirectAttributes.addFlashAttribute("success", " Finished Items Are Generated Against Stitched Items" );
|
||||||
} catch (Exception ex) {
|
}catch ( Exception ex ){
|
||||||
redirectAttributes.addFlashAttribute("error", ex.getMessage());
|
redirectAttributes.addFlashAttribute("error", ex.getMessage() );
|
||||||
}
|
}
|
||||||
return "redirect:/quality-control/qc-finished-item";
|
return "redirect:/quality-control/qc-finished-items";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
package com.utopiaindustries.controller;
|
package com.utopiaindustries.controller;
|
||||||
|
|
||||||
|
import com.utopiaindustries.auth.CuttingRole;
|
||||||
import com.utopiaindustries.auth.ReportingRole;
|
import com.utopiaindustries.auth.ReportingRole;
|
||||||
import com.utopiaindustries.model.ctp.POsDetails;
|
|
||||||
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
|
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
|
||||||
import com.utopiaindustries.service.InventoryAccountService;
|
|
||||||
import com.utopiaindustries.service.PurchaseOrderService;
|
|
||||||
import com.utopiaindustries.service.ReportingService;
|
|
||||||
import com.utopiaindustries.service.SummaryInventoryReportService;
|
import com.utopiaindustries.service.SummaryInventoryReportService;
|
||||||
import com.utopiaindustries.util.StringUtils;
|
import com.utopiaindustries.util.StringUtils;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -25,26 +20,14 @@ import java.util.Map;
|
||||||
@ReportingRole
|
@ReportingRole
|
||||||
@RequestMapping( "/reporting" )
|
@RequestMapping( "/reporting" )
|
||||||
public class ReportingController {
|
public class ReportingController {
|
||||||
private final ReportingService reportingService;
|
|
||||||
private final SummaryInventoryReportService summaryInventoryReportService;
|
private final SummaryInventoryReportService summaryInventoryReportService;
|
||||||
private final InventoryAccountService inventoryAccountService;
|
|
||||||
private final PurchaseOrderService purchaseOrderService;
|
|
||||||
|
|
||||||
|
public ReportingController(SummaryInventoryReportService summaryInventoryReportService2) {
|
||||||
public ReportingController(SummaryInventoryReportService summaryInventoryReportService2, ReportingService reportingService, InventoryAccountService inventoryAccountService, PurchaseOrderService purchaseOrderService) {
|
|
||||||
this.summaryInventoryReportService = summaryInventoryReportService2;
|
this.summaryInventoryReportService = summaryInventoryReportService2;
|
||||||
this.reportingService = reportingService;
|
|
||||||
this.inventoryAccountService = inventoryAccountService;
|
|
||||||
this.purchaseOrderService = purchaseOrderService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public String homePage( Model model ){
|
|
||||||
return "redirect:/reporting/job-card-report";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping( "/summary")
|
@GetMapping( "/summary")
|
||||||
public String summary(@RequestParam(value = "item-id", required = false ) String itemId, @RequestParam(value = "sku" , required = false) String sku, @RequestParam(value = "start-date", required = false) String startDate, @RequestParam(value = "end-date", required = false) String endDate, Model model ){
|
public String showMasterBundles(@RequestParam(value = "item-id", required = false ) String itemId, @RequestParam(value = "sku" , required = false) String sku, @RequestParam(value = "start-date", required = false) String startDate, @RequestParam(value = "end-date", required = false) String endDate, Model model ){
|
||||||
|
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(6) : LocalDate.parse(startDate);
|
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(6) : LocalDate.parse(startDate);
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now().plusDays(1) : LocalDate.parse(endDate);
|
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now().plusDays(1) : LocalDate.parse(endDate);
|
||||||
|
@ -57,68 +40,6 @@ public class ReportingController {
|
||||||
return "/reporting/inventory-summary";
|
return "/reporting/inventory-summary";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping( "/job-card-report")
|
|
||||||
public String jobCardReport(@RequestParam( value = "job-card-id", required = false ) String jobCardId,
|
|
||||||
Model model, RedirectAttributes redirectAttributes ){
|
|
||||||
if( jobCardId == null || jobCardId.isEmpty()) {
|
|
||||||
redirectAttributes.addFlashAttribute("error", "Please Re-Select Job Card" );
|
|
||||||
return "/reporting/job-card-report";
|
|
||||||
}
|
|
||||||
model.addAttribute("totalProduction", reportingService.getTotalProduction(jobCardId));
|
|
||||||
model.addAttribute("phasesTimes", reportingService.getEachPhaseTotalTime(jobCardId));
|
|
||||||
model.addAttribute("segregateItems", reportingService.getSegregateItems(jobCardId));
|
|
||||||
model.addAttribute("pendingStatus", reportingService.countPendingItemsOnDifferentPhases(jobCardId));
|
|
||||||
model.addAttribute("completeProduction", reportingService.getCompleteProduction(jobCardId));
|
|
||||||
model.addAttribute("jobCardProgress", reportingService.getJobCardProgress(jobCardId));
|
|
||||||
model.addAttribute("cuttingDetails", reportingService.getCuttingDetails(jobCardId));
|
|
||||||
model.addAttribute("stitchingDetails", reportingService.getStitchingDetails(jobCardId));
|
|
||||||
model.addAttribute("dailyProgress", reportingService.getPhasesProgressDayWise(jobCardId));
|
|
||||||
|
|
||||||
return "/reporting/job-card-report";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( value = "/cutting-report" )
|
|
||||||
public String cuttingReport(@RequestParam(value = "job-card-id", required = false ) String jobCardId, @RequestParam(value = "accountId" , required = false) String accountId, @RequestParam(value = "start-date", required = false) String startDate, @RequestParam(value = "end-date", required = false) String endDate, Model model ){
|
|
||||||
|
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(31) : LocalDate.parse(startDate);
|
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
|
||||||
model.addAttribute("startDate", startDate1);
|
|
||||||
model.addAttribute("endDate", endDate1);
|
|
||||||
model.addAttribute("accounts", inventoryAccountService.getAllCuttingAccounts() );
|
|
||||||
model.addAttribute("cutting",reportingService.getCuttingTableDetails(jobCardId, accountId, startDate1.toString(), endDate1.toString()));
|
|
||||||
|
|
||||||
return "/reporting/cutting-report";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( value = "/stitching-report" )
|
|
||||||
public String stitchingReport(@RequestParam(value = "job-card-id", required = false ) String jobCardId, @RequestParam(value = "accountId" , required = false) String accountId, @RequestParam(value = "start-date", required = false) String startDate, @RequestParam(value = "end-date", required = false) String endDate, Model model ){
|
|
||||||
|
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(31) : LocalDate.parse(startDate);
|
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
|
||||||
model.addAttribute("startDate", startDate1);
|
|
||||||
model.addAttribute("endDate", endDate1);
|
|
||||||
model.addAttribute("accounts" , inventoryAccountService.findInventoryAccounts( 2L ) );
|
|
||||||
model.addAttribute("stitching",reportingService.getStitchingDetails(jobCardId, accountId, startDate1.toString(), endDate1.toString()));
|
|
||||||
|
|
||||||
return "/reporting/stitching-report";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( "/inventory-transactions" )
|
|
||||||
public String getInventoryTransactionsByAccount( @RequestParam( value = "account-id", required = false) String accountId,
|
|
||||||
@RequestParam( value = "jobCard-id", required = false) String jobCardId,
|
|
||||||
@RequestParam( value = "sku", required = false) String sku,
|
|
||||||
@RequestParam( value = "startDate", required = false) String startDate,
|
|
||||||
@RequestParam( value = "endDate", required = false) String endDate,
|
|
||||||
Model model ){
|
|
||||||
|
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(31) : LocalDate.parse(startDate);
|
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
|
||||||
model.addAttribute("startDate", startDate1);
|
|
||||||
model.addAttribute("endDate", endDate1);
|
|
||||||
model.addAttribute("transactions", reportingService.stitchingItemsTransactions( jobCardId, accountId, sku, startDate1.toString(), endDate1.toString() ));
|
|
||||||
return "/reporting/accounts-transaction-table";
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
|
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
|
||||||
ArrayList<LocalDate> localDates = new ArrayList<>();
|
ArrayList<LocalDate> localDates = new ArrayList<>();
|
||||||
while (start.isBefore(end)) {
|
while (start.isBefore(end)) {
|
||||||
|
|
|
@ -74,6 +74,8 @@ public class StitchingController {
|
||||||
@RequestParam( value = "count", required = false ) Long count,
|
@RequestParam( value = "count", required = false ) Long count,
|
||||||
Model model ) {
|
Model model ) {
|
||||||
// 2 for stitching
|
// 2 for stitching
|
||||||
|
|
||||||
|
|
||||||
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts(id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "2", false));
|
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts(id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "2", false));
|
||||||
model.addAttribute("locations", locationService.findAll() );
|
model.addAttribute("locations", locationService.findAll() );
|
||||||
if(count == null){
|
if(count == null){
|
||||||
|
@ -91,13 +93,13 @@ public class StitchingController {
|
||||||
@RequestParam( value = "sku", required = false ) String sku,
|
@RequestParam( value = "sku", required = false ) String sku,
|
||||||
@RequestParam( value = "start-date", required = false) String startDate,
|
@RequestParam( value = "start-date", required = false) String startDate,
|
||||||
@RequestParam( value = "end-date", required = false ) String endDate,
|
@RequestParam( value = "end-date", required = false ) String endDate,
|
||||||
@RequestParam(value = "bundle-id", required = false) Long bundleId,
|
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
|
||||||
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
|
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
|
||||||
@RequestParam( value = "status", required = false) String status,
|
Model model
|
||||||
Model model, RedirectAttributes redirect){
|
,RedirectAttributes redirect){
|
||||||
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
|
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
|
||||||
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
|
||||||
List<StitchingOfflineItem> itemList = bundleService.getStitchedOfflineItems( id, itemId, sku, status, startDate, endDate, bundleId ,count );
|
List<StitchingOfflineItem> itemList = bundleService.getStitchedOfflineItems( id, itemId, sku, startDate, endDate, jobCardId ,count );
|
||||||
model.addAttribute("items", itemList ) ;
|
model.addAttribute("items", itemList ) ;
|
||||||
model.addAttribute("startDate", startDate1);
|
model.addAttribute("startDate", startDate1);
|
||||||
model.addAttribute("endDate", endDate1);
|
model.addAttribute("endDate", endDate1);
|
||||||
|
@ -122,7 +124,7 @@ public class StitchingController {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
redirectAttributes.addFlashAttribute( "error", exception.getMessage() );
|
redirectAttributes.addFlashAttribute( "error", exception.getMessage() );
|
||||||
}
|
}
|
||||||
return "redirect:/stitching/create-stitching-items";
|
return "redirect:/stitching/stitching-offline-items";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping( "/generate-barcodes" )
|
@PostMapping( "/generate-barcodes" )
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
package com.utopiaindustries.controller;
|
|
||||||
|
|
||||||
import com.utopiaindustries.auth.StoreRole;
|
|
||||||
import com.utopiaindustries.model.ctp.FinishedItemWrapper;
|
|
||||||
import com.utopiaindustries.service.InventoryAccountService;
|
|
||||||
import com.utopiaindustries.service.LocationService;
|
|
||||||
import com.utopiaindustries.service.StoreService;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@StoreRole
|
|
||||||
@RequestMapping( "/store" )
|
|
||||||
public class StoreController {
|
|
||||||
|
|
||||||
private final InventoryAccountService inventoryAccountService;
|
|
||||||
private final StoreService storeService;
|
|
||||||
private final LocationService locationService;
|
|
||||||
|
|
||||||
public StoreController(InventoryAccountService inventoryAccountService, StoreService storeService, LocationService locationService) {
|
|
||||||
this.inventoryAccountService = inventoryAccountService;
|
|
||||||
this.storeService = storeService;
|
|
||||||
this.locationService = locationService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public String showHome(Model model ){
|
|
||||||
return "redirect:/store/receive-inventory";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/receive-inventory")
|
|
||||||
public String packagingItemReceive( Model model ){
|
|
||||||
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(9L));
|
|
||||||
model.addAttribute("wrapper", new FinishedItemWrapper() );
|
|
||||||
return "/store/receive-inventory-form";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping( "/store-items" )
|
|
||||||
public String packagingItems( @ModelAttribute FinishedItemWrapper wrapper,
|
|
||||||
RedirectAttributes redirectAttributes,
|
|
||||||
Model model ){
|
|
||||||
try {
|
|
||||||
storeService.createStoreItems( wrapper );
|
|
||||||
redirectAttributes.addFlashAttribute("success", "Items Successfully received !" );
|
|
||||||
} catch ( Exception e ){
|
|
||||||
redirectAttributes.addFlashAttribute("error", e.getMessage() );
|
|
||||||
}
|
|
||||||
return "redirect:/store/receive-inventory";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping( "/inventory-accounts" )
|
|
||||||
public String showInventoryAccounts(@RequestParam( value = "id", required = false ) String id,
|
|
||||||
@RequestParam( value = "title", required = false) String title,
|
|
||||||
@RequestParam( value = "active", required = false ) String active,
|
|
||||||
@RequestParam( value = "created-by", required = false ) String createdBy,
|
|
||||||
@RequestParam( value = "start-date", required = false ) String startDate,
|
|
||||||
@RequestParam( value = "end-date", required = false ) String endDate,
|
|
||||||
@RequestParam( value = "site-id", required = false ) String siteId,
|
|
||||||
@RequestParam( value = "count", required = false ) Long count,
|
|
||||||
Model model ){
|
|
||||||
if(StringUtils.isNullOrEmpty( active )){
|
|
||||||
return "redirect:/store/inventory-accounts?id=&title=&active=1&created-by=&start-date=&end-date=&site-id=&site-title=&count=100";
|
|
||||||
}
|
|
||||||
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(9L));
|
|
||||||
model.addAttribute("locations", locationService.findAll() );
|
|
||||||
return "/store/inventory-accounts";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -26,12 +26,10 @@ public class BundleDAO {
|
||||||
private final String SELECT_BY_LIMIT = String.format( "SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME );
|
private final String SELECT_BY_LIMIT = String.format( "SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME );
|
||||||
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE master_bundle_id = :master_bundle_id ORDER BY id DESC", TABLE_NAME );
|
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE master_bundle_id = :master_bundle_id ORDER BY id DESC", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
||||||
private final String SELECT_BY_JOB_CARD = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
|
private final String SELECT_BY_ITEM_ID_AND_JOB_CARD = String.format( "SELECT * FROM %s WHERE item_id = :item_id AND job_card_id = :job_card_id", TABLE_NAME );
|
||||||
private final String SELECT_BY_ITEM_IDS_AND_JOB_CARD = String.format( "SELECT * FROM %s WHERE item_id IN (:item_ids) AND job_card_id = :job_card_id", TABLE_NAME );
|
private final String SELECT_BY_ITEM_IDS_AND_JOB_CARD = String.format( "SELECT * FROM %s WHERE item_id IN (:item_ids) AND job_card_id = :job_card_id", TABLE_NAME );
|
||||||
private final String SELECT_LIKE_BARCODE = String.format("SELECT * FROM %s WHERE barcode LIKE :barcode", TABLE_NAME);
|
private final String SELECT_LIKE_BARCODE = String.format("SELECT * FROM %s WHERE barcode LIKE :barcode", TABLE_NAME);
|
||||||
private final String SELECT_FIRST_BUNDLE_BY_JOB_CARD = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at ASC LIMIT 1", TABLE_NAME);
|
|
||||||
private final String SELECT_LAST_BUNDLE_BY_JOB_CARD = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1", TABLE_NAME);
|
|
||||||
private final String SELECT_BY_JOB_CARD_AND_DATE = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR created_at BETWEEN :start_date AND :end_date)", TABLE_NAME );
|
|
||||||
|
|
||||||
public BundleDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
public BundleDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||||
|
@ -134,10 +132,11 @@ public class BundleDAO {
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new BundleRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new BundleRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Bundle> findByCardId( long cardId ){
|
public List<Bundle> findByItemIdAndCardId( long itemId, long cardId ){
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
|
params.addValue("item_id", itemId );
|
||||||
params.addValue("job_card_id", cardId );
|
params.addValue("job_card_id", cardId );
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD, params, new BundleRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_ITEM_ID_AND_JOB_CARD, params, new BundleRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Bundle> findByItemIdsAndCardId( List<Long> itemIds, long cardId ){
|
public List<Bundle> findByItemIdsAndCardId( List<Long> itemIds, long cardId ){
|
||||||
|
@ -147,27 +146,4 @@ public class BundleDAO {
|
||||||
params.addValue("job_card_id", cardId );
|
params.addValue("job_card_id", cardId );
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_ITEM_IDS_AND_JOB_CARD, params, new BundleRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_ITEM_IDS_AND_JOB_CARD, params, new BundleRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bundle findFirstBundleByCardId(long cardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", cardId);
|
|
||||||
return namedParameterJdbcTemplate.queryForObject(SELECT_FIRST_BUNDLE_BY_JOB_CARD, params, new BundleRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bundle findLastBundleByCardId(long cardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", cardId);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_LAST_BUNDLE_BY_JOB_CARD, params, new BundleRowMapper())
|
|
||||||
.stream()
|
|
||||||
.findFirst().orElse(new Bundle());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Bundle> findByCardIdAndDATE( long cardId, String startDate, String endDate){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", cardId );
|
|
||||||
params.addValue( "start_date", startDate );
|
|
||||||
params.addValue( "end_date", endDate );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD_AND_DATE, params, new BundleRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
package com.utopiaindustries.dao.ctp;
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.FinishedItem;
|
import com.utopiaindustries.model.ctp.FinishedItem;
|
||||||
|
import com.utopiaindustries.model.ctp.JobCard;
|
||||||
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
|
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
|
@ -16,196 +17,155 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public class FinishedItemDAO {
|
public class FinishedItemDAO {
|
||||||
|
|
||||||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||||
|
|
||||||
private final String TABLE_NAME = "cut_to_pack.finished_item";
|
private final String TABLE_NAME = "cut_to_pack.finished_item";
|
||||||
private final String SELECT_QUERY = String.format("SELECT * FROM %s WHERE id = :id", TABLE_NAME);
|
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
||||||
private final String SELECT_ALL_QUERY = String.format("SELECT * FROM %s ORDER BY id DESC", TABLE_NAME);
|
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
||||||
private final String SELECT_QUERY_BY_BARCODE_QA_STATUS =String.format("SELECT CASE WHEN EXISTS (SELECT 1 FROM %s WHERE barcode = :barcode AND (is_store = TRUE OR is_packed = TRUE)) THEN TRUE ELSE FALSE END AS result", TABLE_NAME);
|
private final String SELECT_QUERY_BY_BARCODE_QA_STATUS = String.format( "SELECT case when EXISTS ( SELECT * FROM %s WHERE barcode = :barcode AND (qa_status = 'APPROVED' OR qa_status = 'WASHED') ) then true else false End as Result", TABLE_NAME );
|
||||||
private final String SELECT_QUERY_BY_JOB_CARD = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME);
|
private final String SELECT_QUERY_BY_JOB_CARD = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
|
||||||
private final String DELETE_QUERY = String.format("DELETE FROM %s WHERE id = :id", 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, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, stitched_item_id, is_segregated, qa_status, is_packed, operation_date, is_store) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :stitched_item_id, :is_segregated, :qa_status, :is_packed, :operation_date, :is_store) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), stitched_item_id = VALUES(stitched_item_id), is_segregated = VALUES(is_segregated), qa_status = VALUES(qa_status), is_packed = VALUES(is_packed), operation_date = VALUES(operation_date), is_store = VALUES(is_store)", TABLE_NAME);
|
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, stitched_item_id, is_segregated, qa_status) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :stitched_item_id, :is_segregated, :qa_status) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), stitched_item_id = VALUES(stitched_item_id), is_segregated = VALUES(is_segregated), qa_status = VALUES(qa_status)", TABLE_NAME );
|
||||||
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME);
|
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS = String.format("SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME);
|
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
||||||
private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME);
|
private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME );
|
||||||
private final String SELECT_BY_TERM = String.format("SELECT * FROM %s WHERE barcode LIKE :term AND is_qa = :is_qa AND is_packed = FALSE AND is_store = FALSE ORDER BY ID DESC", TABLE_NAME);
|
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated ORDER BY ID DESC", TABLE_NAME );
|
||||||
private final String SELECT_BY_TERM_FOR_PACKAGING = String.format("SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated AND qa_status = :qa_status AND is_packed = FALSE AND is_store = FALSE ORDER BY ID DESC", TABLE_NAME);
|
private final String SELECT_BY_STITCHED_ITEM_ID = String.format( "SELECT * FROM %s WHERE stitched_item_id = :stitched_item_id", TABLE_NAME );
|
||||||
private final String SELECT_BY_STITCHED_ITEM_ID = String.format("SELECT * FROM %s WHERE stitched_item_id = :stitched_item_id AND is_packed = FALSE", TABLE_NAME);
|
private final String SELECT_BY_STITCHED_ITEM_IDS = String.format( "SELECT * FROM %s WHERE stitched_item_id IN (:stitched_item_ids)", TABLE_NAME );
|
||||||
private final String SELECT_BY_STITCHED_ITEM_IDS = String.format("SELECT * FROM %s WHERE stitched_item_id IN (:stitched_item_ids)", TABLE_NAME);
|
|
||||||
private final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa = TRUE AND (is_segregated IS TRUE OR is_store = TRUE) ", TABLE_NAME);
|
|
||||||
private final String SELECT_BY_JOB_CARD_AND_DATE = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR created_at BETWEEN :start_date AND :end_date)", TABLE_NAME);
|
|
||||||
private final String SELECT_BY_DATE_QA_STATUS = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR operation_date >= :start_date) AND operation_date <= :end_date AND qa_status = :qa_status AND id in (:ids) AND is_packed = FALSE AND is_qa = TRUE", TABLE_NAME );
|
|
||||||
|
|
||||||
public FinishedItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
public FinishedItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare query params
|
// prepare query params
|
||||||
private MapSqlParameterSource prepareInsertQueryParams(FinishedItem finishedItem) {
|
private MapSqlParameterSource prepareInsertQueryParams( FinishedItem finishedItem ) {
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("id", finishedItem.getId())
|
params.addValue( "id", finishedItem.getId() )
|
||||||
.addValue("item_id", finishedItem.getItemId())
|
.addValue( "item_id", finishedItem.getItemId() )
|
||||||
.addValue("sku", finishedItem.getSku())
|
.addValue( "sku", finishedItem.getSku() )
|
||||||
.addValue("barcode", finishedItem.getBarcode())
|
.addValue( "barcode", finishedItem.getBarcode() )
|
||||||
.addValue("created_at", finishedItem.getCreatedAt())
|
.addValue( "created_at", finishedItem.getCreatedAt() )
|
||||||
.addValue("created_by", finishedItem.getCreatedBy())
|
.addValue( "created_by", finishedItem.getCreatedBy() )
|
||||||
.addValue("job_card_id", finishedItem.getJobCardId())
|
.addValue("job_card_id", finishedItem.getJobCardId() )
|
||||||
.addValue("is_qa", finishedItem.getIsQa())
|
.addValue("is_qa", finishedItem.getIsQa() )
|
||||||
.addValue("stitched_item_id", finishedItem.getStitchedItemId())
|
.addValue("stitched_item_id", finishedItem.getStitchedItemId() )
|
||||||
.addValue("is_segregated", finishedItem.getIsSegregated())
|
.addValue("is_segregated", finishedItem.getIsSegregated() )
|
||||||
.addValue("qa_status", finishedItem.getQaStatus())
|
.addValue("qa_status", finishedItem.getQaStatus() );
|
||||||
.addValue("is_packed", finishedItem.isPackaging())
|
return params;
|
||||||
.addValue("is_store", finishedItem.isStore())
|
}
|
||||||
.addValue("operation_date", finishedItem.getOperationDate());
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find
|
// find
|
||||||
public FinishedItem find(long id) {
|
public FinishedItem find( long id ) {
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("id", id);
|
params.addValue( "id", id );
|
||||||
return namedParameterJdbcTemplate.query(SELECT_QUERY, params, new FinishedItemRowMapper())
|
return namedParameterJdbcTemplate.query( SELECT_QUERY, params, new FinishedItemRowMapper() )
|
||||||
.stream()
|
.stream()
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(new FinishedItem());
|
.orElse( new FinishedItem() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// find all
|
// find all
|
||||||
public List<FinishedItem> findAll() {
|
public List<FinishedItem> findAll() {
|
||||||
return namedParameterJdbcTemplate.query(SELECT_ALL_QUERY, new FinishedItemRowMapper());
|
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// save
|
// save
|
||||||
public long save(FinishedItem finishedItem) {
|
public long save( FinishedItem finishedItem ) {
|
||||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||||
MapSqlParameterSource params = prepareInsertQueryParams(finishedItem);
|
MapSqlParameterSource params = prepareInsertQueryParams( finishedItem );
|
||||||
namedParameterJdbcTemplate.update(INSERT_QUERY, params, keyHolder);
|
namedParameterJdbcTemplate.update( INSERT_QUERY, params, keyHolder );
|
||||||
return KeyHolderFunctions.getKey(finishedItem.getId(), keyHolder);
|
return KeyHolderFunctions.getKey( finishedItem.getId(), keyHolder );
|
||||||
}
|
}
|
||||||
|
|
||||||
// save all
|
// save all
|
||||||
public int[] saveAll(List<FinishedItem> finishedItems) {
|
public int[] saveAll( List<FinishedItem> finishedItems ) {
|
||||||
List<MapSqlParameterSource> batchArgs = new ArrayList<>();
|
List<MapSqlParameterSource> batchArgs = new ArrayList<>();
|
||||||
for (FinishedItem finishedItem : finishedItems) {
|
for ( FinishedItem finishedItem: finishedItems ) {
|
||||||
MapSqlParameterSource params = prepareInsertQueryParams(finishedItem);
|
MapSqlParameterSource params = prepareInsertQueryParams( finishedItem );
|
||||||
batchArgs.add(params);
|
batchArgs.add( params );
|
||||||
}
|
}
|
||||||
return namedParameterJdbcTemplate.batchUpdate(INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[finishedItems.size()]));
|
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[finishedItems.size()]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
public boolean delete(long id) {
|
public boolean delete( long id ) {
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("id", id);
|
params.addValue( "id", id );
|
||||||
return namedParameterJdbcTemplate.update(DELETE_QUERY, params) > 0;
|
return namedParameterJdbcTemplate.update( DELETE_QUERY, params ) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FinishedItem> findByLimit(Long count) {
|
public List<FinishedItem> findByLimit(Long count ){
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("limit", count);
|
params.addValue( "limit",count );
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_LIMIT, params, new FinishedItemRowMapper());
|
return namedParameterJdbcTemplate.query( SELECT_BY_LIMIT , params, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FinishedItem> findByQuery(String query) {
|
public List<FinishedItem> findByQuery(String query ){
|
||||||
return namedParameterJdbcTemplate.query(query, new FinishedItemRowMapper());
|
return namedParameterJdbcTemplate.query( query, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FinishedItem> findByIds(List<Long> ids) {
|
public List<FinishedItem> findByIds(List<Long> ids ){
|
||||||
if (ids == null || ids.isEmpty()) return new ArrayList<>();
|
if( ids == null || ids.isEmpty() ) return new ArrayList<>();
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("ids", ids);
|
params.addValue("ids", ids );
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_IDS, params, new FinishedItemRowMapper());
|
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FinishedItem> findByTerm(String term, boolean isQa) {
|
public List<FinishedItem> findByTerm( String term , boolean isSegregated ){
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("term", "%" + term + "%");
|
params.addValue("term", "%" + term + "%" );
|
||||||
params.addValue("is_qa", isQa);
|
params.addValue("is_segregated", isSegregated );
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_TERM, params, new FinishedItemRowMapper());
|
return namedParameterJdbcTemplate.query( SELECT_BY_TERM , params, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FinishedItem> findByTermForPackaging(String term, boolean isSegregated, String qaStatus) {
|
// find By job card Id
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
public List<FinishedItem> findByJobCardId(long jobCardId ) {
|
||||||
params.addValue("term", "%" + term + "%");
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("is_segregated", isSegregated);
|
params.addValue( "job_card_id", jobCardId );
|
||||||
params.addValue("qa_status", qaStatus);
|
return namedParameterJdbcTemplate.query(SELECT_QUERY_BY_JOB_CARD, params, new FinishedItemRowMapper() );
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_TERM_FOR_PACKAGING, params, new FinishedItemRowMapper());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// find By job card Id
|
public FinishedItem findByStitchedItem( long stitchedItemId ){
|
||||||
public List<FinishedItem> findByJobCardId(long jobCardId) {
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
params.addValue("stitched_item_id", stitchedItemId );
|
||||||
params.addValue("job_card_id", jobCardId);
|
return namedParameterJdbcTemplate.query( SELECT_BY_STITCHED_ITEM_ID , params, new FinishedItemRowMapper() )
|
||||||
return namedParameterJdbcTemplate.query(SELECT_QUERY_BY_JOB_CARD, params, new FinishedItemRowMapper());
|
.stream()
|
||||||
}
|
.findFirst()
|
||||||
|
.orElse( null );
|
||||||
|
|
||||||
public FinishedItem findByStitchedItem(long stitchedItemId) {
|
}
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("stitched_item_id", stitchedItemId);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_STITCHED_ITEM_ID, params, new FinishedItemRowMapper())
|
|
||||||
.stream()
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
}
|
public HashMap<Long, Long> findTotalFinishedItems(List<Long> itemIds, long jobCardId) {
|
||||||
|
HashMap<Long, Long> totalCounts = new HashMap<>();
|
||||||
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
|
for (long id : itemIds) {
|
||||||
|
params.addValue("job_card_id", jobCardId);
|
||||||
|
params.addValue("item_id", id);
|
||||||
|
Long total = namedParameterJdbcTemplate.queryForObject(FIND_TOTAL_COUNT, params, Long.class);
|
||||||
|
if (total != null) {
|
||||||
|
totalCounts.put(id, total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return totalCounts;
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<Long, Long> findTotalFinishedItems(List<Long> itemIds, long jobCardId) {
|
public List<FinishedItem> findByStitchedItemIds( List<Long> stitchedItemIds ){
|
||||||
HashMap<Long, Long> totalCounts = new HashMap<>();
|
if( stitchedItemIds == null || stitchedItemIds.isEmpty() ) return new ArrayList<>();
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
for (long id : itemIds) {
|
params.addValue("stitched_item_ids", stitchedItemIds );
|
||||||
params.addValue("job_card_id", jobCardId);
|
return namedParameterJdbcTemplate.query( SELECT_BY_STITCHED_ITEM_IDS, params, new FinishedItemRowMapper() );
|
||||||
params.addValue("item_id", id);
|
}
|
||||||
Long total = namedParameterJdbcTemplate.queryForObject(FIND_TOTAL_COUNT, params, Long.class);
|
|
||||||
if (total != null) {
|
|
||||||
totalCounts.put(id, total);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return totalCounts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FinishedItem> findByStitchedItemIds(List<Long> stitchedItemIds) {
|
|
||||||
if (stitchedItemIds == null || stitchedItemIds.isEmpty()) return new ArrayList<>();
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("stitched_item_ids", stitchedItemIds);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_STITCHED_ITEM_IDS, params, new FinishedItemRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StitchingOfflineItem> findByBarcodeAndApprovedStatus(List<StitchingOfflineItem> stitchingOfflineItems) {
|
|
||||||
List<StitchingOfflineItem> items = new ArrayList<>();
|
|
||||||
for (StitchingOfflineItem item : stitchingOfflineItems) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("barcode", item.getBarcode());
|
|
||||||
boolean check = Boolean.TRUE.equals(namedParameterJdbcTemplate.queryForObject(SELECT_QUERY_BY_BARCODE_QA_STATUS, params, Boolean.class));
|
|
||||||
if (!check) {
|
|
||||||
items.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long calculateTotalFinishItem(long jobCardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardId);
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_FINISH_ITEM, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FinishedItem> calculateTotalFinishItem(long jobCardId, String startDate, String endDate) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardId);
|
|
||||||
params.addValue("start_date", startDate);
|
|
||||||
params.addValue("end_date", endDate);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_JOB_CARD_AND_DATE, params, new FinishedItemRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long findByOperationDateAndIdsAndQaStatus(String startDate, String endDate, String qaStatus, List<Long> ids){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "start_date", startDate );
|
|
||||||
params.addValue( "end_date", endDate );
|
|
||||||
params.addValue( "qa_status", qaStatus );
|
|
||||||
params.addValue( "ids", ids );
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_QA_STATUS, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public List<StitchingOfflineItem> findByBarcodeAndApprovedStatus( List<StitchingOfflineItem> stitchingOfflineItems ){
|
||||||
|
List<StitchingOfflineItem> items = new ArrayList<>();
|
||||||
|
for (StitchingOfflineItem item : stitchingOfflineItems){
|
||||||
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
|
params.addValue("barcode", item.getBarcode() );
|
||||||
|
boolean check =Boolean.TRUE.equals(namedParameterJdbcTemplate.queryForObject( SELECT_QUERY_BY_BARCODE_QA_STATUS, params, Boolean.class ));
|
||||||
|
if(!check){
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -16,17 +16,12 @@ public class FinishedItemRowMapper implements RowMapper<FinishedItem> {
|
||||||
if ( rs.getTimestamp( "created_at" ) != null ) {
|
if ( rs.getTimestamp( "created_at" ) != null ) {
|
||||||
finishedItem.setCreatedAt( rs.getTimestamp( "created_at" ).toLocalDateTime() );
|
finishedItem.setCreatedAt( rs.getTimestamp( "created_at" ).toLocalDateTime() );
|
||||||
}
|
}
|
||||||
if ( rs.getTimestamp( "operation_date" ) != null ) {
|
|
||||||
finishedItem.setOperationDate( rs.getTimestamp( "operation_date" ).toLocalDateTime() );
|
|
||||||
}
|
|
||||||
finishedItem.setCreatedBy( rs.getString( "created_by" ) );
|
finishedItem.setCreatedBy( rs.getString( "created_by" ) );
|
||||||
finishedItem.setJobCardId( rs.getLong("job_card_id") );
|
finishedItem.setJobCardId( rs.getLong("job_card_id") );
|
||||||
finishedItem.setIsQa( rs.getBoolean("is_qa"));
|
finishedItem.setIsQa( rs.getBoolean("is_qa"));
|
||||||
finishedItem.setStitchedItemId( rs.getLong("stitched_item_id" ) );
|
finishedItem.setStitchedItemId( rs.getLong("stitched_item_id" ) );
|
||||||
finishedItem.setIsSegregated( rs.getBoolean( "is_segregated") );
|
finishedItem.setIsSegregated( rs.getBoolean( "is_segregated") );
|
||||||
finishedItem.setQaStatus( rs.getString("qa_status" ) );
|
finishedItem.setQaStatus( rs.getString("qa_status" ) );
|
||||||
finishedItem.setPackaging( rs.getBoolean("is_packed" ) );
|
|
||||||
finishedItem.setStore( rs.getBoolean("is_store" ) );
|
|
||||||
return finishedItem;
|
return finishedItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,33 +20,13 @@ public class InventoryAccountDAO {
|
||||||
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
||||||
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY title DESC", TABLE_NAME );
|
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY title DESC", TABLE_NAME );
|
||||||
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
|
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
|
||||||
private final String INSERT_QUERY = String.format(
|
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, title, parent_entity_type, parent_entity_id, active, created_by, created_at, location_site_id, notes, is_packaging) VALUES (:id, :title, :parent_entity_type, :parent_entity_id, :active, :created_by, :created_at, :location_site_id, :notes, :is_packaging) ON DUPLICATE KEY UPDATE title = VALUES(title), parent_entity_type = VALUES(parent_entity_type), parent_entity_id = VALUES(parent_entity_id), active = VALUES(active), created_by = VALUES(created_by), created_at = VALUES(created_at), location_site_id = VALUES(location_site_id), notes = VALUES(notes), is_packaging = VALUES(is_packaging)", TABLE_NAME );
|
||||||
"INSERT INTO %s (id, title, parent_entity_type, parent_entity_id, active, created_by, created_at, location_site_id, notes, is_packaging, article_name, shift_minutes, total_machines, efficiency, sam) " +
|
|
||||||
"VALUES (:id, :title, :parent_entity_type, :parent_entity_id, :active, :created_by, :created_at, :location_site_id, :notes, :is_packaging, :article_name, :shift_minutes, :total_machines, :efficiency, :sam) " +
|
|
||||||
"ON DUPLICATE KEY UPDATE " +
|
|
||||||
"title = VALUES(title), " +
|
|
||||||
"parent_entity_type = VALUES(parent_entity_type), " +
|
|
||||||
"parent_entity_id = VALUES(parent_entity_id), " +
|
|
||||||
"active = VALUES(active), " +
|
|
||||||
"created_by = VALUES(created_by), " +
|
|
||||||
"created_at = VALUES(created_at), " +
|
|
||||||
"location_site_id = VALUES(location_site_id), " +
|
|
||||||
"notes = VALUES(notes), " +
|
|
||||||
"is_packaging = VALUES(is_packaging), " +
|
|
||||||
"article_name = VALUES(article_name), " +
|
|
||||||
"shift_minutes = VALUES(shift_minutes), " +
|
|
||||||
"efficiency = VALUES(efficiency), " +
|
|
||||||
"sam = VALUES(sam), " +
|
|
||||||
"total_machines = VALUES(total_machines)",
|
|
||||||
TABLE_NAME
|
|
||||||
);
|
|
||||||
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND id IN (:ids) AND parent_entity_id = :parent_entity_id", TABLE_NAME );
|
private final String SELECT_BY_IDS_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND id IN (:ids) AND parent_entity_id = :parent_entity_id", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS_AND_PARENT_IDS = String.format( "SELECT * FROM %s WHERE active = TRUE AND id IN (:ids) AND parent_entity_id IN (:parent_entity_ids)", TABLE_NAME );
|
private final String SELECT_BY_IDS_AND_PARENT_IDS = String.format( "SELECT * FROM %s WHERE active = TRUE AND id IN (:ids) AND parent_entity_id IN (:parent_entity_ids)", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS_AND_PARENT_ENTITY_TYPE_AND_PARENT_ID_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND parent_entity_id = :parent_entity_id AND parent_entity_type = :parent_entity_type LIMIT :limit", TABLE_NAME );
|
private final String SELECT_BY_IDS_AND_PARENT_ENTITY_TYPE_AND_PARENT_ID_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND parent_entity_id = :parent_entity_id AND parent_entity_type = :parent_entity_type LIMIT :limit", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS_PACKAGING_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND is_packaging = :is_packaging LIMIT :limit", TABLE_NAME );
|
private final String SELECT_BY_IDS_PACKAGING_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND is_packaging = :is_packaging LIMIT :limit", TABLE_NAME );
|
||||||
private final String SELECT_BY_PARENT_TYPE_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND parent_entity_type = :parent_entity_type AND parent_entity_id = :parent_entity_id" , TABLE_NAME );
|
private final String SELECT_BY_PARENT_TYPE_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND parent_entity_type = :parent_entity_type AND parent_entity_id = :parent_entity_id" , TABLE_NAME );
|
||||||
private final String SELECT_BY_IS_PACKAGING_TRUE = String.format( "SELECT * FROM %s WHERE is_packaging IS TRUE", TABLE_NAME );
|
|
||||||
|
|
||||||
public InventoryAccountDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
public InventoryAccountDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||||
|
@ -64,11 +44,6 @@ public class InventoryAccountDAO {
|
||||||
.addValue( "created_at", inventoryAccount.getCreatedAt() )
|
.addValue( "created_at", inventoryAccount.getCreatedAt() )
|
||||||
.addValue( "location_site_id", inventoryAccount.getLocationSiteId() )
|
.addValue( "location_site_id", inventoryAccount.getLocationSiteId() )
|
||||||
.addValue( "notes", inventoryAccount.getNotes() )
|
.addValue( "notes", inventoryAccount.getNotes() )
|
||||||
.addValue( "article_name", inventoryAccount.getArticleName() )
|
|
||||||
.addValue( "total_machines", inventoryAccount.getTotalMachines() )
|
|
||||||
.addValue( "shift_minutes", inventoryAccount.getShiftMinutes() )
|
|
||||||
.addValue( "efficiency", inventoryAccount.getEfficiency() )
|
|
||||||
.addValue( "sam", inventoryAccount.getSam() )
|
|
||||||
.addValue("is_packaging", inventoryAccount.getIsPackaging() );
|
.addValue("is_packaging", inventoryAccount.getIsPackaging() );
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
@ -169,9 +144,4 @@ public class InventoryAccountDAO {
|
||||||
params.addValue("parent_entity_id", parentEntityId );
|
params.addValue("parent_entity_id", parentEntityId );
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_PARENT_TYPE_AND_PARENT_ID, params, new InventoryAccountRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_PARENT_TYPE_AND_PARENT_ID, params, new InventoryAccountRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryAccount> getPackagingAccounts(){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_IS_PACKAGING_TRUE, params, new InventoryAccountRowMapper() );
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -20,11 +20,6 @@ public class InventoryAccountRowMapper implements RowMapper<InventoryAccount> {
|
||||||
}
|
}
|
||||||
inventoryAccount.setLocationSiteId( rs.getInt( "location_site_id" ) );
|
inventoryAccount.setLocationSiteId( rs.getInt( "location_site_id" ) );
|
||||||
inventoryAccount.setNotes( rs.getString( "notes" ) );
|
inventoryAccount.setNotes( rs.getString( "notes" ) );
|
||||||
inventoryAccount.setArticleName( rs.getString( "article_name" ) );
|
|
||||||
inventoryAccount.setShiftMinutes( rs.getLong( "shift_minutes" ) );
|
|
||||||
inventoryAccount.setTotalMachines( rs.getLong( "total_machines" ) );
|
|
||||||
inventoryAccount.setEfficiency( rs.getBigDecimal( "efficiency" ) );
|
|
||||||
inventoryAccount.setSam( rs.getBigDecimal( "sam" ) );
|
|
||||||
inventoryAccount.setIsPackaging( rs.getBoolean("is_packaging" ) );
|
inventoryAccount.setIsPackaging( rs.getBoolean("is_packaging" ) );
|
||||||
return inventoryAccount;
|
return inventoryAccount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.utopiaindustries.dao.ctp;
|
||||||
import com.utopiaindustries.model.ctp.InventorySummary;
|
import com.utopiaindustries.model.ctp.InventorySummary;
|
||||||
import com.utopiaindustries.model.ctp.InventoryTransactionLeg;
|
import com.utopiaindustries.model.ctp.InventoryTransactionLeg;
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||||
import com.utopiaindustries.util.StringUtils;
|
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||||
|
@ -22,7 +21,7 @@ public class InventoryTransactionLegDAO {
|
||||||
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
||||||
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
||||||
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", 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, transaction_id, item_id, sku, type, quantity, account_id, balance, transaction_leg_datetime, parent_document_type, parent_document_id, parent_document_piece_type, job_card_id) VALUES (:id, :transaction_id, :item_id, :sku, :type, :quantity, :account_id, :balance, :transaction_leg_datetime, :parent_document_type, :parent_document_id, :parent_document_piece_type, :job_card_id) ON DUPLICATE KEY UPDATE transaction_id = VALUES(transaction_id), item_id = VALUES(item_id), sku = VALUES(sku), type = VALUES(type), quantity = VALUES(quantity), account_id = VALUES(account_id), balance = VALUES(balance), transaction_leg_datetime = VALUES(transaction_leg_datetime), parent_document_type = VALUES(parent_document_type), parent_document_id = VALUES(parent_document_id), parent_document_piece_type = VALUES(parent_document_piece_type), job_card_id = VALUES(job_card_id)", TABLE_NAME );
|
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, transaction_id, item_id, sku, type, quantity, account_id, balance, transaction_leg_datetime, parent_document_type, parent_document_id, parent_document_piece_type) VALUES (:id, :transaction_id, :item_id, :sku, :type, :quantity, :account_id, :balance, :transaction_leg_datetime, :parent_document_type, :parent_document_id, :parent_document_piece_type) ON DUPLICATE KEY UPDATE transaction_id = VALUES(transaction_id), item_id = VALUES(item_id), sku = VALUES(sku), type = VALUES(type), quantity = VALUES(quantity), account_id = VALUES(account_id), balance = VALUES(balance), transaction_leg_datetime = VALUES(transaction_leg_datetime), parent_document_type = VALUES(parent_document_type), parent_document_id = VALUES(parent_document_id), parent_document_piece_type = VALUES(parent_document_piece_type)", TABLE_NAME );
|
||||||
private final String SELECT_LAST_ACCOUNT_ID_AND_ITEM_ID = String.format( "SELECT * FROM %s WHERE account_id = :account_id AND item_id = :item_id AND parent_document_type= :parent_document_type AND parent_document_piece_type = :parent_document_piece_type ORDER BY id DESC LIMIT 1", TABLE_NAME );
|
private final String SELECT_LAST_ACCOUNT_ID_AND_ITEM_ID = String.format( "SELECT * FROM %s WHERE account_id = :account_id AND item_id = :item_id AND parent_document_type= :parent_document_type AND parent_document_piece_type = :parent_document_piece_type ORDER BY id DESC LIMIT 1", TABLE_NAME );
|
||||||
private final String SELECT_BY_ACCOUNT_ID = String.format( "SELECT * FROM %s WHERE account_id = :account_id ORDER BY id DESC" , TABLE_NAME );
|
private final String SELECT_BY_ACCOUNT_ID = String.format( "SELECT * FROM %s WHERE account_id = :account_id ORDER BY id DESC" , TABLE_NAME );
|
||||||
private final String SELECT_SUMMARY_BY_ACCOUNT_ID = String.format( "SELECT item_id, sku, parent_document_type,parent_document_piece_type," +
|
private final String SELECT_SUMMARY_BY_ACCOUNT_ID = String.format( "SELECT item_id, sku, parent_document_type,parent_document_piece_type," +
|
||||||
|
@ -45,23 +44,11 @@ public class InventoryTransactionLegDAO {
|
||||||
" WHERE itl.type = :type" +
|
" WHERE itl.type = :type" +
|
||||||
" AND itl.parent_document_type = :parent_document_type"
|
" AND itl.parent_document_type = :parent_document_type"
|
||||||
, TABLE_NAME, TABLE_NAME );
|
, TABLE_NAME, TABLE_NAME );
|
||||||
private final String COUNT_TOTAL_SEGREGATE_ITEMS = String.format("SELECT COUNT(*) FROM %s WHERE parent_document_id IN (:parent_document_id) AND account_id = :account_id", TABLE_NAME);
|
|
||||||
private final String SELECT_FIRST_TRANSACTION_PARENT_TYPE_PARENT_ID = String.format("SELECT * FROM %s WHERE parent_document_id IN (:parent_document_id) AND parent_document_type = :parent_document_type ORDER BY transaction_leg_datetime ASC LIMIT 1", TABLE_NAME);
|
|
||||||
private final String SELECT_GROUP_By_TRANSACTION_PARENT_TYPE_PARENT_ID = String.format("SELECT * FROM %s WHERE parent_document_id IN (:parent_document_id) AND parent_document_type = :parent_document_type GROUP BY account_id", TABLE_NAME);
|
|
||||||
private final String SELECT_TRANSACTIONS_REMAINING = String.format("SELECT parent_document_id as parentIds FROM %s WHERE account_id = :account_id AND parent_document_type = :parent_document_type AND type = 'IN' AND parent_document_id NOT IN (SELECT parent_document_id FROM %s WHERE account_id = :account_id AND parent_document_type = :parent_document_type AND type = 'OUT')", TABLE_NAME, TABLE_NAME);
|
|
||||||
private final String SELECT_IN_PARENT_ID_BY_TYPE_GROUP = String.format("SELECT parent_document_id as parentIds FROM %s WHERE account_id = :account_id AND parent_document_type = :parent_document_type AND type = 'IN' GROUP BY parent_document_id", TABLE_NAME);
|
|
||||||
private final String SELECT_OUT_PARENT_ID_BY_TYPE_GROUP = String.format("SELECT parent_document_id as parentIds FROM %s WHERE account_id = :account_id AND parent_document_type = :parent_document_type AND type = 'OUT' GROUP BY parent_document_id", TABLE_NAME);
|
|
||||||
private final String SELECT_JOB_CARD_DATES = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR transaction_leg_datetime BETWEEN :start_date AND :end_date) AND type = :type ", TABLE_NAME);
|
|
||||||
private final String SELECT_JOB_CARD_And_Date_Type_Account_Id = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR transaction_leg_datetime BETWEEN :start_date AND :end_date) AND type = :type AND account_id IN (:account_ids)", TABLE_NAME);
|
|
||||||
|
|
||||||
public InventoryTransactionLegDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
public InventoryTransactionLegDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryTransactionLeg> findByQuery(String query ){
|
|
||||||
return namedParameterJdbcTemplate.query( query, new InventoryTransactionLegRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepare query params
|
// prepare query params
|
||||||
private MapSqlParameterSource prepareInsertQueryParams( InventoryTransactionLeg inventoryTransactionLeg ) {
|
private MapSqlParameterSource prepareInsertQueryParams( InventoryTransactionLeg inventoryTransactionLeg ) {
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
|
@ -76,9 +63,7 @@ public class InventoryTransactionLegDAO {
|
||||||
.addValue( "transaction_leg_datetime", inventoryTransactionLeg.getTransactionLegDateTime() )
|
.addValue( "transaction_leg_datetime", inventoryTransactionLeg.getTransactionLegDateTime() )
|
||||||
.addValue( "parent_document_type", inventoryTransactionLeg.getParentDocumentType() )
|
.addValue( "parent_document_type", inventoryTransactionLeg.getParentDocumentType() )
|
||||||
.addValue( "parent_document_id", inventoryTransactionLeg.getParentDocumentId() )
|
.addValue( "parent_document_id", inventoryTransactionLeg.getParentDocumentId() )
|
||||||
.addValue("parent_document_piece_type", inventoryTransactionLeg.getParentDocumentPieceType() )
|
.addValue("parent_document_piece_type", inventoryTransactionLeg.getParentDocumentPieceType() );
|
||||||
.addValue("job_card_id", inventoryTransactionLeg.getJobCardId() );
|
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,77 +153,4 @@ public class InventoryTransactionLegDAO {
|
||||||
params.addValue("parent_document_type", parentType );
|
params.addValue("parent_document_type", parentType );
|
||||||
return namedParameterJdbcTemplate.query( SELECT_LAST_LEG_BY_TYPE_AND_PARENT_ID , params, new InventoryTransactionLegRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_LAST_LEG_BY_TYPE_AND_PARENT_ID , params, new InventoryTransactionLegRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long CalculateTotalGradingItems(List<Long> finishItemIds, Integer accountId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("parent_document_id", finishItemIds);
|
|
||||||
params.addValue("account_id", accountId);
|
|
||||||
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_SEGREGATE_ITEMS, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InventoryTransactionLeg getFirstStitchBundleTime(List<Long> parentsIds, String parentType) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("parent_document_id", parentsIds);
|
|
||||||
params.addValue("parent_document_type", parentType);
|
|
||||||
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_FIRST_TRANSACTION_PARENT_TYPE_PARENT_ID, params,new InventoryTransactionLegRowMapper())
|
|
||||||
.stream()
|
|
||||||
.findFirst()
|
|
||||||
.orElse( new InventoryTransactionLeg() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryTransactionLeg> getTransactionByParentIdAndType(List<Long> parentIds , String parentType){
|
|
||||||
if ( parentIds == null || parentIds.isEmpty() ){
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("parent_document_id", parentIds );
|
|
||||||
params.addValue("parent_document_type", parentType );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_GROUP_By_TRANSACTION_PARENT_TYPE_PARENT_ID , params, new InventoryTransactionLegRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryTransactionLeg> getTransactionByJobCardAndDatesAndType(long jobCardID, String startDate, String endDate, String type){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardID );
|
|
||||||
params.addValue("start_date", startDate );
|
|
||||||
params.addValue("end_date", endDate );
|
|
||||||
params.addValue("type", type );
|
|
||||||
System.out.println("Start Date: " + startDate);
|
|
||||||
System.out.println("End Date: " + endDate);
|
|
||||||
|
|
||||||
System.out.println("Params: " + params.getValues());
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_JOB_CARD_DATES , params, new InventoryTransactionLegRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryTransactionLeg> getTransactionByJobCardAndDatesAndTypeAndAccountID(long jobCardID, String startDate, String endDate, String type, List<Integer> accountId){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardID );
|
|
||||||
params.addValue("start_date", startDate );
|
|
||||||
params.addValue("end_date", endDate );
|
|
||||||
params.addValue("type", type );
|
|
||||||
params.addValue("account_ids", accountId );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_JOB_CARD_And_Date_Type_Account_Id , params, new InventoryTransactionLegRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Long> findRemainingByParentTypeAndAccountID(String parentType, Integer accountId){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("account_id", accountId );
|
|
||||||
params.addValue("parent_document_type", parentType );
|
|
||||||
return namedParameterJdbcTemplate.queryForList( SELECT_TRANSACTIONS_REMAINING , params, Long.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Long> getInParentIdByDate(String parentType, Integer accountId){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("account_id", accountId );
|
|
||||||
params.addValue("parent_document_type", parentType );
|
|
||||||
return namedParameterJdbcTemplate.queryForList( SELECT_IN_PARENT_ID_BY_TYPE_GROUP , params, Long.class );
|
|
||||||
}
|
|
||||||
public List<Long> getOutParentIdByDate(String parentType, Integer accountId){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("account_id", accountId );
|
|
||||||
params.addValue("parent_document_type", parentType );
|
|
||||||
return namedParameterJdbcTemplate.queryForList( SELECT_OUT_PARENT_ID_BY_TYPE_GROUP , params, Long.class );
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -23,7 +23,6 @@ public class InventoryTransactionLegRowMapper implements RowMapper<InventoryTran
|
||||||
inventoryTransactionLeg.setParentDocumentType( rs.getString( "parent_document_type" ) );
|
inventoryTransactionLeg.setParentDocumentType( rs.getString( "parent_document_type" ) );
|
||||||
inventoryTransactionLeg.setParentDocumentId( rs.getLong( "parent_document_id" ) );
|
inventoryTransactionLeg.setParentDocumentId( rs.getLong( "parent_document_id" ) );
|
||||||
inventoryTransactionLeg.setParentDocumentPieceType( rs.getString("parent_document_piece_type"));
|
inventoryTransactionLeg.setParentDocumentPieceType( rs.getString("parent_document_piece_type"));
|
||||||
inventoryTransactionLeg.setJobCardId( rs.getLong("job_card_id"));
|
|
||||||
return inventoryTransactionLeg;
|
return inventoryTransactionLeg;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,12 +21,13 @@ public class JobCardDAO {
|
||||||
private final String TABLE_NAME = "cut_to_pack.job_card";
|
private final String TABLE_NAME = "cut_to_pack.job_card";
|
||||||
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
||||||
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
||||||
private final String SELECT_ALL_BY_PO_ID = String.format( "SELECT * FROM %s WHERE purchase_order_id = :purchase_order_id", TABLE_NAME );
|
private final String SELECT_ALL_QUERY_WITH_LIMIT = String.format( "SELECT * FROM %s ORDER BY id DESC limit :limit", TABLE_NAME );
|
||||||
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", 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, code, job_order_id, created_at, created_by, status, inventory_status, customer, lot_number, purchase_order_id, location_site_id, description, poQuantity, articleName) VALUES (:id, :code, :job_order_id, :created_at, :created_by, :status, :inventory_status, :customer, :lot_number, :purchase_order_id, :location_site_id, :description, :poQuantity, :articleName) ON DUPLICATE KEY UPDATE code = VALUES(code), job_order_id = VALUES(job_order_id), created_at = VALUES(created_at), created_by = VALUES(created_by), status = VALUES(status), inventory_status = VALUES(inventory_status), customer = VALUES(customer), lot_number = VALUES(lot_number), purchase_order_id = VALUES(purchase_order_id), location_site_id = VALUES(location_site_id), description = VALUES(description), poQuantity = VALUES(poQuantity), articleName = VALUES(articleName) ", TABLE_NAME );
|
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, code, job_order_id, created_at, created_by, status, inventory_status, customer, lot_number, purchase_order_id, location_site_id, description) VALUES (:id, :code, :job_order_id, :created_at, :created_by, :status, :inventory_status, :customer, :lot_number, :purchase_order_id, :location_site_id, :description) ON DUPLICATE KEY UPDATE code = VALUES(code), job_order_id = VALUES(job_order_id), created_at = VALUES(created_at), created_by = VALUES(created_by), status = VALUES(status), inventory_status = VALUES(inventory_status), customer = VALUES(customer), lot_number = VALUES(lot_number), purchase_order_id = VALUES(purchase_order_id), location_site_id = VALUES(location_site_id), description = VALUES(description)", TABLE_NAME );
|
||||||
private final String SELECT_BY_LIKE_CODE_AND_INV_STATUS_AND_STATUS = String.format( "SELECT * FROM %s WHERE code like :code AND status = :status AND inventory_status = :inventory_status", TABLE_NAME );
|
private final String SELECT_BY_LIKE_CODE_AND_INV_STATUS_AND_STATUS = String.format( "SELECT * FROM %s WHERE code like :code AND status = :status AND inventory_status = :inventory_status", TABLE_NAME );
|
||||||
private final String SELECT_BY_LIKE_CODE = String.format( "SELECT * FROM %s WHERE code like :code", TABLE_NAME );
|
private final String SELECT_BY_LIKE_CODE = String.format( "SELECT * FROM %s WHERE code like :code", 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_LIMIT = String.format( "SELECT * FROM %s WHERE created_by = :created_by ORDER BY id DESC limit :limit", TABLE_NAME );
|
||||||
|
|
||||||
|
|
||||||
// prepare query params
|
// prepare query params
|
||||||
private MapSqlParameterSource prepareInsertQueryParams( JobCard jobCard ) {
|
private MapSqlParameterSource prepareInsertQueryParams( JobCard jobCard ) {
|
||||||
|
@ -39,8 +40,6 @@ public class JobCardDAO {
|
||||||
.addValue("status", jobCard.getStatus() )
|
.addValue("status", jobCard.getStatus() )
|
||||||
.addValue("inventory_status", jobCard.getInventoryStatus() )
|
.addValue("inventory_status", jobCard.getInventoryStatus() )
|
||||||
.addValue("customer", jobCard.getCustomer() )
|
.addValue("customer", jobCard.getCustomer() )
|
||||||
.addValue("poQuantity", jobCard.getPoQuantity() )
|
|
||||||
.addValue("articleName", jobCard.getArticleName() )
|
|
||||||
.addValue("lot_number", jobCard.getLotNumber() )
|
.addValue("lot_number", jobCard.getLotNumber() )
|
||||||
.addValue("purchase_order_id", jobCard.getPurchaseOrderId() )
|
.addValue("purchase_order_id", jobCard.getPurchaseOrderId() )
|
||||||
.addValue("location_site_id", jobCard.getLocationSiteId() )
|
.addValue("location_site_id", jobCard.getLocationSiteId() )
|
||||||
|
@ -114,9 +113,9 @@ public class JobCardDAO {
|
||||||
return namedParameterJdbcTemplate.query( query, new JobCardRowMapper() );
|
return namedParameterJdbcTemplate.query( query, new JobCardRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JobCard> findByPoId(long poId){
|
public List<JobCard> findByAllWithLimit(Long limit){
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("purchase_order_id", poId);
|
params.addValue("limit", limit.intValue());
|
||||||
return namedParameterJdbcTemplate.query( SELECT_ALL_BY_PO_ID, params, new JobCardRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY_WITH_LIMIT, params, new JobCardRowMapper() );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
package com.utopiaindustries.dao.ctp;
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.JobCardItem;
|
import com.utopiaindustries.model.ctp.JobCardItem;
|
||||||
|
import com.utopiaindustries.model.ctp.MasterBundle;
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
|
@ -10,6 +11,7 @@ import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class JobCardItemDAO {
|
public class JobCardItemDAO {
|
||||||
|
@ -22,11 +24,9 @@ public class JobCardItemDAO {
|
||||||
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
|
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
|
||||||
private final String SELECT_BY_CARD_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :card_id", TABLE_NAME );
|
private final String SELECT_BY_CARD_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :card_id", TABLE_NAME );
|
||||||
private final String SELECT_BY_CARD_ID_AND_ITEM_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :card_id AND item_id = :item_id ", TABLE_NAME );
|
private final String SELECT_BY_CARD_ID_AND_ITEM_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :card_id AND item_id = :item_id ", TABLE_NAME );
|
||||||
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, job_card_id, item_id, sku, expected_production, actual_production, total_production, account_id, length, width, gsm, wt_ply, ply, is_complete) VALUES (:id, :job_card_id, :item_id, :sku, :expected_production, :actual_production, :total_production, :account_id, :length, :width, :gsm, :wt_ply, :ply, :is_complete) ON DUPLICATE KEY UPDATE job_card_id = VALUES(job_card_id), item_id = VALUES(item_id), sku = VALUES(sku), expected_production = VALUES(expected_production), actual_production = VALUES(actual_production), total_production = VALUES(total_production), account_id = VALUES(account_id), length = VALUES(length), width = VALUES(width), gsm = VALUES(gsm), wt_ply = VALUES(wt_ply), ply = VALUES(ply), is_complete =VALUES(is_complete) ", TABLE_NAME );
|
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, job_card_id, item_id, sku, expected_production, actual_production, total_production, account_id, length, width, gsm, wt_ply, ply) VALUES (:id, :job_card_id, :item_id, :sku, :expected_production, :actual_production, :total_production, :account_id, :length, :width, :gsm, :wt_ply, :ply) ON DUPLICATE KEY UPDATE job_card_id = VALUES(job_card_id), item_id = VALUES(item_id), sku = VALUES(sku), expected_production = VALUES(expected_production), actual_production = VALUES(actual_production), total_production = VALUES(total_production), account_id = VALUES(account_id), length = VALUES(length), width = VALUES(width), gsm = VALUES(gsm), wt_ply = VALUES(wt_ply), ply = VALUES(ply) ", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
||||||
private final String SELECT_BY_JOB_CARD_AND_ACCOUNT_IDS = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id AND account_id IN (:account_ids) AND is_complete = FALSE ", TABLE_NAME );
|
private final String SELECT_BY_JOB_CARD_AND_ACCOUNT_IDS = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id AND actual_production = :actual_production AND account_id IN (:account_ids)", TABLE_NAME );
|
||||||
private final String SELECT_ALL_ACTIVE_ITEM = String.format("SELECT CASE WHEN MIN(is_complete) = TRUE THEN TRUE ELSE FALSE END FROM %s WHERE job_card_id = :job_card_id AND id IN (:id)", TABLE_NAME);
|
|
||||||
private final String SELECT_BY_JOB_CARD_IDS = String.format( "SELECT * FROM %s WHERE job_card_id IN (:job_card_id)", TABLE_NAME );
|
|
||||||
|
|
||||||
public JobCardItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
public JobCardItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||||
|
@ -47,9 +47,7 @@ public class JobCardItemDAO {
|
||||||
.addValue("width", jobCardItem.getWidth() )
|
.addValue("width", jobCardItem.getWidth() )
|
||||||
.addValue("gsm", jobCardItem.getGsm() )
|
.addValue("gsm", jobCardItem.getGsm() )
|
||||||
.addValue("wt_ply", jobCardItem.getWtPly() )
|
.addValue("wt_ply", jobCardItem.getWtPly() )
|
||||||
.addValue("ply", jobCardItem.getPly() )
|
.addValue("ply", jobCardItem.getPly() );
|
||||||
.addValue("is_complete", jobCardItem.isComplete() );
|
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,26 +112,12 @@ public class JobCardItemDAO {
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_IDS, params, new JobCardItemRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_IDS, params, new JobCardItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JobCardItem> findByJobCardAndAccountIdsAndIsReceived( Long jobCardId, List<Long> accountIds ){
|
public List<JobCardItem> findByJobCardAndAccountIdsAndIsReceived( Long jobCardId, Long actualProduction, List<Long> accountIds ){
|
||||||
if( accountIds == null || accountIds.isEmpty() ) return new ArrayList<>();
|
if( accountIds == null || accountIds.isEmpty() ) return new ArrayList<>();
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue( "account_ids", accountIds );
|
params.addValue( "account_ids", accountIds );
|
||||||
params.addValue("job_card_id", jobCardId );
|
params.addValue("job_card_id", jobCardId );
|
||||||
|
params.addValue("actual_production", actualProduction );
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD_AND_ACCOUNT_IDS , params, new JobCardItemRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD_AND_ACCOUNT_IDS , params, new JobCardItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkAllItemsComplete( Long jobCardId, List<Long> itemsId ){
|
|
||||||
if( itemsId == null || itemsId.isEmpty() ) return false;
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "id", itemsId );
|
|
||||||
params.addValue("job_card_id", jobCardId );
|
|
||||||
Boolean allComplete = namedParameterJdbcTemplate.queryForObject(SELECT_ALL_ACTIVE_ITEM, params, Boolean.class);
|
|
||||||
return Boolean.TRUE.equals(allComplete);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JobCardItem> findByJobCardIds(List<Long> ids){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", ids);
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD_IDS, params, new JobCardItemRowMapper() );
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -22,7 +22,6 @@ public class JobCardItemRowMapper implements RowMapper<JobCardItem> {
|
||||||
jobCardItem.setGsm( rs.getString("gsm" ) );
|
jobCardItem.setGsm( rs.getString("gsm" ) );
|
||||||
jobCardItem.setWtPly( rs.getString("wt_ply" ) );
|
jobCardItem.setWtPly( rs.getString("wt_ply" ) );
|
||||||
jobCardItem.setPly( rs.getString("ply" ) );
|
jobCardItem.setPly( rs.getString("ply" ) );
|
||||||
jobCardItem.setComplete( rs.getBoolean("is_complete" ) );
|
|
||||||
return jobCardItem;
|
return jobCardItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,8 +23,6 @@ public class JobCardRowMapper implements RowMapper<JobCard> {
|
||||||
jobCard.setPurchaseOrderId( rs.getString("purchase_order_id") );
|
jobCard.setPurchaseOrderId( rs.getString("purchase_order_id") );
|
||||||
jobCard.setLocationSiteId( rs.getLong("location_site_id" ) );
|
jobCard.setLocationSiteId( rs.getLong("location_site_id" ) );
|
||||||
jobCard.setDescription( rs.getString("description" ) );
|
jobCard.setDescription( rs.getString("description" ) );
|
||||||
jobCard.setPoQuantity( rs.getInt("poQuantity" ) );
|
|
||||||
jobCard.setArticleName( rs.getString("articleName" ) );
|
|
||||||
return jobCard;
|
return jobCard;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,110 +0,0 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.FinishedItem;
|
|
||||||
import com.utopiaindustries.model.ctp.PackagingItems;
|
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
||||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
|
||||||
import org.springframework.jdbc.support.KeyHolder;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class PackagingItemsDAO {
|
|
||||||
|
|
||||||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
|
||||||
|
|
||||||
private static final String TABLE_NAME = "packaging_items";
|
|
||||||
|
|
||||||
private static final String SELECT_BY_ID = String.format("SELECT * FROM %s WHERE id = :id", TABLE_NAME);
|
|
||||||
private static final String SELECT_ALL = String.format("SELECT * FROM %s ORDER BY id DESC", TABLE_NAME);
|
|
||||||
private static final String DELETE_BY_ID = String.format("DELETE FROM %s WHERE id = :id", TABLE_NAME);
|
|
||||||
private static final String SELECT_BY_JOB_CARD_ID = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME);
|
|
||||||
|
|
||||||
private static final String INSERT_QUERY = String.format(
|
|
||||||
"INSERT INTO %s (" +
|
|
||||||
"id, item_id, sku, barcode, job_card_id, created_at, created_by, " +
|
|
||||||
"is_qa, finish_item_id, is_segregated, account_id, qa_status, bundle_id, account_title" +
|
|
||||||
") VALUES (" +
|
|
||||||
":id, :item_id, :sku, :barcode, :job_card_id, :created_at, :created_by, " +
|
|
||||||
":is_qa, :finish_item_id, :is_segregated, :account_id, :qa_status, :bundle_id, :account_title" +
|
|
||||||
") ON DUPLICATE KEY UPDATE " +
|
|
||||||
"item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), " +
|
|
||||||
"job_card_id = VALUES(job_card_id), created_at = VALUES(created_at), created_by = VALUES(created_by), " +
|
|
||||||
"is_qa = VALUES(is_qa), finish_item_id = VALUES(finish_item_id), " +
|
|
||||||
"is_segregated = VALUES(is_segregated), account_id = VALUES(account_id), " +
|
|
||||||
"qa_status = VALUES(qa_status), bundle_id = VALUES(bundle_id), account_title = VALUES(account_title)",
|
|
||||||
TABLE_NAME
|
|
||||||
);
|
|
||||||
private final String SELECT_BY_DATE_AND_IDs = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR created_at >=:start_date) AND created_at <= :end_date AND id IN (:ids)", TABLE_NAME );
|
|
||||||
|
|
||||||
public PackagingItemsDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MapSqlParameterSource prepareParams(PackagingItems item) {
|
|
||||||
return new MapSqlParameterSource()
|
|
||||||
.addValue("id", item.getId())
|
|
||||||
.addValue("item_id", item.getItemId())
|
|
||||||
.addValue("sku", item.getSku())
|
|
||||||
.addValue("barcode", item.getBarcode())
|
|
||||||
.addValue("job_card_id", item.getJobCardId())
|
|
||||||
.addValue("created_at", item.getCreatedAt())
|
|
||||||
.addValue("created_by", item.getCreatedBy())
|
|
||||||
.addValue("is_qa", item.getIsQa())
|
|
||||||
.addValue("finish_item_id", item.getFinishedItemId())
|
|
||||||
.addValue("is_segregated", item.getIsSegregated())
|
|
||||||
.addValue("account_id", item.getAccountId())
|
|
||||||
.addValue("qa_status", item.getQaStatus())
|
|
||||||
.addValue("bundle_id", item.getBundleId())
|
|
||||||
.addValue("account_title", item.getAccountTitle());
|
|
||||||
}
|
|
||||||
|
|
||||||
public PackagingItems find(long id) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource("id", id);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_ID, params, new PackagingItemsRowMapper())
|
|
||||||
.stream().findFirst().orElse(new PackagingItems());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PackagingItems> findAll() {
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_ALL, new PackagingItemsRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public long save(PackagingItems item) {
|
|
||||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
|
||||||
MapSqlParameterSource params = prepareParams(item);
|
|
||||||
namedParameterJdbcTemplate.update(INSERT_QUERY, params, keyHolder);
|
|
||||||
return KeyHolderFunctions.getKey(item.getId(), keyHolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] saveAll(List<PackagingItems> items) {
|
|
||||||
List<MapSqlParameterSource> batchParams = new ArrayList<>();
|
|
||||||
for (PackagingItems item : items) {
|
|
||||||
batchParams.add(prepareParams(item));
|
|
||||||
}
|
|
||||||
return namedParameterJdbcTemplate.batchUpdate(INSERT_QUERY, batchParams.toArray(new MapSqlParameterSource[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean delete(long id) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource("id", id);
|
|
||||||
return namedParameterJdbcTemplate.update(DELETE_BY_ID, params) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PackagingItems> findByJobCardId(long jobCardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource("job_card_id", jobCardId);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_JOB_CARD_ID, params, new PackagingItemsRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long findByDateAndIds(String startDate, String endDate,List<Long> ids){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "start_date", startDate );
|
|
||||||
params.addValue( "end_date", endDate );
|
|
||||||
params.addValue( "ids", ids );
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_AND_IDs, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.PackagingItems;
|
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class PackagingItemsRowMapper implements RowMapper<PackagingItems> {
|
|
||||||
@Override
|
|
||||||
public PackagingItems mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
||||||
PackagingItems item = new PackagingItems();
|
|
||||||
item.setId(rs.getLong("id"));
|
|
||||||
item.setItemId(rs.getLong("item_id"));
|
|
||||||
item.setSku(rs.getString("sku"));
|
|
||||||
item.setBarcode(rs.getString("barcode"));
|
|
||||||
item.setJobCardId(rs.getLong("job_card_id"));
|
|
||||||
item.setCreatedAt(rs.getTimestamp("created_at") != null ? rs.getTimestamp("created_at").toLocalDateTime() : null);
|
|
||||||
item.setCreatedBy(rs.getString("created_by"));
|
|
||||||
item.setIsQa(rs.getBoolean("is_qa"));
|
|
||||||
item.setFinishedItemId(rs.getLong("finish_item_id"));
|
|
||||||
item.setIsSegregated(rs.getBoolean("is_segregated"));
|
|
||||||
item.setAccountId(rs.getLong("account_id"));
|
|
||||||
item.setQaStatus(rs.getString("qa_status"));
|
|
||||||
item.setBundleId(rs.getLong("bundle_id"));
|
|
||||||
item.setAccountTitle(rs.getString("account_title"));
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.dao.uind.PurchaseOrderRowMapper;
|
|
||||||
import com.utopiaindustries.model.ctp.JobCard;
|
|
||||||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
|
||||||
import com.utopiaindustries.model.uind.PurchaseOrder;
|
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
||||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
|
||||||
import org.springframework.jdbc.support.KeyHolder;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class PurchaseOrderCTPDao {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
|
||||||
|
|
||||||
private final String TABLE_NAME = "cut_to_pack.purchase_order";
|
|
||||||
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
|
|
||||||
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ", TABLE_NAME );
|
|
||||||
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) " +
|
|
||||||
"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)",
|
|
||||||
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 );
|
|
||||||
|
|
||||||
|
|
||||||
// prepare query params
|
|
||||||
private MapSqlParameterSource prepareInsertQueryParams(PurchaseOrderCTP purchaseOrderCTP) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("id", purchaseOrderCTP.getId())
|
|
||||||
.addValue("purchase_order_code", purchaseOrderCTP.getPurchaseOrderCode())
|
|
||||||
.addValue("purchase_order_quantity", purchaseOrderCTP.getPurchaseOrderQuantity())
|
|
||||||
.addValue("purchase_order_quantity_required", purchaseOrderCTP.getPurchaseOrderQuantityRequired())
|
|
||||||
.addValue("article_name", purchaseOrderCTP.getArticleName())
|
|
||||||
.addValue("created_by", purchaseOrderCTP.getCreatedBy())
|
|
||||||
.addValue("status", purchaseOrderCTP.getStatus());
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// find
|
|
||||||
public PurchaseOrderCTP find(long id ) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "id", id );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_QUERY, params, new PurchaseOrderCTPRowMapper() )
|
|
||||||
.stream()
|
|
||||||
.findFirst()
|
|
||||||
.orElse( new PurchaseOrderCTP() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// find all
|
|
||||||
public List<PurchaseOrderCTP> findAll() {
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY, new PurchaseOrderCTPRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// save
|
|
||||||
public long save( PurchaseOrderCTP PurchaseOrderCTP) {
|
|
||||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
|
||||||
MapSqlParameterSource params = prepareInsertQueryParams(PurchaseOrderCTP);
|
|
||||||
namedParameterJdbcTemplate.update( INSERT_QUERY, params, keyHolder );
|
|
||||||
return KeyHolderFunctions.getKey( PurchaseOrderCTP.getId(), keyHolder );
|
|
||||||
}
|
|
||||||
|
|
||||||
// save all
|
|
||||||
public int[] saveAll( List<PurchaseOrderCTP> purchaseOrderCTPS) {
|
|
||||||
List<MapSqlParameterSource> batchArgs = new ArrayList<>();
|
|
||||||
for ( PurchaseOrderCTP PurchaseOrderCTP : purchaseOrderCTPS) {
|
|
||||||
MapSqlParameterSource params = prepareInsertQueryParams(PurchaseOrderCTP);
|
|
||||||
batchArgs.add( params );
|
|
||||||
}
|
|
||||||
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[purchaseOrderCTPS.size()]) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete
|
|
||||||
public boolean delete( long id ) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "id", id );
|
|
||||||
return namedParameterJdbcTemplate.update( DELETE_QUERY, params ) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PurchaseOrderCTP> findByQuery(String query ){
|
|
||||||
return namedParameterJdbcTemplate.query( query, new PurchaseOrderCTPRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PurchaseOrderCTP> findByUserAndLimit(String createdBy, Long limit ){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("limit", limit.intValue() );
|
|
||||||
params.addValue("created_by", createdBy );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_LIMIT, params, new PurchaseOrderCTPRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PurchaseOrderCTP> findByPoCode(String poCode){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("purchase_order_code", poCode);
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_PO_CODE, params, new PurchaseOrderCTPRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* find by term
|
|
||||||
* */
|
|
||||||
public List<PurchaseOrderCTP> findByTerm(String term ){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("term", "%" + term + "%" );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_TERM, params, new PurchaseOrderCTPRowMapper() );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class PurchaseOrderCTPRowMapper implements RowMapper<PurchaseOrderCTP> {
|
|
||||||
public PurchaseOrderCTP mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
||||||
PurchaseOrderCTP PurchaseOrderCTP = new PurchaseOrderCTP();
|
|
||||||
PurchaseOrderCTP.setId(rs.getLong("id"));
|
|
||||||
PurchaseOrderCTP.setPurchaseOrderCode(rs.getString("purchase_order_code"));
|
|
||||||
PurchaseOrderCTP.setPurchaseOrderQuantity(rs.getInt("purchase_order_quantity"));
|
|
||||||
PurchaseOrderCTP.setPurchaseOrderQuantityRequired(rs.getInt("purchase_order_quantity_required"));
|
|
||||||
PurchaseOrderCTP.setArticleName(rs.getString("article_name"));
|
|
||||||
if (rs.getTimestamp("created_at") != null) {
|
|
||||||
PurchaseOrderCTP.setCreatedAt(rs.getTimestamp("created_at").toLocalDateTime());
|
|
||||||
}
|
|
||||||
PurchaseOrderCTP.setCreatedBy(rs.getString("created_by"));
|
|
||||||
PurchaseOrderCTP.setStatus(rs.getString("status"));
|
|
||||||
return PurchaseOrderCTP;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
package com.utopiaindustries.dao.ctp;
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.FinishedItem;
|
|
||||||
import com.utopiaindustries.model.ctp.InventoryTransactionLeg;
|
|
||||||
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
|
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||||
|
@ -24,17 +22,12 @@ public class StitchingOfflineItemDAO {
|
||||||
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
|
||||||
private final String SELECT_QUERY_BY_JOB_CARD = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
|
private final String SELECT_QUERY_BY_JOB_CARD = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
|
||||||
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", 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, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, qa_remarks, qa_status,bundle_id, qc_done_at) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :qa_remarks, :qa_status, :bundle_id, :qc_done_at) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), qa_remarks = VALUES(qa_remarks), qa_status = VALUES(qa_status), bundle_id = VALUES(bundle_id), qc_done_at = VALUES(qc_done_at)", TABLE_NAME );
|
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, qa_remarks, qa_status,bundle_id) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :qa_remarks, :qa_status, :bundle_id) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), qa_remarks = VALUES(qa_remarks), qa_status = VALUES(qa_status), bundle_id = VALUES(bundle_id)", TABLE_NAME );
|
||||||
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME );
|
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME );
|
||||||
private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME );
|
private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME );
|
||||||
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
|
||||||
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term ORDER BY ID DESC", TABLE_NAME );
|
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term ORDER BY ID DESC", TABLE_NAME );
|
||||||
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
|
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
|
||||||
private final String COUNT_TOTAL_QA_ITEMS= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa IS TRUE",TABLE_NAME);
|
|
||||||
private final String SELECT_BY_TIME_AND_CARD_ID= String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1;",TABLE_NAME);
|
|
||||||
private final String SELECT_BY_JOB_CARD_AND_DATE = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR created_at BETWEEN :start_date AND :end_date)", TABLE_NAME );
|
|
||||||
private final String SELECT_BY_DATE_QA_STATUS = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR qc_done_at >= :start_date) AND qc_done_at <= :end_date AND qa_status = :qa_status AND id IN (:ids)", TABLE_NAME );
|
|
||||||
private final String SELECT_BY_DATE_QA_STATUS_APPROVED= String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR qc_done_at >= :start_date) AND qc_done_at <= :end_date AND qa_status = :qa_status", TABLE_NAME );
|
|
||||||
|
|
||||||
public StitchingOfflineItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
public StitchingOfflineItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||||
|
@ -53,7 +46,6 @@ public class StitchingOfflineItemDAO {
|
||||||
.addValue("job_card_id", stitchingOfflineItem.getJobCardId() )
|
.addValue("job_card_id", stitchingOfflineItem.getJobCardId() )
|
||||||
.addValue("is_qa", stitchingOfflineItem.getIsQa() )
|
.addValue("is_qa", stitchingOfflineItem.getIsQa() )
|
||||||
.addValue("qa_remarks", stitchingOfflineItem.getQaRemarks() )
|
.addValue("qa_remarks", stitchingOfflineItem.getQaRemarks() )
|
||||||
.addValue("qc_done_at", stitchingOfflineItem.getQcDoneAt() )
|
|
||||||
.addValue("qa_status", stitchingOfflineItem.getQaStatus() );
|
.addValue("qa_status", stitchingOfflineItem.getQaStatus() );
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
@ -149,46 +141,4 @@ public class StitchingOfflineItemDAO {
|
||||||
return totalCounts;
|
return totalCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long CalculateTotalQA( long jobCardId ){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardId );
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_QA_ITEMS, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StitchingOfflineItem getLastStitchItemByCardIdAndTime(long jobCardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardId);
|
|
||||||
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_TIME_AND_CARD_ID, params,new StitchingOfflineItemRowMapper())
|
|
||||||
.stream()
|
|
||||||
.findFirst()
|
|
||||||
.orElse( new StitchingOfflineItem() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StitchingOfflineItem> findByJobCardIdAndDate(long jobCardId, String startDate, String endDate){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "job_card_id", jobCardId );
|
|
||||||
params.addValue( "start_date", startDate );
|
|
||||||
params.addValue( "end_date", endDate );
|
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD_AND_DATE , params, new StitchingOfflineItemRowMapper() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long findByQCOperationDateAndIds(String startDate, String endDate, String qaStatus, List<Long> ids){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "start_date", startDate );
|
|
||||||
params.addValue( "end_date", endDate );
|
|
||||||
params.addValue( "qa_status", qaStatus );
|
|
||||||
params.addValue( "ids", ids);
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_QA_STATUS, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
public Long findByQCOperationDateAndApproved(String startDate, String endDate, String qaStatus){
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue( "start_date", startDate );
|
|
||||||
params.addValue( "end_date", endDate );
|
|
||||||
params.addValue( "qa_status", qaStatus );
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_QA_STATUS_APPROVED, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,6 @@ public class StitchingOfflineItemRowMapper implements RowMapper<StitchingOffline
|
||||||
if ( rs.getTimestamp( "created_at" ) != null ) {
|
if ( rs.getTimestamp( "created_at" ) != null ) {
|
||||||
stitchingOfflineItem.setCreatedAt( rs.getTimestamp( "created_at" ).toLocalDateTime() );
|
stitchingOfflineItem.setCreatedAt( rs.getTimestamp( "created_at" ).toLocalDateTime() );
|
||||||
}
|
}
|
||||||
if ( rs.getTimestamp( "qc_done_at" ) != null ) {
|
|
||||||
stitchingOfflineItem.setQcDoneAt( rs.getTimestamp( "qc_done_at" ).toLocalDateTime() );
|
|
||||||
}
|
|
||||||
stitchingOfflineItem.setCreatedBy( rs.getString( "created_by" ) );
|
stitchingOfflineItem.setCreatedBy( rs.getString( "created_by" ) );
|
||||||
stitchingOfflineItem.setJobCardId( rs.getLong("job_card_id") );
|
stitchingOfflineItem.setJobCardId( rs.getLong("job_card_id") );
|
||||||
stitchingOfflineItem.setIsQa( rs.getBoolean("is_qa"));
|
stitchingOfflineItem.setIsQa( rs.getBoolean("is_qa"));
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.StoreItem;
|
|
||||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
||||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
|
||||||
import org.springframework.jdbc.support.KeyHolder;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class StoreItemDao {
|
|
||||||
|
|
||||||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
|
||||||
|
|
||||||
private static final String TABLE_NAME = "store_items";
|
|
||||||
|
|
||||||
private static final String SELECT_BY_ID = String.format("SELECT * FROM %s WHERE id = :id", TABLE_NAME);
|
|
||||||
private static final String SELECT_ALL = String.format("SELECT * FROM %s ORDER BY id DESC", TABLE_NAME);
|
|
||||||
private static final String DELETE_BY_ID = String.format("DELETE FROM %s WHERE id = :id", TABLE_NAME);
|
|
||||||
private static final String SELECT_BY_JOB_CARD_ID = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME);
|
|
||||||
private final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME);
|
|
||||||
|
|
||||||
private static final String INSERT_QUERY = String.format(
|
|
||||||
"INSERT INTO %s (" +
|
|
||||||
"id, item_id, sku, barcode, job_card_id, created_at, created_by, " +
|
|
||||||
"finish_item_id, account_id, bundle_id, reject_reason" +
|
|
||||||
") VALUES (" +
|
|
||||||
":id, :item_id, :sku, :barcode, :job_card_id, :created_at, :created_by, " +
|
|
||||||
":finish_item_id, :account_id, :bundle_id, :reject_reason" +
|
|
||||||
") ON DUPLICATE KEY UPDATE " +
|
|
||||||
"item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), " +
|
|
||||||
"job_card_id = VALUES(job_card_id), created_at = VALUES(created_at), created_by = VALUES(created_by), " +
|
|
||||||
"finish_item_id = VALUES(finish_item_id), account_id = VALUES(account_id), bundle_id = VALUES(bundle_id), reject_reason = VALUES(reject_reason)",
|
|
||||||
TABLE_NAME
|
|
||||||
);
|
|
||||||
String SELECT_BY_JOB_CARD_GROUP_REJECT_REASON = String.format("SELECT reject_reason, COUNT(*) AS total FROM %s WHERE job_card_id IN (:job_card_id) GROUP BY reject_reason", TABLE_NAME);
|
|
||||||
|
|
||||||
private static final String SELECT_BY_DATE_AND_IDs = String.format("SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR created_at >= :start_date) AND created_at <= :end_date AND id IN (:ids)", TABLE_NAME);
|
|
||||||
|
|
||||||
public StoreItemDao(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
|
||||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MapSqlParameterSource prepareParams(StoreItem item) {
|
|
||||||
return new MapSqlParameterSource()
|
|
||||||
.addValue("id", item.getId())
|
|
||||||
.addValue("item_id", item.getItemId())
|
|
||||||
.addValue("sku", item.getSku())
|
|
||||||
.addValue("barcode", item.getBarcode())
|
|
||||||
.addValue("job_card_id", item.getJobCardId())
|
|
||||||
.addValue("created_at", item.getCreatedAt())
|
|
||||||
.addValue("created_by", item.getCreatedBy())
|
|
||||||
.addValue("finish_item_id", item.getFinishedItemId())
|
|
||||||
.addValue("account_id", item.getAccountId())
|
|
||||||
.addValue("bundle_id", item.getBundleId())
|
|
||||||
.addValue("reject_reason", item.getRejectedReason());
|
|
||||||
}
|
|
||||||
|
|
||||||
public StoreItem find(long id) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource("id", id);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_ID, params, new StoreItemRowMapper())
|
|
||||||
.stream().findFirst().orElse(new StoreItem());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StoreItem> findAll() {
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_ALL, new StoreItemRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public long save(StoreItem item) {
|
|
||||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
|
||||||
MapSqlParameterSource params = prepareParams(item);
|
|
||||||
namedParameterJdbcTemplate.update(INSERT_QUERY, params, keyHolder);
|
|
||||||
return KeyHolderFunctions.getKey(item.getId(), keyHolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] saveAll(List<StoreItem> items) {
|
|
||||||
List<MapSqlParameterSource> batchParams = new ArrayList<>();
|
|
||||||
for (StoreItem item : items) {
|
|
||||||
batchParams.add(prepareParams(item));
|
|
||||||
}
|
|
||||||
return namedParameterJdbcTemplate.batchUpdate(INSERT_QUERY, batchParams.toArray(new MapSqlParameterSource[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean delete(long id) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource("id", id);
|
|
||||||
return namedParameterJdbcTemplate.update(DELETE_BY_ID, params) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StoreItem> findByJobCardId(long jobCardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource("job_card_id", jobCardId);
|
|
||||||
return namedParameterJdbcTemplate.query(SELECT_BY_JOB_CARD_ID, params, new StoreItemRowMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long calculateTotalRejectItemByJobCardId(long jobCardId) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardId);
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_FINISH_ITEM, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long findByDateAndIds(String startDate, String endDate, List<Long> ids) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("start_date", startDate);
|
|
||||||
params.addValue("end_date", endDate);
|
|
||||||
params.addValue("ids", ids);
|
|
||||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_AND_IDs, params, Long.class);
|
|
||||||
return count != null ? count : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Integer> totalCountByJobCardIdsAndGroupByRejectReason(List<Long> jobCardIds) {
|
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
|
||||||
params.addValue("job_card_id", jobCardIds);
|
|
||||||
|
|
||||||
List<Map<String, Object>> rows = namedParameterJdbcTemplate.queryForList(SELECT_BY_JOB_CARD_GROUP_REJECT_REASON, params);
|
|
||||||
|
|
||||||
Map<String, Integer> result = new HashMap<>();
|
|
||||||
for (Map<String, Object> row : rows) {
|
|
||||||
String reason = (String) row.get("reject_reason");
|
|
||||||
Integer total = ((Number) row.get("total")).intValue();
|
|
||||||
result.put(reason, total);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.utopiaindustries.dao.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.PackagingItems;
|
|
||||||
import com.utopiaindustries.model.ctp.StoreItem;
|
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class StoreItemRowMapper implements RowMapper<StoreItem> {
|
|
||||||
@Override
|
|
||||||
public StoreItem mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
||||||
StoreItem item = new StoreItem();
|
|
||||||
item.setId(rs.getLong("id"));
|
|
||||||
item.setItemId(rs.getLong("item_id"));
|
|
||||||
item.setSku(rs.getString("sku"));
|
|
||||||
item.setBarcode(rs.getString("barcode"));
|
|
||||||
item.setJobCardId(rs.getLong("job_card_id"));
|
|
||||||
item.setCreatedAt(rs.getTimestamp("created_at") != null ? rs.getTimestamp("created_at").toLocalDateTime() : null);
|
|
||||||
item.setCreatedBy(rs.getString("created_by"));
|
|
||||||
item.setFinishedItemId(rs.getLong("finish_item_id"));
|
|
||||||
item.setAccountId(rs.getLong("account_id"));
|
|
||||||
item.setBundleId(rs.getLong("bundle_id"));
|
|
||||||
item.setRejectedReason(rs.getString("reject_reason"));
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,7 +13,7 @@ public class SummaryInventoryReportDao {
|
||||||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||||
|
|
||||||
private final String TABLE_NAME = "cut_to_pack.inventory_transaction_leg ";
|
private final String TABLE_NAME = "cut_to_pack.inventory_transaction_leg ";
|
||||||
String SELECT_QUERY = "SELECT job_card_id, item_id, account_id, parent_document_id, DATE(transaction_leg_datetime) AS transaction_date, "
|
String SELECT_QUERY = "SELECT item_id, account_id, parent_document_id, DATE(transaction_leg_datetime) AS transaction_date, "
|
||||||
+ "sku, parent_document_type, parent_document_piece_type, "
|
+ "sku, parent_document_type, parent_document_piece_type, "
|
||||||
+ "SUM(CASE WHEN type = 'IN' THEN 1 ELSE 0 END) AS total_in, "
|
+ "SUM(CASE WHEN type = 'IN' THEN 1 ELSE 0 END) AS total_in, "
|
||||||
+ "SUM(CASE WHEN type = 'OUT' THEN 1 ELSE 0 END) AS total_out "
|
+ "SUM(CASE WHEN type = 'OUT' THEN 1 ELSE 0 END) AS total_out "
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class SummaryInventoryReportRowMapper implements RowMapper<SummaryInvento
|
||||||
summaryInventoryReport.setAccountId(rs.getString("account_id"));
|
summaryInventoryReport.setAccountId(rs.getString("account_id"));
|
||||||
summaryInventoryReport.setDate(rs.getString("transaction_date"));
|
summaryInventoryReport.setDate(rs.getString("transaction_date"));
|
||||||
summaryInventoryReport.setTotalIn(rs.getLong("total_in"));
|
summaryInventoryReport.setTotalIn(rs.getLong("total_in"));
|
||||||
summaryInventoryReport.setJobCardID(rs.getLong("job_card_id"));
|
|
||||||
summaryInventoryReport.setTotalOut(rs.getLong("total_out"));
|
summaryInventoryReport.setTotalOut(rs.getLong("total_out"));
|
||||||
summaryInventoryReport.setParentDocumentType(rs.getString("parent_document_type"));
|
summaryInventoryReport.setParentDocumentType(rs.getString("parent_document_type"));
|
||||||
summaryInventoryReport.setParentDocumentPieceType(rs.getString("parent_document_piece_type"));
|
summaryInventoryReport.setParentDocumentPieceType(rs.getString("parent_document_piece_type"));
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ItemDAO {
|
||||||
TABLE_NAME);
|
TABLE_NAME);
|
||||||
private final String SELECT_BY_IDS = String.format("SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME);
|
private final String SELECT_BY_IDS = String.format("SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME);
|
||||||
private final String SELECT_BY_IDS_AND_ACTIVE = String.format("SELECT * FROM %s WHERE id IN (:ids) AND is_active = 1 ", TABLE_NAME);
|
private final String SELECT_BY_IDS_AND_ACTIVE = String.format("SELECT * FROM %s WHERE id IN (:ids) AND is_active = 1 ", TABLE_NAME);
|
||||||
private final String SELECT_LIKE_TITLE_AND_STATUS_QUERY_OR_SKU = String.format("SELECT * FROM %s WHERE is_active = :is_active AND title LIKE :title OR sku LIKE :sku ORDER BY title ASC limit 100 offset 0", TABLE_NAME);
|
private final String SELECT_LIKE_TITLE_AND_STATUS_QUERY = String.format("SELECT * FROM %s WHERE is_active = :is_active AND title LIKE :title ORDER BY title ASC limit 100 offset 0", TABLE_NAME);
|
||||||
private final String SELECT_LIKE_TITLE_BY_DEPARTMENT_QUERY =
|
private final String SELECT_LIKE_TITLE_BY_DEPARTMENT_QUERY =
|
||||||
String.format("SELECT * FROM %s WHERE department_id = :department_id AND title LIKE :title ORDER BY title ASC", TABLE_NAME);
|
String.format("SELECT * FROM %s WHERE department_id = :department_id AND title LIKE :title ORDER BY title ASC", TABLE_NAME);
|
||||||
private final String SELECT_LIKE_TITLE = String.format("SELECT * FROM %s WHERE title LIKE :item_title", TABLE_NAME);
|
private final String SELECT_LIKE_TITLE = String.format("SELECT * FROM %s WHERE title LIKE :item_title", TABLE_NAME);
|
||||||
|
@ -232,12 +232,11 @@ public class ItemDAO {
|
||||||
}
|
}
|
||||||
|
|
||||||
// find all like title (active only)
|
// find all like title (active only)
|
||||||
public List<Item> findLikeTitleAndStatusORSKU(String title, boolean active) {
|
public List<Item> findLikeTitleAndStatus(String title, boolean active) {
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("title", "%" + title + "%");
|
params.addValue("title", "%" + title + "%");
|
||||||
params.addValue("is_active", active);
|
params.addValue("is_active", active);
|
||||||
params.addValue("sku", "%" + title + "%");
|
return namedParameterJdbcTemplate.query(SELECT_LIKE_TITLE_AND_STATUS_QUERY, params, new ItemRowMapper());
|
||||||
return namedParameterJdbcTemplate.query(SELECT_LIKE_TITLE_AND_STATUS_QUERY_OR_SKU, params, new ItemRowMapper());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find all like title and department
|
// find all like title and department
|
||||||
|
|
|
@ -9,8 +9,5 @@ public enum Roles {
|
||||||
ROLE_QUALITY_CONTROL,
|
ROLE_QUALITY_CONTROL,
|
||||||
ROLE_FINISHING,
|
ROLE_FINISHING,
|
||||||
ROLE_PACKAGING,
|
ROLE_PACKAGING,
|
||||||
ROLE_REPORTING,
|
ROLE_REPORTING
|
||||||
ROLE_PURCHASE_ORDER,
|
|
||||||
ROLE_INVENTORY_ACCOUNT,
|
|
||||||
ROLE_STORE
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ public enum BarcodeStickerSize {
|
||||||
SIZE_4_X_4( 4 * 72, 4 * 72, 8, 8, 8, 8, 200, 100, 250, 250, 14, 9, 7),
|
SIZE_4_X_4( 4 * 72, 4 * 72, 8, 8, 8, 8, 200, 100, 250, 250, 14, 9, 7),
|
||||||
SIZE_1_75_X_3_5( 3.5f * 72, 1.75f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7),
|
SIZE_1_75_X_3_5( 3.5f * 72, 1.75f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7),
|
||||||
SIZE_4_X_7( 7f * 72, 4f * 72, 200, 10, 40, 6, 50, 40, 125, 125, 14, 9, 7),
|
SIZE_4_X_7( 7f * 72, 4f * 72, 200, 10, 40, 6, 50, 40, 125, 125, 14, 9, 7),
|
||||||
SIZE_1_X_2( 67.69f, 139.73f ,10 , 10, 20, 6, 60, 60, 125, 125, 4, 9, 7);
|
SIZE_1_X_2( 67.69f, 128.73f ,10 , 10, 20, 6, 60, 60, 125, 125, 4, 9, 7);
|
||||||
|
|
||||||
private final float width;
|
private final float width;
|
||||||
private final float height;
|
private final float height;
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
|
||||||
|
|
||||||
public class CuttingJobCardItemWrapper {
|
|
||||||
private long jobCardId;
|
|
||||||
private String poName;
|
|
||||||
private String sku;
|
|
||||||
private Long total;
|
|
||||||
private String width;
|
|
||||||
private String length;
|
|
||||||
private String gsm;
|
|
||||||
private String wtPly;
|
|
||||||
private String ply;
|
|
||||||
private String articleName;
|
|
||||||
private boolean isComplete;
|
|
||||||
private String jobCardCode;
|
|
||||||
private String operatorName;
|
|
||||||
private long accountId;
|
|
||||||
|
|
||||||
public long getJobCardId() {
|
|
||||||
return jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCardId(long jobCardId) {
|
|
||||||
this.jobCardId = jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPoName() {
|
|
||||||
return poName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoName(String poName) {
|
|
||||||
this.poName = poName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSku() {
|
|
||||||
return sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSku(String sku) {
|
|
||||||
this.sku = sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(String width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGsm() {
|
|
||||||
return gsm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGsm(String gsm) {
|
|
||||||
this.gsm = gsm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWtPly() {
|
|
||||||
return wtPly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWtPly(String wtPly) {
|
|
||||||
this.wtPly = wtPly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPly() {
|
|
||||||
return ply;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPly(String ply) {
|
|
||||||
this.ply = ply;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArticleName() {
|
|
||||||
return articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArticleName(String articleName) {
|
|
||||||
this.articleName = articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isComplete() {
|
|
||||||
return isComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComplete(boolean complete) {
|
|
||||||
isComplete = complete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJobCardCode() {
|
|
||||||
return jobCardCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCardCode(String jobCardCode) {
|
|
||||||
this.jobCardCode = jobCardCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getLength() {
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLength(String length) {
|
|
||||||
this.length = length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOperatorName() {
|
|
||||||
return operatorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOperatorName(String operatorName) {
|
|
||||||
this.operatorName = operatorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAccountId() {
|
|
||||||
return accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountId(long accountId) {
|
|
||||||
this.accountId = accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTotal() {
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotal(Long total) {
|
|
||||||
this.total = total;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CuttingJobCardItemWrapper{" +
|
|
||||||
"jobCardId=" + jobCardId +
|
|
||||||
", poName='" + poName + '\'' +
|
|
||||||
", sku='" + sku + '\'' +
|
|
||||||
", total=" + total +
|
|
||||||
", width='" + width + '\'' +
|
|
||||||
", length='" + length + '\'' +
|
|
||||||
", gsm='" + gsm + '\'' +
|
|
||||||
", wtPly='" + wtPly + '\'' +
|
|
||||||
", ply='" + ply + '\'' +
|
|
||||||
", articleName='" + articleName + '\'' +
|
|
||||||
", isComplete=" + isComplete +
|
|
||||||
", jobCardCode='" + jobCardCode + '\'' +
|
|
||||||
", operatorName='" + operatorName + '\'' +
|
|
||||||
", accountId=" + accountId +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,11 +23,7 @@ public class FinishedItem implements InventoryArtifact {
|
||||||
private JobCard jobCard;
|
private JobCard jobCard;
|
||||||
private long accountId;
|
private long accountId;
|
||||||
private String qaStatus;
|
private String qaStatus;
|
||||||
private boolean isPackaging;
|
|
||||||
private boolean isStore;
|
|
||||||
|
|
||||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
|
||||||
private LocalDateTime operationDate;
|
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -158,30 +154,6 @@ public class FinishedItem implements InventoryArtifact {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPackaging() {
|
|
||||||
return isPackaging;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPackaging(boolean packaging) {
|
|
||||||
isPackaging = packaging;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getOperationDate() {
|
|
||||||
return operationDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOperationDate(LocalDateTime operationDate) {
|
|
||||||
this.operationDate = operationDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isStore() {
|
|
||||||
return isStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStore(boolean store) {
|
|
||||||
isStore = store;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FinishedItem{" +
|
return "FinishedItem{" +
|
||||||
|
|
|
@ -4,10 +4,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class FinishedItemWrapper {
|
public class FinishedItemWrapper {
|
||||||
|
|
||||||
private String qaStatus;
|
|
||||||
private Long accountId;
|
|
||||||
private String rejectReason;
|
|
||||||
|
|
||||||
private List<FinishedItem> items;
|
private List<FinishedItem> items;
|
||||||
|
|
||||||
public List<FinishedItem> getItems() {
|
public List<FinishedItem> getItems() {
|
||||||
|
@ -18,30 +14,6 @@ public class FinishedItemWrapper {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQaStatus() {
|
|
||||||
return qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQaStatus(String qaStatus) {
|
|
||||||
this.qaStatus = qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getAccountId() {
|
|
||||||
return accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountId(Long accountId) {
|
|
||||||
this.accountId = accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRejectReason() {
|
|
||||||
return rejectReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRejectReason(String rejectReason) {
|
|
||||||
this.rejectReason = rejectReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FinishedItemWrapper{" +
|
return "FinishedItemWrapper{" +
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
package com.utopiaindustries.model.ctp;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
public class InventoryAccount {
|
public class InventoryAccount {
|
||||||
|
@ -15,12 +14,6 @@ public class InventoryAccount {
|
||||||
private Integer locationSiteId;
|
private Integer locationSiteId;
|
||||||
private String notes;
|
private String notes;
|
||||||
private Boolean isPackaging;
|
private Boolean isPackaging;
|
||||||
private String articleName;
|
|
||||||
private long shiftMinutes;
|
|
||||||
private long totalMachines;
|
|
||||||
private BigDecimal efficiency;
|
|
||||||
private BigDecimal sam;
|
|
||||||
|
|
||||||
//wrapper
|
//wrapper
|
||||||
private String locationTitle;
|
private String locationTitle;
|
||||||
|
|
||||||
|
@ -112,45 +105,6 @@ public class InventoryAccount {
|
||||||
this.locationTitle = locationTitle;
|
this.locationTitle = locationTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArticleName() {
|
|
||||||
return articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArticleName(String articleName) {
|
|
||||||
this.articleName = articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getShiftMinutes() {
|
|
||||||
return shiftMinutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShiftMinutes(long shiftMinutes) {
|
|
||||||
this.shiftMinutes = shiftMinutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTotalMachines() {
|
|
||||||
return totalMachines;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalMachines(long totalMachines) {
|
|
||||||
this.totalMachines = totalMachines;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getEfficiency() {
|
|
||||||
return efficiency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEfficiency(BigDecimal efficiency) {
|
|
||||||
this.efficiency = efficiency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getSam() {
|
|
||||||
return sam;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSam(BigDecimal sam) {
|
|
||||||
this.sam = sam;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -165,10 +119,6 @@ public class InventoryAccount {
|
||||||
", locationSiteId=" + locationSiteId +
|
", locationSiteId=" + locationSiteId +
|
||||||
", notes='" + notes + '\'' +
|
", notes='" + notes + '\'' +
|
||||||
", isPackaging=" + isPackaging +
|
", isPackaging=" + isPackaging +
|
||||||
", articleName='" + articleName + '\'' +
|
|
||||||
", shiftMinutes=" + shiftMinutes +
|
|
||||||
", totalMachines=" + totalMachines +
|
|
||||||
", efficiency=" + efficiency +
|
|
||||||
", locationTitle='" + locationTitle + '\'' +
|
", locationTitle='" + locationTitle + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ public enum InventoryArtifactType {
|
||||||
BUNDLE,
|
BUNDLE,
|
||||||
STITCHING_OFFLINE,
|
STITCHING_OFFLINE,
|
||||||
FINISHED_ITEM,
|
FINISHED_ITEM,
|
||||||
STITCH_BUNDLE,
|
STITCH_BUNDLE
|
||||||
PACKAGING,
|
|
||||||
STORED_ITEM,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class InventoryTransactionLeg {
|
||||||
private String parentDocumentType;
|
private String parentDocumentType;
|
||||||
private long parentDocumentId;
|
private long parentDocumentId;
|
||||||
private String parentDocumentPieceType;
|
private String parentDocumentPieceType;
|
||||||
private long jobCardId;
|
|
||||||
//wrapper
|
//wrapper
|
||||||
private InventoryTransaction transaction;
|
private InventoryTransaction transaction;
|
||||||
|
|
||||||
|
@ -122,14 +122,6 @@ public class InventoryTransactionLeg {
|
||||||
this.parentDocumentPieceType = parentDocumentPieceType;
|
this.parentDocumentPieceType = parentDocumentPieceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getJobCardId() {
|
|
||||||
return jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCardId(long jobCardId) {
|
|
||||||
this.jobCardId = jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InventoryTransaction getTransaction() {
|
public InventoryTransaction getTransaction() {
|
||||||
return transaction;
|
return transaction;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,6 @@ public class JobCard {
|
||||||
private String purchaseOrderId;
|
private String purchaseOrderId;
|
||||||
private long locationSiteId;
|
private long locationSiteId;
|
||||||
private String description;
|
private String description;
|
||||||
private String articleName;
|
|
||||||
private int poQuantity;
|
|
||||||
// wrapper
|
// wrapper
|
||||||
private List<JobCardItem> items;
|
private List<JobCardItem> items;
|
||||||
private long toAccountId;
|
private long toAccountId;
|
||||||
|
@ -164,22 +162,6 @@ public class JobCard {
|
||||||
this.locationTitle = locationTitle;
|
this.locationTitle = locationTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArticleName() {
|
|
||||||
return articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArticleName(String articleName) {
|
|
||||||
this.articleName = articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPoQuantity() {
|
|
||||||
return poQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoQuantity(int poQuantity) {
|
|
||||||
this.poQuantity = poQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "JobCard{" +
|
return "JobCard{" +
|
||||||
|
@ -192,11 +174,9 @@ public class JobCard {
|
||||||
", inventoryStatus='" + inventoryStatus + '\'' +
|
", inventoryStatus='" + inventoryStatus + '\'' +
|
||||||
", customer='" + customer + '\'' +
|
", customer='" + customer + '\'' +
|
||||||
", lotNumber='" + lotNumber + '\'' +
|
", lotNumber='" + lotNumber + '\'' +
|
||||||
", purchaseOrderId='" + purchaseOrderId + '\'' +
|
", purchaseOrderId=" + purchaseOrderId +
|
||||||
", locationSiteId=" + locationSiteId +
|
", locationSiteId=" + locationSiteId +
|
||||||
", description='" + description + '\'' +
|
", description='" + description + '\'' +
|
||||||
", articleName='" + articleName + '\'' +
|
|
||||||
", poQuantity=" + poQuantity +
|
|
||||||
", items=" + items +
|
", items=" + items +
|
||||||
", toAccountId=" + toAccountId +
|
", toAccountId=" + toAccountId +
|
||||||
", purchaseOrderTitle='" + purchaseOrderTitle + '\'' +
|
", purchaseOrderTitle='" + purchaseOrderTitle + '\'' +
|
||||||
|
|
|
@ -23,7 +23,6 @@ public class JobCardItem {
|
||||||
private List<CutPiece> cutPieces;
|
private List<CutPiece> cutPieces;
|
||||||
private String title;
|
private String title;
|
||||||
private boolean isSelected;
|
private boolean isSelected;
|
||||||
private boolean isComplete;
|
|
||||||
|
|
||||||
public JobCardItem() {
|
public JobCardItem() {
|
||||||
this.expectedProduction = BigDecimal.ZERO;
|
this.expectedProduction = BigDecimal.ZERO;
|
||||||
|
@ -168,14 +167,6 @@ public class JobCardItem {
|
||||||
isSelected = selected;
|
isSelected = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete() {
|
|
||||||
return isComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComplete(boolean complete) {
|
|
||||||
isComplete = complete;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
|
|
@ -9,8 +9,6 @@ public class JobCardItemWrapper {
|
||||||
private long jobCardItemId;
|
private long jobCardItemId;
|
||||||
private List<CutPiece> pieces;
|
private List<CutPiece> pieces;
|
||||||
private BigDecimal actualProduction;
|
private BigDecimal actualProduction;
|
||||||
private int perBundleQuantity;
|
|
||||||
private boolean cuttingComplete;
|
|
||||||
|
|
||||||
public long getJobCardId() {
|
public long getJobCardId() {
|
||||||
return jobCardId;
|
return jobCardId;
|
||||||
|
@ -44,22 +42,6 @@ public class JobCardItemWrapper {
|
||||||
this.actualProduction = actualProduction;
|
this.actualProduction = actualProduction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPerBundleQuantity() {
|
|
||||||
return perBundleQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPerBundleQuantity(int perBundleQuantity) {
|
|
||||||
this.perBundleQuantity = perBundleQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getCuttingComplete() {
|
|
||||||
return cuttingComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCuttingComplete(boolean finalReceived) {
|
|
||||||
this.cuttingComplete = finalReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "JobCardItemWrapper{" +
|
return "JobCardItemWrapper{" +
|
||||||
|
|
|
@ -1,252 +0,0 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
|
||||||
|
|
||||||
public class POsDetails {
|
|
||||||
//po detail
|
|
||||||
private long poId;
|
|
||||||
private String poNumber;
|
|
||||||
private String articleTitle;
|
|
||||||
private long poQuantity;
|
|
||||||
private long poRequiredQuantity;
|
|
||||||
|
|
||||||
// items detail
|
|
||||||
private long actualCutting;
|
|
||||||
private long balanceToCutting;
|
|
||||||
private long cuttingReceived;
|
|
||||||
private long cuttingOki;
|
|
||||||
private long cuttingReject;
|
|
||||||
private long stitchingIn;
|
|
||||||
private long stitchingWips;
|
|
||||||
private long stitchingOut;
|
|
||||||
private long finishIn;
|
|
||||||
private long finishRej;
|
|
||||||
private long finishQaApproved;
|
|
||||||
private long storeReceived;
|
|
||||||
private long storeWaiting;
|
|
||||||
private long packagingIn;
|
|
||||||
private long packagingOut;
|
|
||||||
private long packagingStock;
|
|
||||||
private long shippedScan;
|
|
||||||
private long shippedNet;
|
|
||||||
private boolean poStatus;
|
|
||||||
|
|
||||||
public long getPoQuantity() {
|
|
||||||
return poQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoQuantity(long poQuantity) {
|
|
||||||
this.poQuantity = poQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPoNumber() {
|
|
||||||
return poNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoNumber(String poNumber) {
|
|
||||||
this.poNumber = poNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArticleTitle() {
|
|
||||||
return articleTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArticleTitle(String articleTitle) {
|
|
||||||
this.articleTitle = articleTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPoId() {
|
|
||||||
return poId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoId(long poId) {
|
|
||||||
this.poId = poId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPoRequiredQuantity() {
|
|
||||||
return poRequiredQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoRequiredQuantity(long poRequiredQuantity) {
|
|
||||||
this.poRequiredQuantity = poRequiredQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getActualCutting() {
|
|
||||||
return actualCutting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActualCutting(long actualCutting) {
|
|
||||||
this.actualCutting = actualCutting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getBalanceToCutting() {
|
|
||||||
return balanceToCutting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBalanceToCutting(long balanceToCutting) {
|
|
||||||
this.balanceToCutting = balanceToCutting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCuttingReceived() {
|
|
||||||
return cuttingReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCuttingReceived(long cuttingReceived) {
|
|
||||||
this.cuttingReceived = cuttingReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCuttingOki() {
|
|
||||||
return cuttingOki;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCuttingOki(long cuttingOki) {
|
|
||||||
this.cuttingOki = cuttingOki;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCuttingReject() {
|
|
||||||
return cuttingReject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCuttingReject(long cuttingReject) {
|
|
||||||
this.cuttingReject = cuttingReject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStitchingIn() {
|
|
||||||
return stitchingIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStitchingIn(long stitchingIn) {
|
|
||||||
this.stitchingIn = stitchingIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStitchingWips() {
|
|
||||||
return stitchingWips;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStitchingWips(long stitchingWips) {
|
|
||||||
this.stitchingWips = stitchingWips;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStitchingOut() {
|
|
||||||
return stitchingOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStitchingOut(long stitchingOut) {
|
|
||||||
this.stitchingOut = stitchingOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getFinishIn() {
|
|
||||||
return finishIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFinishIn(long finishIn) {
|
|
||||||
this.finishIn = finishIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getFinishRej() {
|
|
||||||
return finishRej;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFinishRej(long finishRej) {
|
|
||||||
this.finishRej = finishRej;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getFinishQaApproved() {
|
|
||||||
return finishQaApproved;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFinishQaApproved(long finishQaApproved) {
|
|
||||||
this.finishQaApproved = finishQaApproved;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStoreReceived() {
|
|
||||||
return storeReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStoreReceived(long storeReceived) {
|
|
||||||
this.storeReceived = storeReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStoreWaiting() {
|
|
||||||
return storeWaiting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStoreWaiting(long storeWaiting) {
|
|
||||||
this.storeWaiting = storeWaiting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPackagingIn() {
|
|
||||||
return packagingIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPackagingIn(long packagingIn) {
|
|
||||||
this.packagingIn = packagingIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPackagingOut() {
|
|
||||||
return packagingOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPackagingOut(long packagingOut) {
|
|
||||||
this.packagingOut = packagingOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPackagingStock() {
|
|
||||||
return packagingStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPackagingStock(long packagingStock) {
|
|
||||||
this.packagingStock = packagingStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getShippedScan() {
|
|
||||||
return shippedScan;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShippedScan(long shippedScan) {
|
|
||||||
this.shippedScan = shippedScan;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getShippedNet() {
|
|
||||||
return shippedNet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShippedNet(long shippedNet) {
|
|
||||||
this.shippedNet = shippedNet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPoStatus() {
|
|
||||||
return poStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoStatus(boolean poStatus) {
|
|
||||||
this.poStatus = poStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "POsDetails{" +
|
|
||||||
"poId=" + poId +
|
|
||||||
", poNumber='" + poNumber + '\'' +
|
|
||||||
", articleTitle='" + articleTitle + '\'' +
|
|
||||||
", poQuantity=" + poQuantity +
|
|
||||||
", poRequiredQuantity=" + poRequiredQuantity +
|
|
||||||
", actualCutting=" + actualCutting +
|
|
||||||
", balanceToCutting=" + balanceToCutting +
|
|
||||||
", cuttingReceived=" + cuttingReceived +
|
|
||||||
", cuttingOki=" + cuttingOki +
|
|
||||||
", cuttingReject=" + cuttingReject +
|
|
||||||
", stitchingIn=" + stitchingIn +
|
|
||||||
", stitchingWips=" + stitchingWips +
|
|
||||||
", stitchingOut=" + stitchingOut +
|
|
||||||
", finishIn=" + finishIn +
|
|
||||||
", finishRej=" + finishRej +
|
|
||||||
", finishQaApproved=" + finishQaApproved +
|
|
||||||
", storeReceived=" + storeReceived +
|
|
||||||
", storeWaiting=" + storeWaiting +
|
|
||||||
", packagingIn=" + packagingIn +
|
|
||||||
", packagingOut=" + packagingOut +
|
|
||||||
", packagingStock=" + packagingStock +
|
|
||||||
", shippedScan=" + shippedScan +
|
|
||||||
", shippedNet=" + shippedNet +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,180 +0,0 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
public class PackagingItems implements InventoryArtifact {
|
|
||||||
private long id;
|
|
||||||
private long itemId;
|
|
||||||
private String sku;
|
|
||||||
private String barcode;
|
|
||||||
private long jobCardId;
|
|
||||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
private String createdBy;
|
|
||||||
private boolean isQa;
|
|
||||||
private long finishedItemId;
|
|
||||||
private boolean isSegregated;
|
|
||||||
// wrapper
|
|
||||||
private JobCard jobCard;
|
|
||||||
private long accountId;
|
|
||||||
private String qaStatus;
|
|
||||||
private long bundleId;
|
|
||||||
private String accountTitle;
|
|
||||||
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getType() {
|
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId() {
|
|
||||||
return itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemId(long itemId) {
|
|
||||||
this.itemId = itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSku() {
|
|
||||||
return sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSku(String sku) {
|
|
||||||
this.sku = sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBarcode() {
|
|
||||||
return barcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBarcode(String barcode) {
|
|
||||||
this.barcode = barcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(LocalDateTime createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getJobCardId() {
|
|
||||||
return jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCardId(long jobCardId) {
|
|
||||||
this.jobCardId = jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getIsQa() {
|
|
||||||
return isQa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsQa(boolean qa) {
|
|
||||||
isQa = qa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getFinishedItemId() {
|
|
||||||
return finishedItemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFinishedItemId(long finishedItemId) {
|
|
||||||
this.finishedItemId = finishedItemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JobCard getJobCard() {
|
|
||||||
return jobCard;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCard(JobCard jobCard) {
|
|
||||||
this.jobCard = jobCard;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getIsSegregated() {
|
|
||||||
return isSegregated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsSegregated(boolean segregated) {
|
|
||||||
isSegregated = segregated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAccountId() {
|
|
||||||
return accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountId(long accountId) {
|
|
||||||
this.accountId = accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQaStatus() {
|
|
||||||
return qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQaStatus(String qaStatus) {
|
|
||||||
this.qaStatus = qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getWrapQuantity(){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMasterBundleId(){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getBundleId(){
|
|
||||||
return bundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBundleId(long bundleId) {
|
|
||||||
this.bundleId = bundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAccountTitle() {
|
|
||||||
return accountTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountTitle(String accountTitle) {
|
|
||||||
this.accountTitle = accountTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PackagingItems{" +
|
|
||||||
"id=" + id +
|
|
||||||
", itemId=" + itemId +
|
|
||||||
", sku='" + sku + '\'' +
|
|
||||||
", barcode='" + barcode + '\'' +
|
|
||||||
", jobCardId=" + jobCardId +
|
|
||||||
", createdAt=" + createdAt +
|
|
||||||
", createdBy='" + createdBy + '\'' +
|
|
||||||
", isQa=" + isQa +
|
|
||||||
", finishedItemId=" + finishedItemId +
|
|
||||||
", isSegregated=" + isSegregated +
|
|
||||||
", jobCard=" + jobCard +
|
|
||||||
", accountId=" + accountId +
|
|
||||||
", qaStatus='" + qaStatus + '\'' +
|
|
||||||
", bundleId=" + bundleId +
|
|
||||||
", accountTitle='" + accountTitle + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
public class PurchaseOrderCTP {
|
|
||||||
|
|
||||||
public enum Status{
|
|
||||||
DRAFT,
|
|
||||||
POSTED,
|
|
||||||
}
|
|
||||||
|
|
||||||
private long id;
|
|
||||||
private String purchaseOrderCode;
|
|
||||||
private long purchaseOrderQuantity;
|
|
||||||
private long purchaseOrderQuantityRequired;
|
|
||||||
private String articleName;
|
|
||||||
private String createdBy;
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPurchaseOrderCode() {
|
|
||||||
return purchaseOrderCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPurchaseOrderCode(String purchaseOrderCode) {
|
|
||||||
this.purchaseOrderCode = purchaseOrderCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPurchaseOrderQuantity() {
|
|
||||||
return purchaseOrderQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPurchaseOrderQuantity(long purchaseOrderQuantity) {
|
|
||||||
this.purchaseOrderQuantity = purchaseOrderQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPurchaseOrderQuantityRequired() {
|
|
||||||
return purchaseOrderQuantityRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPurchaseOrderQuantityRequired(long purchaseOrderQuantityRequired) {
|
|
||||||
this.purchaseOrderQuantityRequired = purchaseOrderQuantityRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArticleName() {
|
|
||||||
return articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArticleName(String articleName) {
|
|
||||||
this.articleName = articleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(LocalDateTime createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +1,12 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
package com.utopiaindustries.model.ctp;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class StitchedItemWrapper {
|
public class StitchedItemWrapper {
|
||||||
|
|
||||||
private String qaStatus;
|
|
||||||
private List<StitchingOfflineItem> items;
|
private List<StitchingOfflineItem> items;
|
||||||
private Long finishedAccountId;
|
private Long finishedAccountId;
|
||||||
|
|
||||||
public String getQaStatus() {
|
|
||||||
return qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQaStatus(String qaStatus) {
|
|
||||||
this.qaStatus = qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StitchingOfflineItem> getItems() {
|
public List<StitchingOfflineItem> getItems() {
|
||||||
return items;
|
return items;
|
||||||
|
|
|
@ -14,10 +14,6 @@ public class StitchingOfflineItem implements InventoryArtifact {
|
||||||
private long jobCardId;
|
private long jobCardId;
|
||||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
|
||||||
private LocalDateTime qcDoneAt;
|
|
||||||
|
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
private boolean isQa;
|
private boolean isQa;
|
||||||
private String qaRemarks;
|
private String qaRemarks;
|
||||||
|
@ -129,14 +125,6 @@ public class StitchingOfflineItem implements InventoryArtifact {
|
||||||
this.bundleId = bundleId;
|
this.bundleId = bundleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDateTime getQcDoneAt() {
|
|
||||||
return qcDoneAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQcDoneAt(LocalDateTime qcDoneAt) {
|
|
||||||
this.qcDoneAt = qcDoneAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "StitchingOfflineItem{" +
|
return "StitchingOfflineItem{" +
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
public class StoreItem implements InventoryArtifact {
|
|
||||||
|
|
||||||
private long id;
|
|
||||||
private long itemId;
|
|
||||||
private String sku;
|
|
||||||
private String barcode;
|
|
||||||
private long jobCardId;
|
|
||||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
private String createdBy;
|
|
||||||
private long finishedItemId;
|
|
||||||
private long bundleId;
|
|
||||||
private long accountId;
|
|
||||||
private String rejectedReason;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getItemId() {
|
|
||||||
return itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemId(long itemId) {
|
|
||||||
this.itemId = itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSku() {
|
|
||||||
return sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getType() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSku(String sku) {
|
|
||||||
this.sku = sku;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBarcode() {
|
|
||||||
return barcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBarcode(String barcode) {
|
|
||||||
this.barcode = barcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getJobCardId() {
|
|
||||||
return jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCardId(long jobCardId) {
|
|
||||||
this.jobCardId = jobCardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDateTime getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getWrapQuantity() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMasterBundleId() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(LocalDateTime createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getFinishedItemId() {
|
|
||||||
return finishedItemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFinishedItemId(long finishedItemId) {
|
|
||||||
this.finishedItemId = finishedItemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getBundleId() {
|
|
||||||
return bundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBundleId(long bundleId) {
|
|
||||||
this.bundleId = bundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAccountId() {
|
|
||||||
return accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountId(long accountId) {
|
|
||||||
this.accountId = accountId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRejectedReason() {
|
|
||||||
return rejectedReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRejectedReason(String rejectedReason) {
|
|
||||||
this.rejectedReason = rejectedReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "StoreItem{" +
|
|
||||||
"id=" + id +
|
|
||||||
", itemId=" + itemId +
|
|
||||||
", sku='" + sku + '\'' +
|
|
||||||
", barcode='" + barcode + '\'' +
|
|
||||||
", jobCardId=" + jobCardId +
|
|
||||||
", createdAt=" + createdAt +
|
|
||||||
", createdBy='" + createdBy + '\'' +
|
|
||||||
", finishedItemId=" + finishedItemId +
|
|
||||||
", bundleId=" + bundleId +
|
|
||||||
", accountId=" + accountId +
|
|
||||||
", rejectedReason='" + rejectedReason + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ public class SummaryInventoryReport {
|
||||||
private String Date;
|
private String Date;
|
||||||
private long totalIn;
|
private long totalIn;
|
||||||
private long totalOut;
|
private long totalOut;
|
||||||
private long jobCardID;
|
|
||||||
private String parentDocumentType;
|
private String parentDocumentType;
|
||||||
private String parentDocumentId;
|
private String parentDocumentId;
|
||||||
private String accountId;
|
private String accountId;
|
||||||
|
@ -92,12 +91,4 @@ public class SummaryInventoryReport {
|
||||||
public void setAccountId(String accountId) {
|
public void setAccountId(String accountId) {
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getJobCardID() {
|
|
||||||
return jobCardID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJobCardID(long jobCardID) {
|
|
||||||
this.jobCardID = jobCardID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.utopiaindustries.querybuilder.ctp;
|
|
||||||
|
|
||||||
import com.utopiaindustries.querybuilder.QueryBuilder;
|
|
||||||
import com.utopiaindustries.util.CTPDateTimeFormat;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
public class PurchaseOrderCTPQueryBuilder {
|
|
||||||
public static String buildQuery(String purchaseOrderCode, String articleName, String createdBy, String startDate, String endDate, Long count ){
|
|
||||||
// format date
|
|
||||||
String formattedDate;
|
|
||||||
String formattedEndDate;
|
|
||||||
String startDate1 = "";
|
|
||||||
String endDate1 = "";
|
|
||||||
String purchaseOrderCode1 = purchaseOrderCode == null ? "" : purchaseOrderCode;
|
|
||||||
String articleName1 = articleName == null ? "" : articleName;
|
|
||||||
if ( ! StringUtils.isNullOrEmpty( startDate ) ) {
|
|
||||||
formattedDate = CTPDateTimeFormat.getMySQLFormattedDateString( startDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT );
|
|
||||||
formattedEndDate = CTPDateTimeFormat.getMySQLFormattedDateString( endDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT );
|
|
||||||
startDate1 = String.format( "'%s 00:00:01'", formattedDate );
|
|
||||||
if ( ! StringUtils.isNullOrEmpty( endDate ) ) {
|
|
||||||
endDate1 = String.format("'%s 23:59:59'", formattedEndDate);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
endDate1 = String.format("'%s 23:59:59'", LocalDate.now() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (new QueryBuilder())
|
|
||||||
.setTable("cut_to_pack.purchase_order")
|
|
||||||
.setColumns("*")
|
|
||||||
.where()
|
|
||||||
.columnEquals("created_by", createdBy)
|
|
||||||
.and()
|
|
||||||
.columnLike("purchase_order_code", "%" + purchaseOrderCode1 + "%")
|
|
||||||
.and()
|
|
||||||
.columnLike("article_name", articleName)
|
|
||||||
.and()
|
|
||||||
.columnEqualToOrGreaterThan("created_at", startDate1)
|
|
||||||
.and()
|
|
||||||
.columnEqualToOrLessThan("created_at", endDate1)
|
|
||||||
.limit(count.intValue())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,7 +8,7 @@ import java.time.LocalDate;
|
||||||
|
|
||||||
public class StichedOfflineItemQueryBuilder {
|
public class StichedOfflineItemQueryBuilder {
|
||||||
|
|
||||||
public static String buildQuery(String id, String itemId, String sku, String QaStatus,String createdStartDate, String createdEndDate, Long bundleId, Long count) {
|
public static String buildQuery(String id, String itemId, String sku, String createdStartDate, String createdEndDate, String jobCardId, Long count) {
|
||||||
// format date
|
// format date
|
||||||
String formattedDate;
|
String formattedDate;
|
||||||
String formattedEndDate;
|
String formattedEndDate;
|
||||||
|
@ -24,7 +24,8 @@ public class StichedOfflineItemQueryBuilder {
|
||||||
endDate1 = String.format("'%s 23:59:59'", LocalDate.now());
|
endDate1 = String.format("'%s 23:59:59'", LocalDate.now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QueryBuilder qb = (new QueryBuilder())
|
|
||||||
|
return ( new QueryBuilder() )
|
||||||
.setTable("cut_to_pack.stitching_offline_item")
|
.setTable("cut_to_pack.stitching_offline_item")
|
||||||
.setColumns("*")
|
.setColumns("*")
|
||||||
.where()
|
.where()
|
||||||
|
@ -32,20 +33,17 @@ public class StichedOfflineItemQueryBuilder {
|
||||||
.and()
|
.and()
|
||||||
.columnEquals("sku", sku)
|
.columnEquals("sku", sku)
|
||||||
.and()
|
.and()
|
||||||
.columnEquals("item_id", itemId)
|
.columnEquals("item_id", itemId )
|
||||||
.and()
|
.and()
|
||||||
.columnEquals("bundle_id", bundleId)
|
.columnEquals("job_card_id", jobCardId )
|
||||||
.and()
|
.and()
|
||||||
.columnEqualToOrGreaterThan("created_at", startDate1)
|
.columnEqualToOrGreaterThan("created_at", startDate1)
|
||||||
.and()
|
.and()
|
||||||
.columnEqualToOrLessThan("created_at", endDate1);
|
.columnEqualToOrLessThan("created_at", endDate1 )
|
||||||
if (!StringUtils.isNullOrEmpty(QaStatus)) {
|
.orderBy("id","DESC")
|
||||||
qb.and().columnEquals("qa_status", QaStatus);
|
.limit(count)
|
||||||
}
|
.build();
|
||||||
qb.orderBy("id", "DESC")
|
|
||||||
.limit(count);
|
|
||||||
|
|
||||||
return qb.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,42 +62,11 @@ public class SummaryInventoryReportQueryBuilder {
|
||||||
.bracketClose()
|
.bracketClose()
|
||||||
.bracketClose()
|
.bracketClose()
|
||||||
.and()
|
.and()
|
||||||
.columnBetween("transaction_leg_datetime",startDate,endDate)
|
.columnBetween("transaction_leg_date",startDate,endDate)
|
||||||
.groupBy("DATE(transaction_leg_datetime), sku, parent_document_type, parent_document_piece_type")
|
.groupBy("DATE(transaction_leg_datetime), sku, parent_document_type, parent_document_piece_type")
|
||||||
.orderBy("transaction_date,", "sku");
|
.orderBy("transaction_date,", "sku");
|
||||||
|
|
||||||
return qb.build();
|
return qb.build();
|
||||||
}
|
|
||||||
|
|
||||||
public static String cuttingQueryBuild(long jobCardId,
|
|
||||||
List<Long> account,
|
|
||||||
String sku,
|
|
||||||
String startDate,
|
|
||||||
String endDate,
|
|
||||||
String type,
|
|
||||||
String parentDocumentType) {
|
|
||||||
|
|
||||||
QueryBuilder qb = new QueryBuilder()
|
|
||||||
.setTable(TABLE_NAME)
|
|
||||||
.setColumns("*")
|
|
||||||
.where()
|
|
||||||
.columnIn("account_id",account.toArray(new Long[0]))
|
|
||||||
.and()
|
|
||||||
.columnEqualToOrGreaterThan("transaction_leg_datetime",startDate)
|
|
||||||
.and()
|
|
||||||
.columnEqualToOrLessThan("transaction_leg_datetime",endDate)
|
|
||||||
.and()
|
|
||||||
.columnEquals("type",type)
|
|
||||||
.and()
|
|
||||||
.columnEquals("parent_document_type",parentDocumentType);
|
|
||||||
if (jobCardId != 0){
|
|
||||||
qb.and()
|
|
||||||
.columnEquals("job_card_id", jobCardId );
|
|
||||||
}
|
|
||||||
if (!StringUtils.isNullOrEmpty(sku)){
|
|
||||||
qb.and()
|
|
||||||
.columnEquals("sku", sku );
|
|
||||||
}
|
|
||||||
return qb.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/rest/finished-items")
|
@RequestMapping( "/rest/finished-items" )
|
||||||
public class FinishedItemRestController {
|
public class FinishedItemRestController {
|
||||||
|
|
||||||
private final FinishedItemDAO finishedItemDAO;
|
private final FinishedItemDAO finishedItemDAO;
|
||||||
|
@ -19,21 +19,9 @@ public class FinishedItemRestController {
|
||||||
this.finishedItemDAO = finishedItemDAO;
|
this.finishedItemDAO = finishedItemDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/search")
|
@GetMapping( "/search" )
|
||||||
public List<FinishedItem> searchFinishedItems(@RequestParam("term") String term,
|
public List<FinishedItem> searchFinishedItems(@RequestParam( "term") String term,
|
||||||
@RequestParam("is-segregated") boolean isSegregated) {
|
@RequestParam( "is-segregated") boolean isSegregated ){
|
||||||
return finishedItemDAO.findByTerm(term, true);
|
return finishedItemDAO.findByTerm( term, isSegregated );
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/search-packaging")
|
|
||||||
public List<FinishedItem> searchFinishedItemsForPackaging(@RequestParam("term") String term,
|
|
||||||
@RequestParam("is-segregated") boolean isSegregated) {
|
|
||||||
return finishedItemDAO.findByTermForPackaging(term, isSegregated, "APPROVED");
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/search-store")
|
|
||||||
public List<FinishedItem> searchFinishedItemsForStore(@RequestParam("term") String term,
|
|
||||||
@RequestParam("is-segregated") boolean isSegregated) {
|
|
||||||
return finishedItemDAO.findByTermForPackaging(term, isSegregated,"REJECT");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class ItemRestController {
|
||||||
items = itemDAO.findBySkuOrTitleAndTypeIdAndActive(term, Arrays.stream(typeIds).collect(Collectors.toList()), "1" );
|
items = itemDAO.findBySkuOrTitleAndTypeIdAndActive(term, Arrays.stream(typeIds).collect(Collectors.toList()), "1" );
|
||||||
} else {
|
} else {
|
||||||
// else return all results
|
// else return all results
|
||||||
items = itemDAO.findLikeTitleAndStatusORSKU(term, true );
|
items = itemDAO.findLikeTitleAndStatus(term, true );
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.utopiaindustries.restcontroller;
|
package com.utopiaindustries.restcontroller;
|
||||||
|
|
||||||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
|
||||||
import com.utopiaindustries.model.uind.PurchaseOrder;
|
import com.utopiaindustries.model.uind.PurchaseOrder;
|
||||||
import com.utopiaindustries.service.PurchaseOrderCTPService;
|
|
||||||
import com.utopiaindustries.service.PurchaseOrderService;
|
import com.utopiaindustries.service.PurchaseOrderService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -16,11 +14,9 @@ import java.util.List;
|
||||||
public class PurchaseOrderRestController {
|
public class PurchaseOrderRestController {
|
||||||
|
|
||||||
private final PurchaseOrderService purchaseOrderService;
|
private final PurchaseOrderService purchaseOrderService;
|
||||||
private final PurchaseOrderCTPService purchaseOrderCTPService;
|
|
||||||
|
|
||||||
public PurchaseOrderRestController(PurchaseOrderService purchaseOrderService, PurchaseOrderCTPService purchaseOrderCTPService) {
|
public PurchaseOrderRestController(PurchaseOrderService purchaseOrderService) {
|
||||||
this.purchaseOrderService = purchaseOrderService;
|
this.purchaseOrderService = purchaseOrderService;
|
||||||
this.purchaseOrderCTPService = purchaseOrderCTPService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -30,12 +26,4 @@ public class PurchaseOrderRestController {
|
||||||
public List<PurchaseOrder> findByTerm(@RequestParam("term") String term ) {
|
public List<PurchaseOrder> findByTerm(@RequestParam("term") String term ) {
|
||||||
return purchaseOrderService.findByTerm( term );
|
return purchaseOrderService.findByTerm( term );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* search by term in ctp purchase order table
|
|
||||||
* */
|
|
||||||
@GetMapping( "/ctp-po-search" )
|
|
||||||
public List<PurchaseOrderCTP> findByTermInCtpPurchaseOrderTable(@RequestParam("term") String term ) {
|
|
||||||
return purchaseOrderCTPService.findByTerm( term );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,7 +312,7 @@ public class BarcodeService {
|
||||||
float qrY =stickerSize.getMarginLeft()+50 ;
|
float qrY =stickerSize.getMarginLeft()+50 ;
|
||||||
float qrX = stickerSize.getMarginTop();
|
float qrX = stickerSize.getMarginTop();
|
||||||
|
|
||||||
qrCodeImage.setFixedPosition(qrX - 16, qrY-35);
|
qrCodeImage.setFixedPosition(qrX - 16, qrY-40);
|
||||||
document.add(qrCodeImage);
|
document.add(qrCodeImage);
|
||||||
|
|
||||||
float textX = stickerSize.getMarginLeft() + 40;
|
float textX = stickerSize.getMarginLeft() + 40;
|
||||||
|
@ -323,61 +323,41 @@ public class BarcodeService {
|
||||||
String combinedText = sku + " \\ " + jobCardCode + " \\ " + artifact.getBundleId();
|
String combinedText = sku + " \\ " + jobCardCode + " \\ " + artifact.getBundleId();
|
||||||
combinedText = combinedText.replaceAll("\\s+", "");
|
combinedText = combinedText.replaceAll("\\s+", "");
|
||||||
|
|
||||||
int maxLength = 12;
|
int maxLength = 14;
|
||||||
int start = 0;
|
|
||||||
int lineCount = 0;
|
|
||||||
List<String> lines = new ArrayList<>();
|
List<String> lines = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
while (start < combinedText.length() && lineCount < 5) {
|
int start = i * maxLength;
|
||||||
int end = Math.min(start + maxLength, combinedText.length());
|
if (start < combinedText.length()) {
|
||||||
String part = combinedText.substring(start, end);
|
String part = combinedText.substring(start, Math.min(start + maxLength, combinedText.length())).replaceAll("\\s+", "");
|
||||||
|
lines.add(part);
|
||||||
if (part.matches(".*[^a-zA-Z0-9 ].*")) {
|
|
||||||
if(combinedText.length() - start<=17 && combinedText.length() - start>0){
|
|
||||||
end = Math.min(start + maxLength + 5, combinedText.length());
|
|
||||||
part = combinedText.substring(start, end);
|
|
||||||
}else {
|
|
||||||
end = Math.min(start + maxLength + 3, combinedText.length());
|
|
||||||
part = combinedText.substring(start, end);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
part = part.replaceAll("\\s+", "");
|
|
||||||
lines.add(part);
|
|
||||||
start = end;
|
|
||||||
lineCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float labelWidth = 67.69f;
|
float labelWidth = 67.69f;
|
||||||
float textBoxWidth = 120f;
|
float textBoxWidth = 220;
|
||||||
float textY1 = textY-23;
|
float textY1 = textY-23;
|
||||||
float textXCenter = textX + (labelWidth / 2) - (textBoxWidth / 2)-50;
|
float textXCenter = textX + (labelWidth / 2) - (textBoxWidth / 2)-50;
|
||||||
|
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
Paragraph rotatedText = new Paragraph(line)
|
Paragraph rotatedText = new Paragraph(line)
|
||||||
.setFontColor(ColorConstants.BLACK)
|
.setFontColor(ColorConstants.BLACK)
|
||||||
.setFontSize(stickerSize.getTextSize()+2)
|
.setFontSize(stickerSize.getTextSize() + 2)
|
||||||
.setTextAlignment(TextAlignment.CENTER)
|
.setTextAlignment(TextAlignment.CENTER)
|
||||||
.setFixedPosition(textXCenter, textY1-13, textBoxWidth);
|
.setFixedPosition(textXCenter, textY1-18, textBoxWidth);
|
||||||
|
|
||||||
document.add(rotatedText);
|
document.add(rotatedText);
|
||||||
textY1 -= 6;
|
textY1 -= 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
PdfFont font = PdfFontFactory.createFont(StandardFonts.COURIER);
|
PdfFont font = PdfFontFactory.createFont(StandardFonts.COURIER_OBLIQUE);
|
||||||
String id = String.valueOf(artifact.getId());
|
String id = String.valueOf(artifact.getId());
|
||||||
float textSize = stickerSize.getTextSize() + 6;
|
|
||||||
float charWidth = textSize * 0.6f;
|
|
||||||
float idWidth = id.length() * charWidth;
|
|
||||||
float xCentered = (labelWidth / 2f) - (idWidth / 2f);
|
|
||||||
|
|
||||||
document.add(new Paragraph(id)
|
document.add(new Paragraph(id)
|
||||||
.setFont(font)
|
.setFont(font)
|
||||||
.setBold()
|
.setBold()
|
||||||
.setFontColor(ColorConstants.BLACK)
|
.setFontColor(ColorConstants.BLACK)
|
||||||
.setFontSize(textSize)
|
.setFontSize(stickerSize.getTextSize() + 8)
|
||||||
.setFixedPosition(xCentered, textY + 18, 100));
|
.setTextAlignment(TextAlignment.LEFT)
|
||||||
|
.setFixedPosition(textX - 25, textY + 13, 100));
|
||||||
|
|
||||||
float dottedLine = textY - 65;
|
float dottedLine = textY - 65;
|
||||||
for(int i= 0 ;i<16;i++){
|
for(int i= 0 ;i<16;i++){
|
||||||
|
@ -387,7 +367,7 @@ public class BarcodeService {
|
||||||
.setBold()
|
.setBold()
|
||||||
.setRotationAngle(-Math.PI / 2)
|
.setRotationAngle(-Math.PI / 2)
|
||||||
.setTextAlignment(TextAlignment.LEFT)
|
.setTextAlignment(TextAlignment.LEFT)
|
||||||
.setFixedPosition(dottedLine,textX+55, 100));
|
.setFixedPosition(dottedLine,textX+45, 100));
|
||||||
|
|
||||||
dottedLine += 7;
|
dottedLine += 7;
|
||||||
}
|
}
|
||||||
|
@ -400,7 +380,7 @@ public class BarcodeService {
|
||||||
.setBold()
|
.setBold()
|
||||||
.setRotationAngle(-Math.PI / 2)
|
.setRotationAngle(-Math.PI / 2)
|
||||||
.setTextAlignment(TextAlignment.LEFT)
|
.setTextAlignment(TextAlignment.LEFT)
|
||||||
.setFixedPosition(dottedLine2,textX+90, 100));
|
.setFixedPosition(dottedLine2,textX+80, 100));
|
||||||
|
|
||||||
dottedLine2 += 7;
|
dottedLine2 += 7;
|
||||||
}
|
}
|
||||||
|
@ -409,11 +389,9 @@ public class BarcodeService {
|
||||||
document.add(new AreaBreak());
|
document.add(new AreaBreak());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdfDoc.getNumberOfPages() > artifacts.size()) {
|
if (pdfDoc.getNumberOfPages() > artifacts.size()) {
|
||||||
pdfDoc.removePage(pdfDoc.getNumberOfPages());
|
pdfDoc.removePage(pdfDoc.getNumberOfPages());
|
||||||
}
|
}
|
||||||
|
|
||||||
document.close();
|
document.close();
|
||||||
sendPdfToZebraPrinter(pdfPath.toFile());
|
sendPdfToZebraPrinter(pdfPath.toFile());
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,13 +125,13 @@ public class BundleService {
|
||||||
/*
|
/*
|
||||||
* find finished Items by params
|
* find finished Items by params
|
||||||
* */
|
* */
|
||||||
public List<StitchingOfflineItem> getStitchedOfflineItems(String id, String itemId, String sku,String status, String createdStartDate, String createdEndDate, Long bundleId, Long count ){
|
public List<StitchingOfflineItem> getStitchedOfflineItems(String id, String itemId, String sku, String createdStartDate, String createdEndDate, String jobCardId, Long count ){
|
||||||
List<StitchingOfflineItem> stitchingOfflineItems = new ArrayList<>();
|
List<StitchingOfflineItem> stitchingOfflineItems = new ArrayList<>();
|
||||||
if( count == null ){
|
if( count == null ){
|
||||||
count = 100L;
|
count = 100L;
|
||||||
}
|
}
|
||||||
if( StringUtils.isAnyNotNullOrEmpty(id, itemId, sku, createdStartDate, createdEndDate, String.valueOf(bundleId) ) ){
|
if( StringUtils.isAnyNotNullOrEmpty(id, itemId, sku, createdStartDate, createdEndDate, jobCardId ) ){
|
||||||
String query = StichedOfflineItemQueryBuilder.buildQuery( id, itemId, sku, status,createdStartDate, createdEndDate, bundleId , count );
|
String query = StichedOfflineItemQueryBuilder.buildQuery( id, itemId, sku, createdStartDate, createdEndDate, jobCardId , count );
|
||||||
System.out.println( query );
|
System.out.println( query );
|
||||||
stitchingOfflineItems = stitchingOfflineItemDAO.findByQuery( query );
|
stitchingOfflineItems = stitchingOfflineItemDAO.findByQuery( query );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,185 +0,0 @@
|
||||||
package com.utopiaindustries.service;
|
|
||||||
|
|
||||||
import com.utopiaindustries.dao.ctp.*;
|
|
||||||
import com.utopiaindustries.model.ctp.*;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class DashboardService {
|
|
||||||
|
|
||||||
private final InventoryTransactionLegDAO inventoryTransactionLegDAO;
|
|
||||||
private final JobCardDAO jobCardDAO;
|
|
||||||
private final FinishedItemDAO finishedItemDAO;
|
|
||||||
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
|
||||||
private final InventoryAccountDAO inventoryAccountDAO;
|
|
||||||
private final PackagingItemsDAO packagingItemsDAO;
|
|
||||||
|
|
||||||
|
|
||||||
public DashboardService(InventoryTransactionLegDAO inventoryTransactionLegDAO, JobCardDAO jobCardDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO, PackagingItemsDAO packagingItemsDAO) {
|
|
||||||
this.inventoryTransactionLegDAO = inventoryTransactionLegDAO;
|
|
||||||
this.jobCardDAO = jobCardDAO;
|
|
||||||
this.finishedItemDAO = finishedItemDAO;
|
|
||||||
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
|
||||||
this.inventoryAccountDAO = inventoryAccountDAO;
|
|
||||||
this.packagingItemsDAO = packagingItemsDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Float> getPhasesProgressDayWise(String lineNo) {
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
||||||
HashMap<String, Float> progress = new HashMap<>();
|
|
||||||
|
|
||||||
String cuttingAccount = "CUTTING ACCOUNT " + lineNo;
|
|
||||||
String stitchingAccount = "STITCHING ACCOUNT " + lineNo;
|
|
||||||
String finishingAccount = "FINISHING ACCOUNT " + lineNo;
|
|
||||||
String packagingAccount = "A GRADE ACCOUNT " + lineNo;
|
|
||||||
|
|
||||||
LocalDateTime today = LocalDateTime.now().withHour(0).withMinute(0).withSecond(1);
|
|
||||||
String startDate1 = today.format(formatter);
|
|
||||||
String endDate1 = LocalDateTime.now().withHour(23).withMinute(59).withSecond(59).format(formatter);
|
|
||||||
String forPreviousDate = LocalDateTime.now().minusDays(1).withHour(23).withMinute(59).withSecond(59).format(formatter);
|
|
||||||
|
|
||||||
//set inventory accounts
|
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findAll();
|
|
||||||
InventoryAccount inventoryAccount = inventoryAccounts.stream()
|
|
||||||
.filter(e -> stitchingAccount.equals(e.getTitle())).findFirst().orElse(new InventoryAccount());
|
|
||||||
Map<String, Integer> inventoryAccountMap = inventoryAccounts.stream()
|
|
||||||
.filter(e -> cuttingAccount.equals(e.getTitle()) ||
|
|
||||||
stitchingAccount.equals(e.getTitle()) ||
|
|
||||||
finishingAccount.equals(e.getTitle()) ||
|
|
||||||
packagingAccount.equals(e.getTitle()))
|
|
||||||
.collect(Collectors.toMap(InventoryAccount::getTitle, e -> (int) e.getId()));
|
|
||||||
|
|
||||||
//get all in remaining transaction stitching
|
|
||||||
List<Long> stitchingItemIds = inventoryTransactionLegDAO.findRemainingByParentTypeAndAccountID("STITCHING_OFFLINE", inventoryAccountMap.get(stitchingAccount));
|
|
||||||
|
|
||||||
//get all out transaction stitching
|
|
||||||
List<Long> stitchingOutIds = inventoryTransactionLegDAO.getOutParentIdByDate("STITCHING_OFFLINE", inventoryAccountMap.get(stitchingAccount));
|
|
||||||
|
|
||||||
|
|
||||||
//get all in transaction finished
|
|
||||||
List<Long> finishing = inventoryTransactionLegDAO.getInParentIdByDate("FINISHED_ITEM", inventoryAccountMap.get(finishingAccount));
|
|
||||||
|
|
||||||
//get all in remaining transaction packaging
|
|
||||||
List<Long> packagingItemIDs = inventoryTransactionLegDAO.findRemainingByParentTypeAndAccountID("PACKAGING", inventoryAccountMap.get(packagingAccount));
|
|
||||||
|
|
||||||
//set stitching related details
|
|
||||||
Long approvedStitchingOfflineItems = 0L;
|
|
||||||
Long remaininfQcAlterPieces = 0L;
|
|
||||||
Long approvedStitchingOfflineItemsThenReject = 0L;
|
|
||||||
long qcReject = 0L;
|
|
||||||
if (stitchingItemIds != null && !stitchingItemIds.isEmpty()) {
|
|
||||||
approvedStitchingOfflineItems = stitchingOfflineItemDAO.findByQCOperationDateAndApproved(startDate1, endDate1, "APPROVED");
|
|
||||||
qcReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingItemIds);
|
|
||||||
remaininfQcAlterPieces = stitchingOfflineItemDAO.findByQCOperationDateAndIds(null, forPreviousDate, "REJECT", stitchingItemIds);
|
|
||||||
}
|
|
||||||
if(stitchingOutIds != null && !stitchingOutIds.isEmpty()) {
|
|
||||||
approvedStitchingOfflineItemsThenReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingOutIds);
|
|
||||||
}
|
|
||||||
//set finishing related details
|
|
||||||
Long alterationPieceFinish = 0L;
|
|
||||||
Long rejectFinishedItem = 0L;
|
|
||||||
Long washFinishedItem = 0L;
|
|
||||||
Long approved = 0L;
|
|
||||||
Long operationNotPerformed = 0L;
|
|
||||||
Long remainingAlterationPieceFinish = 0L;
|
|
||||||
if (finishing != null && !finishing.isEmpty()) {
|
|
||||||
approved = finishedItemDAO.findByOperationDateAndIdsAndQaStatus(startDate1, endDate1, "APPROVED", finishing);
|
|
||||||
operationNotPerformed = finishedItemDAO.findByOperationDateAndIdsAndQaStatus(startDate1, endDate1, "-", finishing);
|
|
||||||
rejectFinishedItem = finishedItemDAO.findByOperationDateAndIdsAndQaStatus(startDate1, endDate1, "REJECT", finishing);
|
|
||||||
washFinishedItem = finishedItemDAO.findByOperationDateAndIdsAndQaStatus(startDate1, endDate1, "WASHED", finishing);
|
|
||||||
alterationPieceFinish = finishedItemDAO.findByOperationDateAndIdsAndQaStatus(startDate1, endDate1, "ALTER", finishing);
|
|
||||||
remainingAlterationPieceFinish = finishedItemDAO.findByOperationDateAndIdsAndQaStatus(null, forPreviousDate, "ALTER", finishing);
|
|
||||||
}
|
|
||||||
|
|
||||||
//set packaging details
|
|
||||||
Long packagingItems = 0L;
|
|
||||||
if (packagingItemIDs != null && !packagingItemIDs.isEmpty()) {
|
|
||||||
packagingItems = packagingItemsDAO.findByDateAndIds(startDate1, endDate1, packagingItemIDs);
|
|
||||||
}
|
|
||||||
|
|
||||||
//set shift wise details and time
|
|
||||||
LocalDateTime statTime = LocalDateTime.now().withHour(9).withMinute(0).withSecond(0).withNano(0);
|
|
||||||
LocalDateTime endTime = statTime.plusMinutes(inventoryAccount.getShiftMinutes());
|
|
||||||
long minutesPassed = 0;
|
|
||||||
if (statTime.isBefore(LocalDateTime.now()) && LocalDateTime.now().isBefore(endTime)) {
|
|
||||||
minutesPassed = Duration.between(statTime, LocalDateTime.now()).toMinutes();
|
|
||||||
}
|
|
||||||
|
|
||||||
//set efficiency
|
|
||||||
long shiftTargetMinutesWise = getTargetShiftWiseOrHourlyWise(Math.max(0, minutesPassed), inventoryAccount);
|
|
||||||
float efficiency;
|
|
||||||
if (shiftTargetMinutesWise == 0) {
|
|
||||||
efficiency = 0f;
|
|
||||||
} else {
|
|
||||||
efficiency = (float) approvedStitchingOfflineItems / shiftTargetMinutesWise;
|
|
||||||
}
|
|
||||||
|
|
||||||
progress.put("Stitching", (float) approvedStitchingOfflineItems + qcReject);
|
|
||||||
progress.put("totalWips", (float) stitchingItemIds.size() - qcReject);
|
|
||||||
progress.put("Alteration", (float) qcReject + approvedStitchingOfflineItemsThenReject);
|
|
||||||
|
|
||||||
progress.put("finishing", (float) approved );
|
|
||||||
progress.put("ALTER", (float) alterationPieceFinish);
|
|
||||||
progress.put("Reject", (float) rejectFinishedItem);
|
|
||||||
progress.put("wash", (float) washFinishedItem);
|
|
||||||
progress.put("finishingValueForBarChart", (float) approved + alterationPieceFinish + rejectFinishedItem + washFinishedItem + packagingItems);
|
|
||||||
|
|
||||||
progress.put("packaging", (float) packagingItems);
|
|
||||||
progress.put("totalPackaging", (float) packagingItemIDs.size());
|
|
||||||
progress.put("remainingFinishAlter", (float) remainingAlterationPieceFinish);
|
|
||||||
progress.put("remainingQCAlter", (float) remaininfQcAlterPieces);
|
|
||||||
|
|
||||||
progress.put("Efficiency", efficiency);
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getLineDetails(String lineNo) {
|
|
||||||
String stitchingAccount = "STITCHING ACCOUNT " + lineNo;
|
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findAll();
|
|
||||||
|
|
||||||
InventoryAccount inventoryAccount = inventoryAccounts.stream()
|
|
||||||
.filter(e -> stitchingAccount.equals(e.getTitle())).findFirst().orElse(new InventoryAccount());
|
|
||||||
|
|
||||||
int shiftTarget = getTargetShiftWiseOrHourlyWise(inventoryAccount.getShiftMinutes(), inventoryAccount);
|
|
||||||
int shiftHourlyTarget = getTargetShiftWiseOrHourlyWise(60, inventoryAccount);
|
|
||||||
|
|
||||||
HashMap<String, String> details = new HashMap<>();
|
|
||||||
details.put("Shift Target", shiftTarget + " Pcs");
|
|
||||||
details.put("articleName", inventoryAccount.getArticleName());
|
|
||||||
details.put("Hourly Target", shiftHourlyTarget + " Pcs");
|
|
||||||
details.put("Total Machine", String.valueOf(inventoryAccount.getTotalMachines()));
|
|
||||||
details.put("Total Worker", String.valueOf(30));
|
|
||||||
details.put("line", "Line " + lineNo);
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
|
|
||||||
//formula for calculating targets --> machine * shiftTime * Efficiency / SAM
|
|
||||||
private int getTargetShiftWiseOrHourlyWise(long minutes, InventoryAccount inventoryAccount) {
|
|
||||||
if (inventoryAccount == null ||
|
|
||||||
inventoryAccount.getTotalMachines() == 0 ||
|
|
||||||
inventoryAccount.getEfficiency() == null ||
|
|
||||||
inventoryAccount.getSam() == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
BigDecimal totalMachines = BigDecimal.valueOf(inventoryAccount.getTotalMachines());
|
|
||||||
BigDecimal efficiency = inventoryAccount.getEfficiency();
|
|
||||||
BigDecimal sam = inventoryAccount.getSam();
|
|
||||||
BigDecimal totalShiftProductiveTime = totalMachines
|
|
||||||
.multiply(BigDecimal.valueOf(minutes))
|
|
||||||
.multiply(efficiency);
|
|
||||||
if (sam.longValue() != 0) {
|
|
||||||
return totalShiftProductiveTime.divide(sam, 0, RoundingMode.HALF_UP).intValueExact();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -71,7 +71,11 @@ public class InventoryAccountService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryAccount> findInventoryAccounts(){
|
public List<InventoryAccount> findInventoryAccounts(){
|
||||||
return inventoryAccountDAO.findAll();
|
List<InventoryAccount> accounts = inventoryAccountDAO.findAll();
|
||||||
|
for( InventoryAccount account : accounts ){
|
||||||
|
account.setLocationTitle( locationSiteDAO.find( account.getLocationSiteId() ).getTitle() );
|
||||||
|
}
|
||||||
|
return accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryAccount> findInventoryAccountsByFilter(String id, String title, String active, String createdBy, String startDate, String endDate,
|
public List<InventoryAccount> findInventoryAccountsByFilter(String id, String title, String active, String createdBy, String startDate, String endDate,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,21 +7,14 @@ import com.utopiaindustries.dao.uind.PurchaseOrderDAO;
|
||||||
import com.utopiaindustries.model.ctp.*;
|
import com.utopiaindustries.model.ctp.*;
|
||||||
import com.utopiaindustries.model.uind.Item;
|
import com.utopiaindustries.model.uind.Item;
|
||||||
import com.utopiaindustries.querybuilder.ctp.JobCardQueryBuilder;
|
import com.utopiaindustries.querybuilder.ctp.JobCardQueryBuilder;
|
||||||
import com.utopiaindustries.util.HTMLBuilder;
|
|
||||||
import com.utopiaindustries.util.PDFResponseEntityInputStreamResource;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
import com.utopiaindustries.util.StringUtils;
|
||||||
import com.utopiaindustries.util.URLUtils;
|
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.ui.Model;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -43,10 +36,8 @@ public class JobCardService {
|
||||||
private final FinishedItemDAO finishedItemDAO;
|
private final FinishedItemDAO finishedItemDAO;
|
||||||
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
||||||
private final SkuCutPiecesDAO skuCutPiecesDAO;
|
private final SkuCutPiecesDAO skuCutPiecesDAO;
|
||||||
private final HTMLBuilder htmlBuilder;
|
|
||||||
private PDFResponseEntityInputStreamResource pdfGenerator;
|
|
||||||
|
|
||||||
public JobCardService(JobCardDAO jobCardDAO, CutPieceTypeDAO cutPieceTypeDAO, JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, ItemDAO itemDAO, LocationSiteDAO locationSiteDAO, PurchaseOrderDAO purchaseOrderDAO, UserInventoryAccountDAO userInventoryAccountDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, SkuCutPiecesDAO skuCutPiecesDAO, HTMLBuilder htmlBuilder, PDFResponseEntityInputStreamResource pdfGenerator) {
|
public JobCardService(JobCardDAO jobCardDAO, CutPieceTypeDAO cutPieceTypeDAO, JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, ItemDAO itemDAO, LocationSiteDAO locationSiteDAO, PurchaseOrderDAO purchaseOrderDAO, UserInventoryAccountDAO userInventoryAccountDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, SkuCutPiecesDAO skuCutPiecesDAO) {
|
||||||
this.skuCutPiecesDAO = skuCutPiecesDAO;
|
this.skuCutPiecesDAO = skuCutPiecesDAO;
|
||||||
this.jobCardDAO = jobCardDAO;
|
this.jobCardDAO = jobCardDAO;
|
||||||
this.cutPieceTypeDAO = cutPieceTypeDAO;
|
this.cutPieceTypeDAO = cutPieceTypeDAO;
|
||||||
|
@ -58,8 +49,6 @@ public class JobCardService {
|
||||||
this.userInventoryAccountDAO = userInventoryAccountDAO;
|
this.userInventoryAccountDAO = userInventoryAccountDAO;
|
||||||
this.finishedItemDAO = finishedItemDAO;
|
this.finishedItemDAO = finishedItemDAO;
|
||||||
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
||||||
this.htmlBuilder = htmlBuilder;
|
|
||||||
this.pdfGenerator = pdfGenerator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -149,7 +138,20 @@ public class JobCardService {
|
||||||
for (JobCardItem item : jobCard.getItems()) {
|
for (JobCardItem item : jobCard.getItems()) {
|
||||||
item.setJobCardId(jobCardId);
|
item.setJobCardId(jobCardId);
|
||||||
long itemId = jobCardItemDAO.save(item);
|
long itemId = jobCardItemDAO.save(item);
|
||||||
|
for (CutPiece cutPiece : item.getCutPieces()) {
|
||||||
|
cutPiece.setJobCardItemId(itemId);
|
||||||
|
if (!skuCutPiecesDAO.doesExist(cutPiece.getType(), item.getSku())){
|
||||||
|
SkuCutPieces skuCutPieces = new SkuCutPieces();
|
||||||
|
skuCutPieces.setType(cutPiece.getType());
|
||||||
|
skuCutPieces.setSku(item.getSku());
|
||||||
|
//save cut-piece for sku next time fetch
|
||||||
|
skuCutPiecesDAO.save(skuCutPieces);
|
||||||
|
}
|
||||||
|
cutPieces.add(cutPiece);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// save all pieces
|
||||||
|
cutPieceDAO.saveAll(cutPieces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +184,7 @@ public class JobCardService {
|
||||||
.collect( Collectors.toList() );
|
.collect( Collectors.toList() );
|
||||||
|
|
||||||
// get items has account ids and has actual production not filled
|
// get items has account ids and has actual production not filled
|
||||||
List<JobCardItem> items = jobCardItemDAO.findByJobCardAndAccountIdsAndIsReceived( id ,accountIds );
|
List<JobCardItem> items = jobCardItemDAO.findByJobCardAndAccountIdsAndIsReceived( id, 0L ,accountIds );
|
||||||
if (items != null && !items.isEmpty()) {
|
if (items != null && !items.isEmpty()) {
|
||||||
// get job card ite ids
|
// get job card ite ids
|
||||||
List<Long> jobCardItemIds = items.stream()
|
List<Long> jobCardItemIds = items.stream()
|
||||||
|
@ -298,29 +300,4 @@ public class JobCardService {
|
||||||
public Map<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){
|
public Map<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){
|
||||||
return finishedItemDAO.findTotalFinishedItems( itemIds, jobCardId );
|
return finishedItemDAO.findTotalFinishedItems( itemIds, jobCardId );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Print Job card *
|
|
||||||
* **/
|
|
||||||
public ResponseEntity<InputStreamResource> getJobCardReceivingPdf(long id, Model model ) throws Exception {
|
|
||||||
List<JobCardItem> jobCardItems = findJobCardItemByJobCardId(id);
|
|
||||||
List<Long> jobCardItemIds = jobCardItems.stream()
|
|
||||||
.map(JobCardItem::getItemId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<Long> itemIds = jobCardItems.stream()
|
|
||||||
.map(JobCardItem::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
model.addAttribute( "baseUrl", URLUtils.getCurrentBaseUrl() );
|
|
||||||
model.addAttribute( "card", findByID(id));
|
|
||||||
model.addAttribute("jobCardItems", jobCardItems);
|
|
||||||
model.addAttribute("cutPiece", findCutPieceByJobCardItemIds(itemIds));
|
|
||||||
model.addAttribute("totalFinishItem", totalFinishItem(jobCardItemIds, id));
|
|
||||||
model.addAttribute("totalStitchingItem", totalStitchingItem(jobCardItemIds, id));
|
|
||||||
// html str
|
|
||||||
String htmlStr = htmlBuilder.buildHTML( "job-card-view-pdf", model );
|
|
||||||
// return pdf
|
|
||||||
return pdfGenerator.generatePdf( htmlStr, "Job-Card", "inline" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.utopiaindustries.service;
|
|
||||||
|
|
||||||
import com.utopiaindustries.dao.ctp.PackagingItemsDAO;
|
|
||||||
import com.utopiaindustries.model.ctp.FinishedItemWrapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class PackagingService {
|
|
||||||
|
|
||||||
private final InventoryService inventoryService;
|
|
||||||
private final PackagingItemsDAO packagingItemsDAO;
|
|
||||||
|
|
||||||
public PackagingService(InventoryService inventoryService, PackagingItemsDAO packagingItemsDAO) {
|
|
||||||
this.inventoryService = inventoryService;
|
|
||||||
this.packagingItemsDAO = packagingItemsDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createPackagingItem(FinishedItemWrapper wrapper){
|
|
||||||
inventoryService.createPackagingItemAndTransaction(wrapper, wrapper.getAccountId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
package com.utopiaindustries.service;
|
|
||||||
|
|
||||||
import com.utopiaindustries.dao.ctp.JobCardDAO;
|
|
||||||
import com.utopiaindustries.dao.ctp.PurchaseOrderCTPDao;
|
|
||||||
import com.utopiaindustries.dao.ctp.StoreItemDao;
|
|
||||||
import com.utopiaindustries.model.ctp.*;
|
|
||||||
import com.utopiaindustries.model.uind.PurchaseOrder;
|
|
||||||
import com.utopiaindustries.querybuilder.ctp.JobCardQueryBuilder;
|
|
||||||
import com.utopiaindustries.querybuilder.ctp.PurchaseOrderCTPQueryBuilder;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class PurchaseOrderCTPService {
|
|
||||||
|
|
||||||
private final PurchaseOrderCTPDao purchaseOrderCTPDao;
|
|
||||||
private final JobCardDAO jobCardDAO;
|
|
||||||
private final StoreItemDao storeItemDao;
|
|
||||||
|
|
||||||
public PurchaseOrderCTPService(PurchaseOrderCTPDao purchaseOrderCTPDao, JobCardDAO jobCardDAO, StoreItemDao storeItemDao) {
|
|
||||||
this.purchaseOrderCTPDao = purchaseOrderCTPDao;
|
|
||||||
this.jobCardDAO = jobCardDAO;
|
|
||||||
this.storeItemDao = storeItemDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* search by id
|
|
||||||
* */
|
|
||||||
public PurchaseOrderCTP searchPurchaseOrderById(long id){
|
|
||||||
return purchaseOrderCTPDao.find(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* create new purchase
|
|
||||||
* */
|
|
||||||
public PurchaseOrderCTP createNewPurchaseOrderCTP() {
|
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
|
||||||
PurchaseOrderCTP purchaseOrderCTP = new PurchaseOrderCTP();
|
|
||||||
purchaseOrderCTP.setCreatedBy( authentication.getName() );
|
|
||||||
purchaseOrderCTP.setCreatedAt( LocalDateTime.now() );
|
|
||||||
return purchaseOrderCTP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* save purchase order for ctp
|
|
||||||
* */
|
|
||||||
@Transactional( rollbackFor = Exception.class )
|
|
||||||
public void save(PurchaseOrderCTP purchaseOrderCTP) {
|
|
||||||
purchaseOrderCTPDao.save(purchaseOrderCTP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PurchaseOrderCTP> getAllPurchaseOrderCtp(String purchaseOrderCode, String articleName, String startDate, String endDate, Long limit) {
|
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
|
||||||
List<PurchaseOrderCTP> list = new ArrayList<>();
|
|
||||||
String createdBy = authentication.getName();
|
|
||||||
if( limit == null ){
|
|
||||||
limit = 100L;
|
|
||||||
}
|
|
||||||
if(StringUtils.isAnyNotNullOrEmpty(purchaseOrderCode, articleName,startDate,endDate) ){
|
|
||||||
for (GrantedAuthority role : authentication.getAuthorities()){
|
|
||||||
if (role.toString().equals("ROLE_ADMIN")){
|
|
||||||
createdBy = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String query = PurchaseOrderCTPQueryBuilder.buildQuery(purchaseOrderCode, articleName, createdBy, startDate, endDate, limit );
|
|
||||||
System.out.println( query );
|
|
||||||
list = purchaseOrderCTPDao.findByQuery( query );
|
|
||||||
}else {
|
|
||||||
list = purchaseOrderCTPDao.findByUserAndLimit( authentication.getName(), limit );
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PurchaseOrderCTP> findByTerm(String term ){
|
|
||||||
return purchaseOrderCTPDao.findByTerm( term );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Integer> getStoreItemsByPoId(Long poId){
|
|
||||||
Map<String,Integer> totalItems = new HashMap<>();
|
|
||||||
List<JobCard> jobCards = jobCardDAO.findByPoId(poId);
|
|
||||||
List<Long> jobCardIds = jobCards.stream()
|
|
||||||
.map(JobCard::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if(!jobCardIds.isEmpty()){
|
|
||||||
return storeItemDao.totalCountByJobCardIdsAndGroupByRejectReason(jobCardIds);
|
|
||||||
}else {
|
|
||||||
return totalItems;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,58 +1,21 @@
|
||||||
package com.utopiaindustries.service;
|
package com.utopiaindustries.service;
|
||||||
|
|
||||||
import com.utopiaindustries.dao.ctp.StoreItemDao;
|
|
||||||
import com.utopiaindustries.dao.uind.PurchaseOrderDAO;
|
import com.utopiaindustries.dao.uind.PurchaseOrderDAO;
|
||||||
import com.utopiaindustries.model.ctp.JobCardItem;
|
|
||||||
import com.utopiaindustries.model.ctp.POsDetails;
|
|
||||||
import com.utopiaindustries.model.uind.PurchaseOrder;
|
import com.utopiaindustries.model.uind.PurchaseOrder;
|
||||||
import com.utopiaindustries.util.HTMLBuilder;
|
|
||||||
import com.utopiaindustries.util.PDFResponseEntityInputStreamResource;
|
|
||||||
import com.utopiaindustries.util.URLUtils;
|
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.ui.Model;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PurchaseOrderService {
|
public class PurchaseOrderService {
|
||||||
|
|
||||||
private final PurchaseOrderDAO purchaseOrderDAO;
|
private final PurchaseOrderDAO purchaseOrderDAO;
|
||||||
private final PurchaseOrderCTPService purchaseOrderCTPService;
|
|
||||||
private final HTMLBuilder htmlBuilder;
|
|
||||||
private PDFResponseEntityInputStreamResource pdfGenerator;
|
|
||||||
|
|
||||||
public PurchaseOrderService(PurchaseOrderDAO purchaseOrderDAO, PurchaseOrderCTPService purchaseOrderCTPService, HTMLBuilder htmlBuilder, PDFResponseEntityInputStreamResource pdfGenerator) {
|
public PurchaseOrderService(PurchaseOrderDAO purchaseOrderDAO) {
|
||||||
this.purchaseOrderDAO = purchaseOrderDAO;
|
this.purchaseOrderDAO = purchaseOrderDAO;
|
||||||
this.purchaseOrderCTPService = purchaseOrderCTPService;
|
|
||||||
this.htmlBuilder = htmlBuilder;
|
|
||||||
this.pdfGenerator = pdfGenerator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseOrder> findByTerm( String term ){
|
public List<PurchaseOrder> findByTerm( String term ){
|
||||||
return purchaseOrderDAO.findByTerm( term );
|
return purchaseOrderDAO.findByTerm( term );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Print Job card *
|
|
||||||
* **/
|
|
||||||
public ResponseEntity<InputStreamResource> generatePOPdf(POsDetails pOsDetails, Model model, boolean jobCardDetail, boolean storeDetail ) throws Exception {
|
|
||||||
Map<String,Integer> storeItems = purchaseOrderCTPService.getStoreItemsByPoId(pOsDetails.getPoId());
|
|
||||||
model.addAttribute("poDetail", pOsDetails);
|
|
||||||
model.addAttribute( "baseUrl", URLUtils.getCurrentBaseUrl() );
|
|
||||||
|
|
||||||
if (storeDetail && !storeItems.isEmpty()){
|
|
||||||
model.addAttribute("showStore", true);
|
|
||||||
model.addAttribute("store", storeItems);
|
|
||||||
}else {
|
|
||||||
model.addAttribute("showStore", false);
|
|
||||||
}
|
|
||||||
String htmlStr = htmlBuilder.buildHTML( "po-status-pdf", model );
|
|
||||||
// return pdf
|
|
||||||
return pdfGenerator.generatePdf( htmlStr, "Po-status", "inline" );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,834 +0,0 @@
|
||||||
package com.utopiaindustries.service;
|
|
||||||
|
|
||||||
|
|
||||||
import com.utopiaindustries.dao.ctp.*;
|
|
||||||
import com.utopiaindustries.model.ctp.*;
|
|
||||||
import com.utopiaindustries.querybuilder.ctp.SummaryInventoryReportQueryBuilder;
|
|
||||||
import com.utopiaindustries.util.CTPDateTimeFormat;
|
|
||||||
import com.utopiaindustries.util.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ReportingService {
|
|
||||||
|
|
||||||
private final JobCardItemDAO jobCardItemDAO;
|
|
||||||
private final BundleDAO bundleDAO;
|
|
||||||
private final InventoryTransactionLegDAO inventoryTransactionLegDAO;
|
|
||||||
private final JobCardDAO jobCardDAO;
|
|
||||||
private final FinishedItemDAO finishedItemDAO;
|
|
||||||
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
|
||||||
private final InventoryAccountDAO inventoryAccountDAO;
|
|
||||||
private final PurchaseOrderCTPDao purchaseOrderCTPDao;
|
|
||||||
private final StoreItemDao storeItemDao;
|
|
||||||
private final PackagingItemsDAO packagingItemsDAO;
|
|
||||||
|
|
||||||
public ReportingService(JobCardItemDAO jobCardItemDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, JobCardDAO jobCardDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO, PurchaseOrderCTPDao purchaseOrderCTPDao, StoreItemDao storeItemDao, PackagingItemsDAO packagingItemsDAO) {
|
|
||||||
this.jobCardItemDAO = jobCardItemDAO;
|
|
||||||
this.bundleDAO = bundleDAO;
|
|
||||||
this.inventoryTransactionLegDAO = inventoryTransactionLegDAO;
|
|
||||||
this.jobCardDAO = jobCardDAO;
|
|
||||||
this.finishedItemDAO = finishedItemDAO;
|
|
||||||
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
|
||||||
this.inventoryAccountDAO = inventoryAccountDAO;
|
|
||||||
this.purchaseOrderCTPDao = purchaseOrderCTPDao;
|
|
||||||
this.storeItemDao = storeItemDao;
|
|
||||||
this.packagingItemsDAO = packagingItemsDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Integer> getJobCardProgress(String jobCardID) {
|
|
||||||
if (jobCardID == null) {
|
|
||||||
return new LinkedHashMap<>();
|
|
||||||
} else {
|
|
||||||
Map<String, Integer> totalProgress = new HashMap<>();
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
|
||||||
|
|
||||||
BigDecimal totalProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
BigDecimal actualProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
BigDecimal expectedProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
// Cutting Progress Calculation
|
|
||||||
if (actualProduction.compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
totalProgress.put("Cutting Progress", 0);
|
|
||||||
} else if (actualProduction.compareTo(expectedProduction) < 0) {
|
|
||||||
BigDecimal cuttingProgress = actualProduction
|
|
||||||
.divide(expectedProduction, 4, RoundingMode.HALF_UP)
|
|
||||||
.multiply(BigDecimal.valueOf(100));
|
|
||||||
totalProgress.put("Cutting Progress", cuttingProgress.intValue());
|
|
||||||
} else {
|
|
||||||
totalProgress.put("Cutting Progress", 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stitching Progress Calculation
|
|
||||||
if (totalProduction.compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
totalProgress.put("Stitching Progress", 0);
|
|
||||||
} else {
|
|
||||||
BigDecimal stitchingProgress = totalProduction
|
|
||||||
.divide(actualProduction, 4, RoundingMode.HALF_UP)
|
|
||||||
.multiply(BigDecimal.valueOf(100));
|
|
||||||
totalProgress.put("Stitching Progress", stitchingProgress.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// QA Progress Calculation
|
|
||||||
Long qaProgressItems = stitchingOfflineItemDAO.CalculateTotalQA(Long.parseLong(jobCardID));
|
|
||||||
if (qaProgressItems == 0) {
|
|
||||||
totalProgress.put("QA Progress", 0);
|
|
||||||
} else {
|
|
||||||
BigDecimal qaProgress = BigDecimal.valueOf(qaProgressItems)
|
|
||||||
.divide(actualProduction, 4, RoundingMode.HALF_UP)
|
|
||||||
.multiply(BigDecimal.valueOf(100));
|
|
||||||
totalProgress.put("QA Progress", qaProgress.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finishing Progress Calculation
|
|
||||||
Long totalFinishItem = finishedItemDAO.calculateTotalFinishItem(Long.parseLong(jobCardID));
|
|
||||||
if (totalFinishItem == 0) {
|
|
||||||
totalProgress.put("Finishing Progress", 0);
|
|
||||||
} else {
|
|
||||||
BigDecimal finishItemProgress = BigDecimal.valueOf(totalFinishItem)
|
|
||||||
.divide(actualProduction, 4, RoundingMode.HALF_UP)
|
|
||||||
.multiply(BigDecimal.valueOf(100));
|
|
||||||
totalProgress.put("Finishing Progress", finishItemProgress.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Job Card Progress Calculation
|
|
||||||
if (totalProduction.compareTo(BigDecimal.ZERO) == 0 && actualProduction.compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
totalProgress.put("Job Card Progress", 0);
|
|
||||||
} else {
|
|
||||||
BigDecimal progressPercentage;
|
|
||||||
if (actualProduction.compareTo(expectedProduction) > 0) {
|
|
||||||
progressPercentage = actualProduction.add(totalProduction)
|
|
||||||
.add(BigDecimal.valueOf(qaProgressItems))
|
|
||||||
.add(BigDecimal.valueOf(totalFinishItem))
|
|
||||||
.divide(actualProduction.multiply(BigDecimal.valueOf(4)), 4, RoundingMode.HALF_UP)
|
|
||||||
.multiply(BigDecimal.valueOf(100));
|
|
||||||
} else {
|
|
||||||
progressPercentage = actualProduction.add(totalProduction)
|
|
||||||
.add(BigDecimal.valueOf(qaProgressItems))
|
|
||||||
.add(BigDecimal.valueOf(totalFinishItem))
|
|
||||||
.divide(expectedProduction.multiply(BigDecimal.valueOf(4)), 4, RoundingMode.HALF_UP)
|
|
||||||
.multiply(BigDecimal.valueOf(100));
|
|
||||||
}
|
|
||||||
totalProgress.put("Job Card Progress", progressPercentage.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sorting Map based on Custom Order
|
|
||||||
Map<String, Integer> indexMap = new HashMap<>();
|
|
||||||
indexMap.put("Cutting Progress", 1);
|
|
||||||
indexMap.put("Stitching Progress", 2);
|
|
||||||
indexMap.put("QA Progress", 3);
|
|
||||||
indexMap.put("Finishing Progress", 4);
|
|
||||||
indexMap.put("Job Card Progress", 5);
|
|
||||||
|
|
||||||
return totalProgress.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Comparator.comparingInt(entry -> indexMap.get(entry.getKey())))
|
|
||||||
.collect(LinkedHashMap::new, (m, v) -> m.put(v.getKey(), v.getValue()), Map::putAll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Integer getTotalProduction(String jobCardID){
|
|
||||||
if (jobCardID == null){
|
|
||||||
return 0;
|
|
||||||
}else {
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
|
||||||
BigDecimal actualProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
return actualProduction.intValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Integer> getCompleteProduction(String jobCardID) {
|
|
||||||
if (jobCardID == null) {
|
|
||||||
return new LinkedHashMap<>();
|
|
||||||
} else {
|
|
||||||
HashMap<String, Integer> totalProgress = new HashMap<>();
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
|
||||||
|
|
||||||
BigDecimal totalProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
BigDecimal actualProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
Long qaProgressItems = stitchingOfflineItemDAO.CalculateTotalQA(Long.parseLong(jobCardID));
|
|
||||||
Long totalFinishItem = finishedItemDAO.calculateTotalFinishItem(Long.parseLong(jobCardID));
|
|
||||||
|
|
||||||
// Get Job card Complete Items
|
|
||||||
Map<String, Integer> jobCardCompleteItems = getSegregateItems(jobCardID);
|
|
||||||
Integer segregateTotalItems = jobCardCompleteItems.values().stream().mapToInt(Integer::intValue).sum();
|
|
||||||
|
|
||||||
// Add values to totalProgress map
|
|
||||||
totalProgress.put("Cutting Progress", actualProduction.intValue());
|
|
||||||
totalProgress.put("Stitching Progress", totalProduction.intValue());
|
|
||||||
totalProgress.put("QA Progress", qaProgressItems.intValue());
|
|
||||||
totalProgress.put("Finishing Progress", totalFinishItem.intValue());
|
|
||||||
totalProgress.put("Job Card Progress", segregateTotalItems);
|
|
||||||
|
|
||||||
//custom order
|
|
||||||
Map<String, Integer> indexMap = new HashMap<>();
|
|
||||||
indexMap.put("Job Card Progress", 1);
|
|
||||||
indexMap.put("Cutting Progress", 2);
|
|
||||||
indexMap.put("Stitching Progress", 3);
|
|
||||||
indexMap.put("Finishing Progress", 4);
|
|
||||||
indexMap.put("QA Progress", 5);
|
|
||||||
|
|
||||||
// Sort the keys based on custom order
|
|
||||||
return totalProgress.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Comparator.comparingInt(entry -> indexMap.get(entry.getKey())))
|
|
||||||
.collect(LinkedHashMap::new, (m, v) -> m.put(v.getKey(), v.getValue()), Map::putAll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Map<String,Integer> getSegregateItems(String jobCardID){
|
|
||||||
if (jobCardID == null){
|
|
||||||
return new HashMap<>();
|
|
||||||
}else {
|
|
||||||
HashMap<String,Integer> gradingItems = new HashMap<>();
|
|
||||||
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(Long.parseLong(jobCardID));
|
|
||||||
|
|
||||||
List<FinishedItem> bGradeFinishItemsIds= finishedItems.stream()
|
|
||||||
.filter(item -> "REJECT".equals(item.getQaStatus())).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<FinishedItem> cGradeFinishItemsIds= finishedItems.stream()
|
|
||||||
.filter(item -> "C GRADE".equals(item.getQaStatus())).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<FinishedItem> aGradeFinishItemsIds= finishedItems.stream()
|
|
||||||
.filter(item -> "APPROVED".equals(item.getQaStatus())).collect(Collectors.toList());
|
|
||||||
|
|
||||||
|
|
||||||
if (finishedItems.isEmpty()){
|
|
||||||
gradingItems.put("A GRADE",0);
|
|
||||||
gradingItems.put("B GRADE",0);
|
|
||||||
gradingItems.put("C GRADE",0);
|
|
||||||
return gradingItems;
|
|
||||||
}else {
|
|
||||||
gradingItems.put("B GRADE",bGradeFinishItemsIds.size());
|
|
||||||
gradingItems.put("C GRADE",cGradeFinishItemsIds.size());
|
|
||||||
gradingItems.put("A GRADE",aGradeFinishItemsIds.size());
|
|
||||||
return gradingItems;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String,String> getEachPhaseTotalTime(String jobCardID){
|
|
||||||
if (jobCardID == null){
|
|
||||||
return new HashMap<>();
|
|
||||||
}else {
|
|
||||||
HashMap<String,String> phasesTimes = new HashMap<>();
|
|
||||||
JobCard jobCard = jobCardDAO.find(Long.parseLong(jobCardID));
|
|
||||||
Bundle lastBundle = bundleDAO.findLastBundleByCardId(Long.parseLong(jobCardID));
|
|
||||||
|
|
||||||
//Cutting time
|
|
||||||
StringBuilder cuttingTime = generateTime(jobCard.getCreatedAt(),lastBundle.getCreatedAt());
|
|
||||||
phasesTimes.put("Cutting Total Time",cuttingTime.toString());
|
|
||||||
|
|
||||||
//Stitching time
|
|
||||||
List<Long> bundlesIds = bundleDAO.findByCardId(Long.parseLong(jobCardID)).stream().map(Bundle::getId).collect(Collectors.toList());
|
|
||||||
if (!bundlesIds.isEmpty()){
|
|
||||||
InventoryTransactionLeg inventoryTransactionLeg = inventoryTransactionLegDAO.getFirstStitchBundleTime(bundlesIds,"STITCH_BUNDLE");
|
|
||||||
StitchingOfflineItem lastStitchItem = stitchingOfflineItemDAO.getLastStitchItemByCardIdAndTime(Long.parseLong(jobCardID));
|
|
||||||
StringBuilder stitchingTime = generateTime(inventoryTransactionLeg.getTransactionLegDateTime(),lastStitchItem.getCreatedAt());
|
|
||||||
phasesTimes.put("Stitching Total Time",stitchingTime.toString());
|
|
||||||
}else {
|
|
||||||
phasesTimes.put("Stitching Total Time",null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return phasesTimes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String,String> countPendingItemsOnDifferentPhases(String jobCardID){
|
|
||||||
if (jobCardID == null){
|
|
||||||
return new HashMap<>();
|
|
||||||
}else {
|
|
||||||
HashMap<String,String> phasePending = new HashMap<String,String>();
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
|
||||||
BigDecimal totalProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
BigDecimal actualProduction = jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
if(actualProduction.compareTo(totalProduction) == 0) {
|
|
||||||
phasePending.put("Stitching Total Time", null);
|
|
||||||
}else {
|
|
||||||
phasePending.put("Stitching Total Time", "Pending");
|
|
||||||
}
|
|
||||||
return phasePending;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Map<String, Object>> getCuttingDetails(String jobCardID) {
|
|
||||||
if (jobCardID == null) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Map<String, Object>> cuttingDetails = new HashMap<>();
|
|
||||||
Map<String, InventoryAccount> cuttingAccount = new HashMap<>();
|
|
||||||
Map<String, String> cuttingPersonName = new HashMap<>();
|
|
||||||
Map<String, LocalDate> cuttingDate = new HashMap<>();
|
|
||||||
|
|
||||||
List<Bundle> bundles = bundleDAO.findByCardId(Long.parseLong(jobCardID));
|
|
||||||
if (bundles.isEmpty()) {
|
|
||||||
return cuttingDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<Long, Bundle> bundleMap = bundles.stream()
|
|
||||||
.collect(Collectors.toMap(Bundle::getId, Function.identity()));
|
|
||||||
|
|
||||||
List<Long> bundleIds = new ArrayList<>(bundleMap.keySet());
|
|
||||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO
|
|
||||||
.getTransactionByParentIdAndType(bundleIds, "BUNDLE");
|
|
||||||
|
|
||||||
for (InventoryTransactionLeg inventoryTransactionLeg : inventoryTransactionLegs) {
|
|
||||||
Integer accountId = inventoryTransactionLeg.getAccountId();
|
|
||||||
InventoryAccount inventoryAccount = inventoryAccountDAO.find(accountId.longValue());
|
|
||||||
if (inventoryAccount != null) {
|
|
||||||
String accountTitle = inventoryAccount.getTitle();
|
|
||||||
cuttingAccount.put(accountTitle, inventoryAccount);
|
|
||||||
Bundle bundle = bundleMap.get(inventoryTransactionLeg.getParentDocumentId());
|
|
||||||
cuttingPersonName.put(accountTitle, (bundle != null) ? bundle.getCreatedBy() : null);
|
|
||||||
cuttingDate.put(accountTitle,(bundle != null) ? bundle.getCreatedAt().toLocalDate() : null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cuttingDetails.put("accounts", new HashMap<>(cuttingAccount));
|
|
||||||
cuttingDetails.put("personName", new HashMap<>(cuttingPersonName));
|
|
||||||
cuttingDetails.put("date", new HashMap<>(cuttingDate));
|
|
||||||
|
|
||||||
return cuttingDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Map<String, Object>> getStitchingDetails(String jobCardID) {
|
|
||||||
if (jobCardID == null) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Map<String, Object>> stitchingDetails = new HashMap<>();
|
|
||||||
Map<String, InventoryAccount> stitchingAccount = new HashMap<>();
|
|
||||||
Map<String, String> stitchingPersonName = new HashMap<>();
|
|
||||||
Map<String, LocalDate> stitchingDate = new HashMap<>();
|
|
||||||
|
|
||||||
List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByJobCardId(Long.parseLong(jobCardID));
|
|
||||||
if (stitchingOfflineItems.isEmpty()) {
|
|
||||||
return stitchingDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<Long, StitchingOfflineItem> stitchingOfflineItemMap = stitchingOfflineItems.stream()
|
|
||||||
.collect(Collectors.toMap(StitchingOfflineItem::getId, Function.identity()));
|
|
||||||
|
|
||||||
List<Long> stitchingItemsArray = new ArrayList<>(stitchingOfflineItemMap.keySet());
|
|
||||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO
|
|
||||||
.getTransactionByParentIdAndType(stitchingItemsArray, "STITCHING_OFFLINE");
|
|
||||||
|
|
||||||
for (InventoryTransactionLeg inventoryTransactionLeg : inventoryTransactionLegs) {
|
|
||||||
Integer accountId = inventoryTransactionLeg.getAccountId();
|
|
||||||
InventoryAccount inventoryAccount = inventoryAccountDAO.find(accountId.longValue());
|
|
||||||
if (inventoryAccount != null) {
|
|
||||||
String accountTitle = inventoryAccount.getTitle();
|
|
||||||
stitchingAccount.put(accountTitle, inventoryAccount);
|
|
||||||
StitchingOfflineItem stitchingOfflineItem = stitchingOfflineItemMap.get(inventoryTransactionLeg.getParentDocumentId());
|
|
||||||
stitchingPersonName.put(accountTitle, (stitchingOfflineItem != null) ? stitchingOfflineItem.getCreatedBy() : null);
|
|
||||||
stitchingDate.put(accountTitle,(stitchingOfflineItem != null) ? stitchingOfflineItem.getCreatedAt().toLocalDate() : null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stitchingDetails.put("accounts", new HashMap<>(stitchingAccount));
|
|
||||||
stitchingDetails.put("personName", new HashMap<>(stitchingPersonName));
|
|
||||||
stitchingDetails.put("date", new HashMap<>(stitchingDate));
|
|
||||||
|
|
||||||
return stitchingDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Map<String, List<?>> getPhasesProgressDayWise(String jobCardID) {
|
|
||||||
if (jobCardID == null) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findByParentEntityTypeAndParentId("PROCESS",6L);
|
|
||||||
|
|
||||||
LocalDateTime startDate = jobCardDAO.find(Long.parseLong(jobCardID)).getCreatedAt();
|
|
||||||
HashMap<String, List<?>> barChartData = new HashMap<>();
|
|
||||||
|
|
||||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO
|
|
||||||
.getTransactionByJobCardAndDatesAndType(Long.parseLong(jobCardID), startDate.toString(), LocalDateTime.now().toString(), "IN");
|
|
||||||
|
|
||||||
//remove quality multiple transaction entry approved/rejects
|
|
||||||
List<InventoryTransactionLeg> filteredTransactions = inventoryTransactionLegs.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
leg -> leg.getAccountId() + "-" + leg.getParentDocumentType() + "-" + leg.getParentDocumentId(),
|
|
||||||
leg -> leg, // Value
|
|
||||||
(existing, replacement) -> existing.getTransactionLegDateTime().isBefore(replacement.getTransactionLegDateTime()) ? existing : replacement // Keep Oldest
|
|
||||||
))
|
|
||||||
.values()
|
|
||||||
.stream()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
||||||
|
|
||||||
List<String> uniqueDates = inventoryTransactionLegs.stream()
|
|
||||||
.map(leg -> leg.getTransactionLegDateTime().toLocalDate().format(formatter))
|
|
||||||
.distinct()
|
|
||||||
.sorted()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
Map<String, Integer> dateIndexMap = new HashMap<>();
|
|
||||||
for (int i = 0; i < uniqueDates.size(); i++) {
|
|
||||||
dateIndexMap.put(uniqueDates.get(i), i);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Integer> cuttingList = new ArrayList<>(Collections.nCopies(uniqueDates.size(), 0));
|
|
||||||
List<Integer> stitchingList = new ArrayList<>(Collections.nCopies(uniqueDates.size(), 0));
|
|
||||||
List<Integer> qualityList = new ArrayList<>(Collections.nCopies(uniqueDates.size(), 0));
|
|
||||||
List<Integer> finishItems = new ArrayList<>(Collections.nCopies(uniqueDates.size(), 0));
|
|
||||||
|
|
||||||
for (InventoryTransactionLeg leg : filteredTransactions) {
|
|
||||||
String dateKey = leg.getTransactionLegDateTime().format(formatter);
|
|
||||||
int index = dateIndexMap.get(dateKey);
|
|
||||||
if ("BUNDLE".equals(leg.getParentDocumentType())) {
|
|
||||||
Bundle bundle = bundleDAO.find(leg.getParentDocumentId());
|
|
||||||
cuttingList.set(index, cuttingList.get(index) + bundle.getWrapQuantity().intValue());
|
|
||||||
}
|
|
||||||
else if ("STITCHING_OFFLINE".equals(leg.getParentDocumentType())) {
|
|
||||||
stitchingList.set(index, stitchingList.get(index) + leg.getQuantity().intValue());
|
|
||||||
}
|
|
||||||
else if ("FINISHED_ITEM".equals(leg.getParentDocumentType()) && (leg.getAccountId().equals(7) || leg.getAccountId().equals(12))) {
|
|
||||||
qualityList.set(index, qualityList.get(index) + leg.getQuantity().intValue());
|
|
||||||
}
|
|
||||||
else if ("PACKAGING".equals(leg.getParentDocumentType()) && inventoryAccounts.stream().anyMatch(e -> e.getId() == leg.getAccountId().longValue())) {
|
|
||||||
finishItems.set(index, finishItems.get(index) + leg.getQuantity().intValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
barChartData.put("dates", uniqueDates);
|
|
||||||
barChartData.put("cutting", cuttingList);
|
|
||||||
barChartData.put("stitching", stitchingList);
|
|
||||||
barChartData.put("quality", qualityList);
|
|
||||||
barChartData.put("finishing", finishItems);
|
|
||||||
|
|
||||||
return barChartData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<POsDetails> getAllPOs(String poCode) {
|
|
||||||
|
|
||||||
List<POsDetails> pOsDetailsList = new ArrayList<>();
|
|
||||||
List<PurchaseOrderCTP> purchaseOrderCTPList;
|
|
||||||
|
|
||||||
if (poCode != null && !poCode.isEmpty()) {
|
|
||||||
purchaseOrderCTPList = purchaseOrderCTPDao.findByPoCode(poCode);
|
|
||||||
}else {
|
|
||||||
purchaseOrderCTPList = purchaseOrderCTPDao.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (PurchaseOrderCTP pos : purchaseOrderCTPList) {
|
|
||||||
List<JobCard> jobCards = jobCardDAO.findByPoId(pos.getId());
|
|
||||||
BigDecimal totalProduction = BigDecimal.ZERO;
|
|
||||||
BigDecimal expectedProduction = BigDecimal.ZERO;
|
|
||||||
BigDecimal actualProduction = BigDecimal.ZERO;
|
|
||||||
long stitchingIn = 0L;
|
|
||||||
long stitchingOut = 0L;
|
|
||||||
long finishApprovedItem = 0L;
|
|
||||||
long finishRejectItem = 0L;
|
|
||||||
long storeItems = 0L;
|
|
||||||
long packagingItems = 0L;
|
|
||||||
POsDetails pOsDetails = new POsDetails();
|
|
||||||
for (JobCard jobCard : jobCards) {
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(jobCard.getId());
|
|
||||||
expectedProduction = expectedProduction.add(jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
||||||
|
|
||||||
totalProduction = totalProduction.add(jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
||||||
|
|
||||||
actualProduction = actualProduction.add(jobCardItems.stream()
|
|
||||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
||||||
|
|
||||||
//stitching detail
|
|
||||||
stitchingIn += Optional.of(stitchingOfflineItemDAO.findByJobCardId(jobCard.getId()).size()).orElse(0);
|
|
||||||
stitchingOut += Optional.ofNullable(stitchingOfflineItemDAO.CalculateTotalQA(jobCard.getId())).orElse(0L);
|
|
||||||
|
|
||||||
//finishItems detail
|
|
||||||
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(jobCard.getId());
|
|
||||||
finishApprovedItem += finishedItems.stream().filter(e -> e.getQaStatus().equals("APPROVED")).count();
|
|
||||||
finishRejectItem += finishedItems.stream().filter(e -> e.getQaStatus().equals("REJECT")).count();
|
|
||||||
|
|
||||||
//reject store details
|
|
||||||
storeItems += Optional.ofNullable(storeItemDao.calculateTotalRejectItemByJobCardId(jobCard.getId())).orElse(0L);
|
|
||||||
|
|
||||||
//reject packaging details
|
|
||||||
packagingItems += Optional.of(packagingItemsDAO.findByJobCardId(jobCard.getId()).size()).orElse(0);
|
|
||||||
|
|
||||||
}
|
|
||||||
pOsDetails.setPoId(pos.getId());
|
|
||||||
pOsDetails.setPoNumber(pos.getPurchaseOrderCode());
|
|
||||||
pOsDetails.setArticleTitle(pos.getArticleName());
|
|
||||||
pOsDetails.setPoQuantity(pos.getPurchaseOrderQuantity());
|
|
||||||
pOsDetails.setPoRequiredQuantity(pos.getPurchaseOrderQuantityRequired());
|
|
||||||
pOsDetails.setActualCutting(expectedProduction.longValue());
|
|
||||||
pOsDetails.setBalanceToCutting(pos.getPurchaseOrderQuantityRequired() - actualProduction.longValue());
|
|
||||||
pOsDetails.setCuttingReceived(expectedProduction.longValue());
|
|
||||||
pOsDetails.setCuttingOki(actualProduction.intValue());
|
|
||||||
pOsDetails.setCuttingReject(expectedProduction.subtract(actualProduction).intValue());
|
|
||||||
pOsDetails.setStitchingIn(stitchingIn);
|
|
||||||
pOsDetails.setStitchingOut(stitchingOut);
|
|
||||||
pOsDetails.setStitchingWips(stitchingIn - stitchingOut);
|
|
||||||
pOsDetails.setFinishIn(stitchingOut);
|
|
||||||
pOsDetails.setFinishRej(finishRejectItem);
|
|
||||||
pOsDetails.setFinishQaApproved(finishApprovedItem);
|
|
||||||
pOsDetails.setStoreReceived(storeItems);
|
|
||||||
pOsDetails.setStoreWaiting(finishRejectItem - storeItems);
|
|
||||||
pOsDetails.setFinishQaApproved(finishApprovedItem);
|
|
||||||
pOsDetails.setPackagingIn(packagingItems);
|
|
||||||
pOsDetails.setPackagingOut(packagingItems);
|
|
||||||
pOsDetails.setPackagingStock(0);
|
|
||||||
pOsDetails.setShippedScan(packagingItems);
|
|
||||||
pOsDetails.setShippedNet(packagingItems);
|
|
||||||
pOsDetails.setPackagingStock(0);
|
|
||||||
pOsDetails.setPoStatus(false);
|
|
||||||
pOsDetailsList.add(pOsDetails);
|
|
||||||
}
|
|
||||||
return pOsDetailsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
HashMap<String, Map<String, Integer>> poJobCardItemsProgress = new HashMap<>();
|
|
||||||
// Filter JobCards by Purchase Order ID
|
|
||||||
List<JobCard> filterJobCardsByPos = jobCardDAO.findByPoId(poId);
|
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.getPackagingAccounts();
|
|
||||||
List<Integer> gradingAccounts = inventoryAccounts.stream().map(e-> (int)(e.getId())).collect(Collectors.toList());
|
|
||||||
for (JobCard jobCard : filterJobCardsByPos) {
|
|
||||||
List<Bundle> bundles = bundleDAO.findByCardIdAndDATE(jobCard.getId(),startDate,endDate);
|
|
||||||
List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByJobCardIdAndDate(jobCard.getId(),startDate,endDate);
|
|
||||||
List<FinishedItem> finishedItems = finishedItemDAO.calculateTotalFinishItem(jobCard.getId(),startDate,endDate);
|
|
||||||
|
|
||||||
//cutting days wise
|
|
||||||
BigDecimal cutting = bundles.stream()
|
|
||||||
.map(bundle -> Optional.ofNullable(bundle.getWrapQuantity()).orElse(BigDecimal.ZERO))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
//stitching day wise
|
|
||||||
Integer stitching = stitchingOfflineItems.size();
|
|
||||||
|
|
||||||
//total qa
|
|
||||||
Integer qa = finishedItems.size();
|
|
||||||
Map<String, Integer> segregateItems = finishedItems.stream()
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
FinishedItem::getQaStatus,
|
|
||||||
Collectors.collectingAndThen(
|
|
||||||
Collectors.counting(),
|
|
||||||
Long::intValue
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
Map<String, Integer> items = getCompleteProduction(String.valueOf(jobCard.getId()));
|
|
||||||
items.put("Cutting Progress",cutting.intValue());
|
|
||||||
items.put("Stitching Progress",stitching);
|
|
||||||
items.put("QA Progress",qa);
|
|
||||||
items.put("A Grade",segregateItems.get("APPROVED") != null ? segregateItems.get("APPROVED") : 0);
|
|
||||||
items.put("B Grade / Reject",segregateItems.get("REJECT") != null ? segregateItems.get("REJECT") : 0);
|
|
||||||
|
|
||||||
// Define sorting order
|
|
||||||
Map<String, Integer> indexMap = new HashMap<>();
|
|
||||||
indexMap.put("Job Card Progress", 1);
|
|
||||||
indexMap.put("Cutting Progress", 2);
|
|
||||||
indexMap.put("Stitching Progress", 3);
|
|
||||||
indexMap.put("QA Progress", 4);
|
|
||||||
indexMap.put("Finishing Progress", 5);
|
|
||||||
indexMap.put("APPROVED", 6);
|
|
||||||
indexMap.put("REJECT", 7);
|
|
||||||
|
|
||||||
// Sort items based on indexMap order
|
|
||||||
Map<String, Integer> sortedItems = items.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Comparator.comparingInt(entry -> indexMap.getOrDefault(entry.getKey(), Integer.MAX_VALUE)))
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
Map.Entry::getKey,
|
|
||||||
Map.Entry::getValue,
|
|
||||||
(oldValue, newValue) -> oldValue,
|
|
||||||
LinkedHashMap::new
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add sorted items to the result map
|
|
||||||
poJobCardItemsProgress.put(jobCard.getCode(), sortedItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
return poJobCardItemsProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getCuttingTableDetails(String jobCardId, String cuttingTableId, String startDate, String endDate) {
|
|
||||||
Map<String, Object> cuttingDetails = new HashMap<>();
|
|
||||||
long jobCardIdTemp = 0L;
|
|
||||||
String startDate1 = null;
|
|
||||||
String endDate1 = null;
|
|
||||||
|
|
||||||
if (!StringUtils.isNullOrEmpty(startDate)) {
|
|
||||||
String formattedStart = CTPDateTimeFormat.getMySQLFormattedDateString(startDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
|
|
||||||
String formattedEnd = !StringUtils.isNullOrEmpty(endDate)
|
|
||||||
? CTPDateTimeFormat.getMySQLFormattedDateString(endDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT)
|
|
||||||
: LocalDate.now().toString();
|
|
||||||
|
|
||||||
startDate1 = String.format("'%s 00:00:01'", formattedStart);
|
|
||||||
endDate1 = String.format("'%s 23:59:59'", formattedEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findByParentEntityTypeAndParentId("PROCESS", 1L);
|
|
||||||
List<Long> inventoryAccountIds = inventoryAccounts.stream().map(InventoryAccount::getId).collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (!StringUtils.isNullOrEmpty(jobCardId)) {
|
|
||||||
jobCardIdTemp = Long.parseLong(jobCardId);
|
|
||||||
} else if (!StringUtils.isNullOrEmpty(cuttingTableId)) {
|
|
||||||
inventoryAccountIds = List.of(Long.parseLong(cuttingTableId));
|
|
||||||
}
|
|
||||||
|
|
||||||
String query = SummaryInventoryReportQueryBuilder.cuttingQueryBuild(jobCardIdTemp, inventoryAccountIds, null, startDate1, endDate1, "IN","BUNDLE");
|
|
||||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO.findByQuery(query);
|
|
||||||
|
|
||||||
Map<String, Integer> dateWiseProduction = new TreeMap<>();
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
|
||||||
|
|
||||||
Map<LocalDate, List<Long>> dateWiseJobCardIds = inventoryTransactionLegs.stream()
|
|
||||||
.filter(e -> e.getTransactionLegDateTime() != null && e.getJobCardId() != 0)
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
e -> e.getTransactionLegDateTime().toLocalDate(),
|
|
||||||
Collectors.mapping(InventoryTransactionLeg::getJobCardId, Collectors.toList())
|
|
||||||
));
|
|
||||||
|
|
||||||
for (Map.Entry<LocalDate, List<Long>> entry : dateWiseJobCardIds.entrySet()) {
|
|
||||||
List<Long> jobCardIds = entry.getValue();
|
|
||||||
if (!jobCardIds.isEmpty()) {
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByJobCardIds(jobCardIds);
|
|
||||||
int totalProduction = jobCardItems.stream()
|
|
||||||
.filter(item -> item.getActualProduction() != null)
|
|
||||||
.mapToInt(item -> item.getActualProduction().intValue())
|
|
||||||
.sum();
|
|
||||||
dateWiseProduction.put(entry.getKey().format(formatter), totalProduction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Long> distinctJobCardIds = inventoryTransactionLegs.stream()
|
|
||||||
.map(InventoryTransactionLeg::getJobCardId)
|
|
||||||
.filter(id -> id != 0)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
Map<Long, List<CuttingJobCardItemWrapper>> jobCardItemsCuttingDetailsMap = new HashMap<>();
|
|
||||||
|
|
||||||
for (long jobCardIdEntry : distinctJobCardIds) {
|
|
||||||
Long accountId = inventoryTransactionLegs.stream()
|
|
||||||
.filter(e -> e.getJobCardId() == jobCardIdEntry)
|
|
||||||
.map(e -> e.getAccountId().longValue())
|
|
||||||
.findFirst()
|
|
||||||
.orElse(0L);
|
|
||||||
|
|
||||||
JobCard jobCard = jobCardDAO.find(jobCardIdEntry);
|
|
||||||
Bundle bundle = bundleDAO.findByCardId(jobCardIdEntry).stream().findFirst().orElse(new Bundle());
|
|
||||||
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(jobCardIdEntry);
|
|
||||||
|
|
||||||
List<CuttingJobCardItemWrapper> wrappers = jobCardItems.stream().map(item -> {
|
|
||||||
CuttingJobCardItemWrapper wrapper = new CuttingJobCardItemWrapper();
|
|
||||||
wrapper.setArticleName(jobCard.getArticleName());
|
|
||||||
wrapper.setJobCardCode(jobCard.getCode());
|
|
||||||
wrapper.setGsm(item.getGsm());
|
|
||||||
wrapper.setPly(item.getPly());
|
|
||||||
wrapper.setSku(item.getSku());
|
|
||||||
wrapper.setTotal(item.getActualProduction().longValue());
|
|
||||||
wrapper.setWidth(item.getWidth());
|
|
||||||
wrapper.setWtPly(item.getWtPly());
|
|
||||||
wrapper.setComplete(item.isComplete());
|
|
||||||
wrapper.setPoName(jobCard.getPurchaseOrderId());
|
|
||||||
wrapper.setOperatorName(bundle.getCreatedBy());
|
|
||||||
wrapper.setJobCardId(item.getJobCardId());
|
|
||||||
wrapper.setLength(item.getLength());
|
|
||||||
wrapper.setAccountId(accountId);
|
|
||||||
return wrapper;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
|
|
||||||
jobCardItemsCuttingDetailsMap.computeIfAbsent(accountId, k -> new ArrayList<>()).addAll(wrappers);
|
|
||||||
}
|
|
||||||
|
|
||||||
cuttingDetails.put("Date Wise Cutting", dateWiseProduction);
|
|
||||||
cuttingDetails.put("accountWiseCutting", jobCardItemsCuttingDetailsMap);
|
|
||||||
cuttingDetails.put("cuttingAccount", inventoryAccounts);
|
|
||||||
return cuttingDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getStitchingDetails(String jobCardId, String stitchingLine, String startDate, String endDate) {
|
|
||||||
Map<String, Object> stitchingDetails = new HashMap<>();
|
|
||||||
long jobCardIdTemp = 0L;
|
|
||||||
String startDate1 = null;
|
|
||||||
String endDate1 = null;
|
|
||||||
|
|
||||||
if (!StringUtils.isNullOrEmpty(startDate)) {
|
|
||||||
String formattedStart = CTPDateTimeFormat.getMySQLFormattedDateString(startDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
|
|
||||||
String formattedEnd = !StringUtils.isNullOrEmpty(endDate)
|
|
||||||
? CTPDateTimeFormat.getMySQLFormattedDateString(endDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT)
|
|
||||||
: LocalDate.now().toString();
|
|
||||||
|
|
||||||
startDate1 = String.format("'%s 00:00:01'", formattedStart);
|
|
||||||
endDate1 = String.format("'%s 23:59:59'", formattedEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findByParentEntityTypeAndParentId("PROCESS", 2L);
|
|
||||||
List<Long> inventoryAccountIds = inventoryAccounts.stream().map(InventoryAccount::getId).collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (!StringUtils.isNullOrEmpty(jobCardId)) {
|
|
||||||
jobCardIdTemp = Long.parseLong(jobCardId);
|
|
||||||
} else if (!StringUtils.isNullOrEmpty(stitchingLine)) {
|
|
||||||
inventoryAccountIds = List.of(Long.parseLong(stitchingLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
String query = SummaryInventoryReportQueryBuilder.cuttingQueryBuild(jobCardIdTemp, inventoryAccountIds,null, startDate1, endDate1, "IN","STITCHING_OFFLINE");
|
|
||||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO.findByQuery(query);
|
|
||||||
|
|
||||||
Map<String, Integer> dateWiseProduction = new TreeMap<>();
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
|
||||||
|
|
||||||
Map<LocalDate, List<Long>> dateWiseJobCardIds = inventoryTransactionLegs.stream()
|
|
||||||
.filter(e -> e.getTransactionLegDateTime() != null && e.getJobCardId() != 0)
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
e -> e.getTransactionLegDateTime().toLocalDate(),
|
|
||||||
Collectors.mapping(InventoryTransactionLeg::getJobCardId, Collectors.toList())
|
|
||||||
));
|
|
||||||
|
|
||||||
for (Map.Entry<LocalDate, List<Long>> entry : dateWiseJobCardIds.entrySet()) {
|
|
||||||
LocalDate date = entry.getKey();
|
|
||||||
List<Long> jobCardIds = entry.getValue();
|
|
||||||
|
|
||||||
if (!jobCardIds.isEmpty()) {
|
|
||||||
int totalProduction = inventoryTransactionLegs.stream()
|
|
||||||
.filter(item -> jobCardIds.contains(item.getJobCardId()) &&
|
|
||||||
"STITCHING_OFFLINE".equals(item.getParentDocumentType()) && item.getTransactionLegDateTime().toLocalDate().equals(date))
|
|
||||||
.mapToInt(item -> item.getQuantity().intValue())
|
|
||||||
.sum();
|
|
||||||
|
|
||||||
dateWiseProduction.put(date.format(formatter), totalProduction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Long> distinctJobCardIds = inventoryTransactionLegs.stream()
|
|
||||||
.map(InventoryTransactionLeg::getJobCardId)
|
|
||||||
.filter(id -> id != 0)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
Map<Long, List<CuttingJobCardItemWrapper>> jobCardItemsStitchingDetailsMap = new HashMap<>();
|
|
||||||
Map<String, Integer> totalStitchingBasedOnAccountID = new HashMap<>();
|
|
||||||
|
|
||||||
for (long jobCardIdEntry : distinctJobCardIds) {
|
|
||||||
Long accountId = inventoryTransactionLegs.stream()
|
|
||||||
.filter(e -> e.getJobCardId() == jobCardIdEntry)
|
|
||||||
.map(e -> e.getAccountId().longValue())
|
|
||||||
.findFirst()
|
|
||||||
.orElse(0L);
|
|
||||||
|
|
||||||
JobCard jobCard = jobCardDAO.find(jobCardIdEntry);
|
|
||||||
List<StitchingOfflineItem> stitchingOfflineItem = stitchingOfflineItemDAO.findByJobCardId(jobCardIdEntry);
|
|
||||||
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(jobCardIdEntry);
|
|
||||||
|
|
||||||
List<CuttingJobCardItemWrapper> wrappers = jobCardItems.stream().map(item -> {
|
|
||||||
CuttingJobCardItemWrapper wrapper = new CuttingJobCardItemWrapper();
|
|
||||||
wrapper.setArticleName(jobCard.getArticleName());
|
|
||||||
wrapper.setJobCardId(jobCard.getId());
|
|
||||||
wrapper.setJobCardCode(jobCard.getCode());
|
|
||||||
wrapper.setSku(item.getSku());
|
|
||||||
wrapper.setPoName(jobCard.getPurchaseOrderId());
|
|
||||||
wrapper.setJobCardId(item.getJobCardId());
|
|
||||||
wrapper.setOperatorName(stitchingOfflineItem.get(0).getCreatedBy());
|
|
||||||
wrapper.setAccountId(accountId);
|
|
||||||
return wrapper;
|
|
||||||
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
totalStitchingBasedOnAccountID.put(jobCard.getId()+stitchingOfflineItem.get(0).getSku(), stitchingOfflineItem.size());
|
|
||||||
jobCardItemsStitchingDetailsMap.computeIfAbsent(accountId, k -> new ArrayList<>()).addAll(wrappers);
|
|
||||||
}
|
|
||||||
|
|
||||||
stitchingDetails.put("totalStitchingBasedOnAccountID", totalStitchingBasedOnAccountID);
|
|
||||||
stitchingDetails.put("jobCardItemsStitchingDetailsMap", jobCardItemsStitchingDetailsMap);
|
|
||||||
stitchingDetails.put("Date Wise Stitching", dateWiseProduction);
|
|
||||||
|
|
||||||
stitchingDetails.put("stitchingAccount", inventoryAccounts);
|
|
||||||
return stitchingDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StitchingOfflineItem> stitchingItemsTransactions(String jobCardId, String accountId, String sku, String startDate, String endDate) {
|
|
||||||
List<Long> accountID = new ArrayList<>();
|
|
||||||
String startDate1 = null;
|
|
||||||
String endDate1 = null;
|
|
||||||
|
|
||||||
if (!StringUtils.isNullOrEmpty(startDate) && !StringUtils.isNullOrEmpty(accountId) && !StringUtils.isNullOrEmpty(jobCardId)) {
|
|
||||||
String formattedStart = CTPDateTimeFormat.getMySQLFormattedDateString(startDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
|
|
||||||
String formattedEnd = !StringUtils.isNullOrEmpty(endDate)
|
|
||||||
? CTPDateTimeFormat.getMySQLFormattedDateString(endDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT)
|
|
||||||
: LocalDate.now().toString();
|
|
||||||
|
|
||||||
startDate1 = String.format("'%s 00:00:01'", formattedStart);
|
|
||||||
endDate1 = String.format("'%s 23:59:59'", formattedEnd);
|
|
||||||
accountID.add(Long.parseLong(accountId));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String query = SummaryInventoryReportQueryBuilder.cuttingQueryBuild(Long.parseLong(jobCardId), accountID, sku, startDate1, endDate1,"IN","STITCHING_OFFLINE");
|
|
||||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO.findByQuery(query);
|
|
||||||
List<Long> stitchingItemsList = inventoryTransactionLegs.stream()
|
|
||||||
.map(InventoryTransactionLeg::getParentDocumentId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return stitchingOfflineItemDAO.findByIds(stitchingItemsList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private StringBuilder generateTime(LocalDateTime startDate, LocalDateTime endDate){
|
|
||||||
StringBuilder totalTime = new StringBuilder();
|
|
||||||
if(startDate != null && endDate != null){
|
|
||||||
Duration duration = Duration.between(startDate, endDate);
|
|
||||||
if (duration.toDays() > 0) {
|
|
||||||
totalTime.append(String.format("%d days, ", duration.toDays()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (duration.toHours() % 24 > 0) {
|
|
||||||
totalTime.append(String.format("%d hours, ", duration.toHours() % 24));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (duration.toMinutes() % 60 > 0) {
|
|
||||||
totalTime.append(String.format("%d minutes ", duration.toMinutes() % 60));
|
|
||||||
}
|
|
||||||
return totalTime;
|
|
||||||
}else return totalTime.append("");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.utopiaindustries.service;
|
|
||||||
|
|
||||||
import com.utopiaindustries.dao.ctp.PackagingItemsDAO;
|
|
||||||
import com.utopiaindustries.model.ctp.FinishedItemWrapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class StoreService {
|
|
||||||
|
|
||||||
private final InventoryService inventoryService;
|
|
||||||
|
|
||||||
public StoreService(InventoryService inventoryService, PackagingItemsDAO packagingItemsDAO) {
|
|
||||||
this.inventoryService = inventoryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createStoreItems(FinishedItemWrapper wrapper ) {
|
|
||||||
inventoryService.createStoreItemAndTransaction(wrapper, wrapper.getAccountId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.utopiaindustries.util;
|
|
||||||
|
|
||||||
import com.itextpdf.html2pdf.attach.ITagWorker;
|
|
||||||
import com.itextpdf.html2pdf.attach.ProcessorContext;
|
|
||||||
import com.itextpdf.html2pdf.attach.impl.DefaultTagWorkerFactory;
|
|
||||||
import com.itextpdf.html2pdf.html.TagConstants;
|
|
||||||
import com.itextpdf.styledxmlparser.node.IElementNode;
|
|
||||||
|
|
||||||
public class CustomTagWorkerFactory extends DefaultTagWorkerFactory {
|
|
||||||
public ITagWorker getCustomTagWorker( IElementNode tag, ProcessorContext context) {
|
|
||||||
if ( TagConstants.HTML.equals(tag.name())) {
|
|
||||||
return new ZeroMarginHtmlTagWorker(tag, context);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
package com.utopiaindustries.util;
|
|
||||||
|
|
||||||
import com.utopiaindustries.dialect.CTPDialect;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.thymeleaf.TemplateEngine;
|
|
||||||
import org.thymeleaf.context.Context;
|
|
||||||
import org.thymeleaf.templatemode.TemplateMode;
|
|
||||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
|
||||||
import org.w3c.tidy.Tidy;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class HTMLBuilder {
|
|
||||||
private final String UTF_8 = StandardCharsets.UTF_8.displayName();
|
|
||||||
|
|
||||||
public String buildHTML( String templateName, Model model ) throws Exception {
|
|
||||||
// template resolver
|
|
||||||
ClassLoaderTemplateResolver pdfTemplateResolver = createPDFTemplateResolver();
|
|
||||||
// template engine
|
|
||||||
TemplateEngine templateEngine = new TemplateEngine();
|
|
||||||
templateEngine.setTemplateResolver( pdfTemplateResolver );
|
|
||||||
templateEngine.addDialect( new CTPDialect() );
|
|
||||||
// context
|
|
||||||
Context ctx = configureContext( model );
|
|
||||||
// render the template
|
|
||||||
String renderedHTMLContent = templateEngine.process( templateName, ctx );
|
|
||||||
return convertToXhtml( renderedHTMLContent );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String buildHTMLMap( String templateName, ModelMap model ) throws Exception {
|
|
||||||
// template resolver
|
|
||||||
ClassLoaderTemplateResolver pdfTemplateResolver = createPDFTemplateResolver();
|
|
||||||
// template engine
|
|
||||||
TemplateEngine templateEngine = new TemplateEngine();
|
|
||||||
templateEngine.setTemplateResolver( pdfTemplateResolver );
|
|
||||||
templateEngine.addDialect( new CTPDialect() );
|
|
||||||
// context
|
|
||||||
Context ctx = configureContextMap( model );
|
|
||||||
// render the template
|
|
||||||
String renderedHTMLContent = templateEngine.process( templateName, ctx );
|
|
||||||
return convertToXhtml( renderedHTMLContent );
|
|
||||||
}
|
|
||||||
|
|
||||||
private String convertToXhtml( String html ) throws UnsupportedEncodingException {
|
|
||||||
Tidy tidy = new Tidy();
|
|
||||||
tidy.setInputEncoding( UTF_8 );
|
|
||||||
tidy.setOutputEncoding( UTF_8 );
|
|
||||||
tidy.setXHTML( true );
|
|
||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream( html.getBytes( UTF_8 ) );
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
||||||
tidy.parseDOM( inputStream, outputStream );
|
|
||||||
return outputStream.toString( UTF_8 );
|
|
||||||
}
|
|
||||||
|
|
||||||
private ClassLoaderTemplateResolver createPDFTemplateResolver() {
|
|
||||||
ClassLoaderTemplateResolver pdfTemplateResolver = new ClassLoaderTemplateResolver();
|
|
||||||
pdfTemplateResolver.setPrefix( "/templates/" );
|
|
||||||
pdfTemplateResolver.setTemplateMode( TemplateMode.HTML );
|
|
||||||
pdfTemplateResolver.setSuffix( ".html" );
|
|
||||||
pdfTemplateResolver.setCharacterEncoding( UTF_8 );
|
|
||||||
pdfTemplateResolver.setOrder( 1 );
|
|
||||||
return pdfTemplateResolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Context configureContext( Model model ) {
|
|
||||||
Context ctx = new Context();
|
|
||||||
// adding model attributes to context
|
|
||||||
for ( Map.Entry<String, Object> entry: model.asMap().entrySet() ) {
|
|
||||||
ctx.setVariable( entry.getKey(), entry.getValue() );
|
|
||||||
}
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Context configureContextMap( ModelMap model ) {
|
|
||||||
Context ctx = new Context();
|
|
||||||
// adding model attributes to context
|
|
||||||
for ( Map.Entry<String, Object> entry: model.entrySet() ) {
|
|
||||||
ctx.setVariable( entry.getKey(), entry.getValue() );
|
|
||||||
}
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
package com.utopiaindustries.util;
|
|
||||||
|
|
||||||
import com.itextpdf.html2pdf.ConverterProperties;
|
|
||||||
import com.itextpdf.html2pdf.HtmlConverter;
|
|
||||||
import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
|
|
||||||
import com.itextpdf.kernel.geom.PageSize;
|
|
||||||
import com.itextpdf.kernel.geom.Rectangle;
|
|
||||||
import com.itextpdf.kernel.pdf.PdfDocument;
|
|
||||||
import com.itextpdf.kernel.pdf.PdfWriter;
|
|
||||||
import com.itextpdf.layout.Document;
|
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class PDFResponseEntityInputStreamResource {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* prepare pdf document from html string
|
|
||||||
*/
|
|
||||||
private ResponseEntity<InputStreamResource> createPDFResponseEntityInputStreamResource( String htmlStr, String filename, String method ) throws IOException {
|
|
||||||
// output stream
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
||||||
// converter properties
|
|
||||||
ConverterProperties properties = new ConverterProperties();
|
|
||||||
properties.setFontProvider( new DefaultFontProvider( false, false, true ) );
|
|
||||||
// pdf document
|
|
||||||
PdfWriter writer = new PdfWriter( outputStream );
|
|
||||||
//temp Code
|
|
||||||
/* PdfDocument temp = new PdfDocument(writer);
|
|
||||||
Rectangle rectangle3x5 = new Rectangle(216, 360);
|
|
||||||
PageSize pageSize =new PageSize( rectangle3x5 );
|
|
||||||
temp.setDefaultPageSize( pageSize);
|
|
||||||
properties.setTagWorkerFactory( new CustomTagWorkerFactory() );*/
|
|
||||||
//temp code end
|
|
||||||
Document document = HtmlConverter.convertToDocument( htmlStr, writer, properties );
|
|
||||||
document.close();
|
|
||||||
// input stream
|
|
||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream( outputStream.toByteArray() );
|
|
||||||
// content disposition header
|
|
||||||
String headerContentDispositionStr = String.format( "%s; filename=%s.pdf", method, filename.replaceAll( ",", "-" ) );
|
|
||||||
// return response
|
|
||||||
return ResponseEntity
|
|
||||||
.ok()
|
|
||||||
.header( HttpHeaders.CONTENT_DISPOSITION, headerContentDispositionStr )
|
|
||||||
.contentType( MediaType.APPLICATION_PDF )
|
|
||||||
.body( new InputStreamResource( inputStream ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* prepare pdf document from html string
|
|
||||||
*/
|
|
||||||
private ResponseEntity<InputStreamResource> createPDFResponseEntityInvoiceInputStreamResource( String htmlStr, String filename, String method, long height, long width )
|
|
||||||
throws IOException {
|
|
||||||
// output stream
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
||||||
// converter properties
|
|
||||||
ConverterProperties properties = new ConverterProperties();
|
|
||||||
properties.setFontProvider( new DefaultFontProvider( false, true, false ) );
|
|
||||||
// pdf document
|
|
||||||
PdfWriter writer = new PdfWriter( outputStream );
|
|
||||||
//Code for invoice slips
|
|
||||||
PdfDocument temp = new PdfDocument( writer );
|
|
||||||
Rectangle rectangle3x5 = new Rectangle( width, height );
|
|
||||||
PageSize pageSize = new PageSize( rectangle3x5 );
|
|
||||||
temp.setDefaultPageSize( pageSize );
|
|
||||||
properties.setTagWorkerFactory( new CustomTagWorkerFactory() );
|
|
||||||
//temp code end
|
|
||||||
Document document = HtmlConverter.convertToDocument( htmlStr, temp, properties );
|
|
||||||
//document.setFontSize( 200.0f );
|
|
||||||
document.close();
|
|
||||||
// input stream
|
|
||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream( outputStream.toByteArray() );
|
|
||||||
// content disposition header
|
|
||||||
String headerContentDispositionStr = String.format( "%s; filename=%s.pdf", method, filename.replaceAll( ",", "-" ) );
|
|
||||||
// return response
|
|
||||||
return ResponseEntity
|
|
||||||
.ok()
|
|
||||||
.header( HttpHeaders.CONTENT_DISPOSITION, headerContentDispositionStr )
|
|
||||||
.contentType( MediaType.APPLICATION_PDF )
|
|
||||||
.body( new InputStreamResource( inputStream ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* with inline as default content disposition "inline"
|
|
||||||
*/
|
|
||||||
public ResponseEntity<InputStreamResource> generatePdf( String htmlStr, String filename ) throws IOException {
|
|
||||||
return this.createPDFResponseEntityInputStreamResource( htmlStr, filename, "inline" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* manual content disposition
|
|
||||||
*/
|
|
||||||
public ResponseEntity<InputStreamResource> generatePdf( String htmlStr, String filename, String method ) throws IOException {
|
|
||||||
return this.createPDFResponseEntityInputStreamResource( htmlStr, filename, method );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* manual content disposition
|
|
||||||
*/
|
|
||||||
public ResponseEntity<InputStreamResource> generateInvoicePdf( String htmlStr, String filename, String method, long height, long width ) throws IOException {
|
|
||||||
return this.createPDFResponseEntityInvoiceInputStreamResource( htmlStr, filename, method, height, width );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.utopiaindustries.util;
|
|
||||||
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
public class URLUtils {
|
|
||||||
|
|
||||||
public static String getCurrentBaseUrl() {
|
|
||||||
ServletRequestAttributes sra = ( ServletRequestAttributes ) RequestContextHolder.getRequestAttributes();
|
|
||||||
HttpServletRequest req = sra.getRequest();
|
|
||||||
return req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.utopiaindustries.util;
|
|
||||||
|
|
||||||
import com.itextpdf.html2pdf.attach.ProcessorContext;
|
|
||||||
import com.itextpdf.html2pdf.attach.impl.tags.HtmlTagWorker;
|
|
||||||
import com.itextpdf.layout.Document;
|
|
||||||
import com.itextpdf.styledxmlparser.node.IElementNode;
|
|
||||||
|
|
||||||
public class ZeroMarginHtmlTagWorker extends HtmlTagWorker {
|
|
||||||
public ZeroMarginHtmlTagWorker( IElementNode element, ProcessorContext context) {
|
|
||||||
super(element, context);
|
|
||||||
Document doc = (Document) getElementResult();
|
|
||||||
doc.setMargins(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
spring:
|
spring:
|
||||||
uinddatasource:
|
uinddatasource:
|
||||||
jdbcUrl: jdbc:mysql://utopia-industries-rr.c5qech8o9lgg.us-east-1.rds.amazonaws.com:3306/inventory
|
jdbcUrl: jdbc:mysql://192.168.90.147:3306
|
||||||
username: cut-to-pack
|
username: utopia
|
||||||
password: mAzFAivImnTqKJx4KNJ0
|
password: Utopia01
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
logbackUrl: jdbc:mysql://192.168.90.147:3306/uind_logs?serverTimezone=Asia/Karachi
|
logbackUrl: jdbc:mysql://192.168.90.147:3306/uind_logs?serverTimezone=Asia/Karachi
|
||||||
hikari:
|
hikari:
|
||||||
|
@ -19,7 +19,7 @@ spring:
|
||||||
pool-name: UINDCosmosPool
|
pool-name: UINDCosmosPool
|
||||||
leak-detection-threshold: 2000
|
leak-detection-threshold: 2000
|
||||||
localdatasource:
|
localdatasource:
|
||||||
jdbcUrl: jdbc:mysql://localhost:3306/cut_to_pack
|
jdbcUrl: jdbc:mysql://192.168.90.147:3306/cut_to_pack
|
||||||
username: utopia
|
username: utopia
|
||||||
password: Utopia01
|
password: Utopia01
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
|
|
@ -9,7 +9,7 @@ spring:
|
||||||
minimum-idle: 5
|
minimum-idle: 5
|
||||||
idle-timeout: 30000 # 30 seconds
|
idle-timeout: 30000 # 30 seconds
|
||||||
max-lifetime: 1800000 # 30 minutes
|
max-lifetime: 1800000 # 30 minutes
|
||||||
connection-timeout: 60000 # 30 seconds
|
connection-timeout: 30000 # 30 seconds
|
||||||
leak-detection-threshold: 10000
|
leak-detection-threshold: 10000
|
||||||
cosmosdatasource:
|
cosmosdatasource:
|
||||||
jdbcUrl: jdbc:mysql://192.168.90.147:3307
|
jdbcUrl: jdbc:mysql://192.168.90.147:3307
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
*,*:before,*:after{padding:0;margin:0;box-sizing:border-box}body{font-family:"Open Sans",sans-serif;font-size:7pt;font-weight:400;line-height:1.2em;background:#fff !important;color:#111;position:relative;background:rgba(0,0,0,0) !important}body.draft:before,body.draft:after,body.terminated:before,body.terminated:after,body.not-approved:before,body.not-approved:after,body.duplicate:before,body.duplicate:after,body.cancel:before,body.cancel:after{font-size:70pt;font-weight:bold;color:red;text-align:center;display:block;opacity:.6;position:absolute;top:250pt;left:0;transform:rotate(-45deg)}body.duplicate:before,body.duplicate:after{content:"DUPLICATE"}body.cancel:before,body.cancel:after{content:"CANCEL"}body.draft:before,body.draft:after{content:"DRAFT"}body.terminated:before,body.terminated:after{content:"TERMINATED"}body.not-approved:before,body.not-approved:after{content:"NOT APPROVED"}@page{font-family:"Open Sans",sans-serif;font-size:6.65pt;font-style:italic;margin:1.25cm 1.25cm;@bottom-left{content:"Utopia Industries Pvt. Limited"}@bottom-center{content:"Page " counter(page) " of " counter(pages)}@bottom-right{width:126px;height:122px;margin-top:-130px}}h1{font-size:2em}h2{font-size:2.2857142857em}h3{font-size:1.8571428571em}h4{font-size:1.7142857143em}h5{font-size:1.5714285714em}h6{font-size:1.4285714286em}h1,h2,h3,h4,h5,h6{font-family:"Open Sans Condensed",sans-serif;font-weight:700;page-break-after:avoid;page-break-inside:avoid;text-transform:uppercase;margin:1.5em 0 1em}h1.no-margin-top,h2.no-margin-top,h3.no-margin-top,h4.no-margin-top,h5.no-margin-top,h6.no-margin-top{margin-top:0}h1.no-margin-bottom,h2.no-margin-bottom,h3.no-margin-bottom,h4.no-margin-bottom,h5.no-margin-bottom,h6.no-margin-bottom{margin-bottom:0}.text-right{text-align:right}.text-uppercase{text-transform:uppercase}.text-center{text-align:center}.font-monospace{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}b{font-weight:700}img{page-break-inside:avoid;page-break-after:avoid}ul,ol,dl{page-break-before:avoid}table{width:100%;border-collapse:collapse;border:none}table td{border:none}table.bordered,table.bordered td{border:1px solid #111}table.borderless,table.borderless td{border:none;padding:0}.tr-footer{text-transform:uppercase}td{padding:.4285714286em .8571428571em;vertical-align:top}td.spacer{padding:1em 0}.tr-header td{font-family:"Open Sans Condensed",sans-serif;font-size:1em;font-weight:bold;text-transform:uppercase;color:#fff;background:#111}td.pd-0{padding:0}ul,ol{padding:0 1.4285714286em;margin:0}ul{list-style-type:disc}.spacer{width:100%;height:1px;margin:2em 0 1em}.row{overflow:hidden;width:100%}.col{float:left}.col.col-half{width:49.96%}.col.col-half.col-padded:first-child{padding-right:3.5pt}.col.col-half.col-padded:last-child{padding-left:3.5pt}.col.col-two-third{width:66.6666%}.col.col-one-third{width:33.3333%}.col.col-one-third.col-padded{padding-left:3.5pt;padding-right:3.5pt}.col.col-one-third.col-padded:first-child{padding-left:0}.col.col-one-third.col-padded:last-child{padding-right:0}.visitor-photo{text-align:center;width:23%;height:77pt;line-height:77pt;margin-left:5pt;border:1px solid #111}.visitor-photo img{display:inline-block;width:90%;height:auto}/*# sourceMappingURL=print.css.map */
|
|
|
@ -1,43 +0,0 @@
|
||||||
( async function(){
|
|
||||||
|
|
||||||
Vue.prototype.$types = window.ctp.types;
|
|
||||||
Vue.prototype.$accounts = window.ctp.accounts;
|
|
||||||
|
|
||||||
let app = new Vue({
|
|
||||||
el : '#dashboard',
|
|
||||||
data :{
|
|
||||||
jobCard : {}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
getStatus: function() {
|
|
||||||
return `badge-${this.jobCard.status}`;
|
|
||||||
},
|
|
||||||
getInvStatus: function() {
|
|
||||||
return `badge-${this.jobCard.inventoryStatus}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods : {
|
|
||||||
onCardSelect : function ( id, card ) {
|
|
||||||
// $.ajax({
|
|
||||||
// url: `/ctp/rest/job-cards/find/${id}`,
|
|
||||||
// method: 'GET',
|
|
||||||
// contentType: 'application/json',
|
|
||||||
// dataType: 'json',
|
|
||||||
// success: ( data ) => {
|
|
||||||
// this.jobCard = data;
|
|
||||||
// },
|
|
||||||
// error : function ( err ){
|
|
||||||
// alert( err );
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
console.log("hello")
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted : function () {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
})(jQuery);
|
|
Binary file not shown.
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
|
@ -1,410 +0,0 @@
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
if (typeof Highcharts === "undefined") {
|
|
||||||
console.error("Highcharts library not loaded!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createGaugeChart(progress, color, divId, title, height, width, fontSize, fontYAxis, fontXAxis, fontColor, total, actual, aGrade, bGrade, cGrade) {
|
|
||||||
Highcharts.chart(divId, {
|
|
||||||
chart: {
|
|
||||||
type: 'solidgauge',
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
plotBackgroundColor: null,
|
|
||||||
shadow: false
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: title,
|
|
||||||
y: 30
|
|
||||||
},
|
|
||||||
pane: {
|
|
||||||
startAngle: 0,
|
|
||||||
endAngle: 360,
|
|
||||||
y: 0,
|
|
||||||
background: [{
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
shape: "arc",
|
|
||||||
borderWidth: 0,
|
|
||||||
innerRadius: '60%',
|
|
||||||
outerRadius: '100%'
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
min: 0,
|
|
||||||
max: 100,
|
|
||||||
tickPositions: [],
|
|
||||||
lineWidth: 0,
|
|
||||||
minorTickLength: 0,
|
|
||||||
tickWidth: 0,
|
|
||||||
gridLineWidth: 0,
|
|
||||||
stops: [
|
|
||||||
[1, color]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
name: 'Percentage',
|
|
||||||
data: [progress],
|
|
||||||
dataLabels: {
|
|
||||||
format: '{y}% ',
|
|
||||||
y: fontYAxis,
|
|
||||||
x: fontXAxis,
|
|
||||||
borderWidth: 0,
|
|
||||||
backgroundColor: 'none',
|
|
||||||
style: {
|
|
||||||
fontSize: fontSize + 'px',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
color: fontColor
|
|
||||||
},
|
|
||||||
zIndex: 10
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
pointFormat: title == 'Finishing Progress' ? 'Percentage: ' + progress + '%<br>Total: ' + total + '<br>Completed: ' + actual + '<br>A Grade: ' + aGrade + '<br>B Grade: ' + bGrade + '<br>C Grade: ' + cGrade : 'Percentage: ' + progress + '%<br>Total: ' + total + '<br>Completed:' + actual
|
|
||||||
},
|
|
||||||
color: color,
|
|
||||||
showInLegend: false
|
|
||||||
}],
|
|
||||||
credits: {
|
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createBarChart(divId, height, width, title, aHeading, aData, bHeading, bData, cHeading, cData, dHeading, dData, dates, fontSize, maxValue) {
|
|
||||||
if (!document.getElementById(divId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Highcharts.chart(divId, {
|
|
||||||
chart: {
|
|
||||||
type: 'column',
|
|
||||||
height: height,
|
|
||||||
width: width,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: title,
|
|
||||||
align: 'center',
|
|
||||||
verticalAlign: 'top',
|
|
||||||
y: 30,
|
|
||||||
style: {
|
|
||||||
fontSize: fontSize,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
categories: dates,
|
|
||||||
labels: {
|
|
||||||
rotation: -45,
|
|
||||||
style: {
|
|
||||||
fontSize: 10 - fontSize,
|
|
||||||
fontWeight: 'bold'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
min: 0,
|
|
||||||
max: maxValue,
|
|
||||||
softMax: maxValue,
|
|
||||||
softMin: 0,
|
|
||||||
startOnTick: true,
|
|
||||||
endOnTick: true,
|
|
||||||
title: {
|
|
||||||
text: 'Total Progress',
|
|
||||||
style: {
|
|
||||||
fontSize: fontSize,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
labels: {
|
|
||||||
format: '{value}%'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
scrollbar: {
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
name: aHeading,
|
|
||||||
data: aData
|
|
||||||
}, {
|
|
||||||
name: bHeading,
|
|
||||||
data: bData
|
|
||||||
}, {
|
|
||||||
name: cHeading,
|
|
||||||
data: cData
|
|
||||||
}, {
|
|
||||||
name: dHeading,
|
|
||||||
data: dData
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function dashboardChart(
|
|
||||||
divId, height, width, title,
|
|
||||||
aHeading, aData, bHeading, bData, cHeading, cData,
|
|
||||||
dates, fontSize, fontSizeText, maxValue
|
|
||||||
) {
|
|
||||||
if (!document.getElementById(divId)) return;
|
|
||||||
|
|
||||||
Highcharts.chart(divId, {
|
|
||||||
chart: {
|
|
||||||
type: 'bar',
|
|
||||||
height: height,
|
|
||||||
width: width
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: title,
|
|
||||||
style: {
|
|
||||||
fontSize: fontSize
|
|
||||||
}
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
categories: dates,
|
|
||||||
labels: {
|
|
||||||
enabled: false
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: null
|
|
||||||
},
|
|
||||||
lineWidth: 2
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
max: maxValue,
|
|
||||||
min: 0,
|
|
||||||
title: {
|
|
||||||
text: null,
|
|
||||||
align: 'high',
|
|
||||||
style: {
|
|
||||||
fontSize: fontSizeText
|
|
||||||
}
|
|
||||||
},
|
|
||||||
labels: {
|
|
||||||
style: {
|
|
||||||
fontSize: fontSizeText
|
|
||||||
}
|
|
||||||
},
|
|
||||||
gridLineWidth: 0
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
itemStyle: {
|
|
||||||
fontSize: fontSizeText
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plotOptions: {
|
|
||||||
bar: {
|
|
||||||
borderRadius: '50%',
|
|
||||||
dataLabels: {
|
|
||||||
enabled: true,
|
|
||||||
style: {
|
|
||||||
fontSize: fontSizeText
|
|
||||||
}
|
|
||||||
},
|
|
||||||
groupPadding: 0.1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
credits: {
|
|
||||||
enabled: false
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: aHeading,
|
|
||||||
data: aData
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: bHeading,
|
|
||||||
data: bData
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: cHeading,
|
|
||||||
data: cData
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function createSingleBarChart(divId, height, width, title, Heading, Data, dates, fontSize, maxValue) {
|
|
||||||
if (!document.getElementById(divId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Highcharts.chart(divId, {
|
|
||||||
chart: {
|
|
||||||
type: 'column',
|
|
||||||
height: height,
|
|
||||||
width: width,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: title,
|
|
||||||
align: 'center',
|
|
||||||
verticalAlign: 'top',
|
|
||||||
y: 30,
|
|
||||||
style: {
|
|
||||||
fontSize: fontSize,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
categories: dates,
|
|
||||||
labels: {
|
|
||||||
rotation: -45,
|
|
||||||
style: {
|
|
||||||
fontSize: 10 - fontSize,
|
|
||||||
fontWeight: 'bold'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
min: 0,
|
|
||||||
max: maxValue,
|
|
||||||
softMax: maxValue,
|
|
||||||
softMin: 0,
|
|
||||||
startOnTick: true,
|
|
||||||
endOnTick: true,
|
|
||||||
title: {
|
|
||||||
text: 'Total Progress',
|
|
||||||
style: {
|
|
||||||
fontSize: fontSize,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
labels: {
|
|
||||||
format: '{value}%'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
itemStyle: {
|
|
||||||
fontSize: 10 - fontSize,
|
|
||||||
fontWeight: 'bold'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scrollbar: {
|
|
||||||
enabled: true
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
name: Heading,
|
|
||||||
data: Data
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeGauges();
|
|
||||||
|
|
||||||
function initializeGauges() {
|
|
||||||
|
|
||||||
const gaugeDivs2 = document.querySelectorAll('.gauge-chart2');
|
|
||||||
gaugeDivs2.forEach(function (div) {
|
|
||||||
const progress = div.getAttribute('data-progress');
|
|
||||||
const color = div.getAttribute('data-color');
|
|
||||||
const title = div.getAttribute('data-title');
|
|
||||||
const height = div.getAttribute('data-height');
|
|
||||||
const width = div.getAttribute('data-width');
|
|
||||||
const fontSize = div.getAttribute('data-fontSize');
|
|
||||||
const fontColor = div.getAttribute('data-fontColor');
|
|
||||||
const total = div.getAttribute('data-totalProduction');
|
|
||||||
const actual = div.getAttribute('data-actualProduction');
|
|
||||||
const divId = div.id;
|
|
||||||
console.log(actual)
|
|
||||||
createGaugeChart(parseInt(progress), color, divId, title, height, width, fontSize, -20, 4, fontColor, total, actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
const gaugeDivs = document.querySelectorAll('.gauge-chart');
|
|
||||||
gaugeDivs.forEach(function (div) {
|
|
||||||
const progress = div.getAttribute('data-progress');
|
|
||||||
const color = div.getAttribute('data-color');
|
|
||||||
const title = div.getAttribute('data-title');
|
|
||||||
const height = div.getAttribute('data-height');
|
|
||||||
const width = div.getAttribute('data-width');
|
|
||||||
const fontSize = div.getAttribute('data-fontSize');
|
|
||||||
const fontColor = div.getAttribute('data-fontColor');
|
|
||||||
const total = div.getAttribute('data-totalProduction');
|
|
||||||
const actual = div.getAttribute('data-actualProduction');
|
|
||||||
const aGrade = div.getAttribute('data-aGrade');
|
|
||||||
const bGrade = div.getAttribute('data-bGrade');
|
|
||||||
const cGrade = div.getAttribute('data-cGrade');
|
|
||||||
const divId = div.id;
|
|
||||||
createGaugeChart(parseInt(progress), color, divId, title, height, width, fontSize, -15, 2, fontColor, total, actual, aGrade, bGrade, cGrade);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
const barChart = document.querySelectorAll('.barChart');
|
|
||||||
barChart.forEach(function (div) {
|
|
||||||
const title = div.getAttribute('data-title');
|
|
||||||
const height = div.getAttribute('data-height');
|
|
||||||
const width = div.getAttribute('data-width');
|
|
||||||
const fontSize = div.getAttribute('data-fontSize');
|
|
||||||
const maxValue = Number(div.getAttribute('data-totalProduction'));
|
|
||||||
const aHeading = 'Cutting';
|
|
||||||
const aData = JSON.parse(div.getAttribute('data-cutting'));
|
|
||||||
const bHeading = 'Stitching';
|
|
||||||
const bData = JSON.parse(div.getAttribute('data-stitching'));
|
|
||||||
const cHeading = 'End Line Quality Checking';
|
|
||||||
const cData = JSON.parse(div.getAttribute('data-quality'));
|
|
||||||
const dHeading = "Finish Items";
|
|
||||||
const dData = JSON.parse(div.getAttribute('data-finishing'));
|
|
||||||
const dates = div.getAttribute('data-dates');
|
|
||||||
const datesArray = dates.split(',');
|
|
||||||
const divId = div.id;
|
|
||||||
createBarChart(divId, height, width, title, aHeading, aData, bHeading, bData, cHeading, cData, dHeading, dData, datesArray, fontSize, maxValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
const dashboardBarChart = document.querySelectorAll('.dashboardBarChart'); // fixed name
|
|
||||||
dashboardBarChart.forEach(function (div) {
|
|
||||||
const title = div.getAttribute('data-title');
|
|
||||||
const height = div.getAttribute('data-height');
|
|
||||||
const width = div.getAttribute('data-width');
|
|
||||||
const fontSize = div.getAttribute('data-fontSize');
|
|
||||||
|
|
||||||
const rawValue = div.getAttribute('data-totalProduction') || "0";
|
|
||||||
const cleanValue = rawValue.replace(/[^0-9.-]+/g, '');
|
|
||||||
const maxValue = Number(cleanValue);
|
|
||||||
|
|
||||||
const aHeading = 'Stitching';
|
|
||||||
const aDataString = div.getAttribute('data-stitching');
|
|
||||||
const cleanValueStitch = aDataString.replace(/[^0-9.-]+/g, '');
|
|
||||||
const aData = [Number(cleanValueStitch)];
|
|
||||||
|
|
||||||
const bHeading = 'Finishing';
|
|
||||||
const bDataString = div.getAttribute('data-finishing');
|
|
||||||
const packaging = bDataString.replace(/[^0-9.-]+/g, '');
|
|
||||||
const bData = [Number(packaging)];
|
|
||||||
|
|
||||||
const cHeading = 'Packaging';
|
|
||||||
const cDataString = div.getAttribute('data-packaging');
|
|
||||||
const cleanValueAchieved = cDataString.replace(/[^0-9.-]+/g, '');
|
|
||||||
const cData = [Number(cleanValueAchieved)];
|
|
||||||
|
|
||||||
const dates = [div.getAttribute('data-dates')];
|
|
||||||
const divId = div.id;
|
|
||||||
dashboardChart(
|
|
||||||
divId,
|
|
||||||
height,
|
|
||||||
width,
|
|
||||||
title,
|
|
||||||
aHeading,
|
|
||||||
aData,
|
|
||||||
bHeading,
|
|
||||||
bData,
|
|
||||||
cHeading,
|
|
||||||
cData,
|
|
||||||
dates,
|
|
||||||
fontSize,
|
|
||||||
'20',
|
|
||||||
maxValue
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const cuttingBarChart = document.querySelectorAll('.singleBarChart');
|
|
||||||
cuttingBarChart.forEach(function (div) {
|
|
||||||
const title = div.getAttribute('data-title');
|
|
||||||
const height = div.getAttribute('data-height');
|
|
||||||
const width = div.getAttribute('data-width');
|
|
||||||
const fontSize = div.getAttribute('data-fontSize');
|
|
||||||
const maxValue = Number(div.getAttribute('data-totalProduction'));
|
|
||||||
const Heading = div.getAttribute('data-barHeading');
|
|
||||||
const Data = JSON.parse(div.getAttribute('data-barData'));
|
|
||||||
const dates = div.getAttribute('data-dates');
|
|
||||||
const datesArray = dates.split(',');
|
|
||||||
const divId = div.id;
|
|
||||||
createSingleBarChart(divId, height, width, title, Heading, Data, datesArray, fontSize, maxValue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,91 +0,0 @@
|
||||||
(async function () {
|
|
||||||
|
|
||||||
Vue.component('bundle-table', {
|
|
||||||
props: ['bundles'],
|
|
||||||
methods: {
|
|
||||||
removeBundle: function (idx) {
|
|
||||||
this.$emit('bundle-remove', idx)
|
|
||||||
},
|
|
||||||
getFormattedDateTime: function (bundle) {
|
|
||||||
if (!!bundle.createdAt) {
|
|
||||||
return bundle.createdAt.split('T')[0] + ' ' + bundle.createdAt.split('T')[1];
|
|
||||||
}
|
|
||||||
return luxon.DateTime.now().toFormat('yyyy-MM-dd HH:mm:ss');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
template: `
|
|
||||||
<table class="table table-bordered bg-white col-sm-8">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Item ID</th>
|
|
||||||
<th>Sku</th>
|
|
||||||
<th>Job Card ID</th>
|
|
||||||
<th>Wrap Quantity</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="(bundle,index) in bundles">
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].id'" v-bind:value="bundle.id" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].itemId'" v-bind:value="bundle.itemId" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].sku'" v-bind:value="bundle.sku" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].masterBundleId'" v-bind:value="bundle.masterBundleId" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].jobCardId'" v-bind:value="bundle.jobCardId" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].wrapQuantity'" v-bind:value="bundle.wrapQuantity" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].type'" v-bind:value="bundle.type" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].barcode'" v-bind:value="bundle.barcode" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(bundle.createdAt)" >
|
|
||||||
<input hidden="hidden" v-bind:name="'bundles[' + index + '].createdBy'" v-bind:value="bundle.createdBy" >
|
|
||||||
<td><span>{{bundle.id}}</span></td>
|
|
||||||
<td><span>{{bundle.itemId}}</span></td>
|
|
||||||
<td><span>{{bundle.sku}}</span></td>
|
|
||||||
<td><span>{{bundle.jobCardId}}</span></td>
|
|
||||||
<td><span>{{bundle.wrapQuantity}}</span></td>
|
|
||||||
<td><span>{{bundle.type}}</span></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeBundle(index)">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
`
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
let app = new Vue({
|
|
||||||
el: "#jobcardsidebar",
|
|
||||||
data: {
|
|
||||||
bundles: [],
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
removeBundle: function (idx) {
|
|
||||||
this.bundles.splice(idx, 1)
|
|
||||||
},
|
|
||||||
onBundleSelect: function (id, bundle) {
|
|
||||||
this.bundles.push(
|
|
||||||
bundle
|
|
||||||
)
|
|
||||||
},
|
|
||||||
hasMultipleItemSelect : function () {
|
|
||||||
const ids = this.bundles.map(item => item.itemId);
|
|
||||||
const uniqueIds = new Set(ids);
|
|
||||||
return uniqueIds.size > 1;
|
|
||||||
},
|
|
||||||
hasDuplicates: function () {
|
|
||||||
const ids = this.bundles.map(item => item.id);
|
|
||||||
const uniqueIds = new Set(ids);
|
|
||||||
return ids.length !== uniqueIds.size;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted: function () {
|
|
||||||
this.bundles = window.ctp.wrapper.bundles;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
})(jQuery);
|
|
|
@ -1,8 +1,9 @@
|
||||||
(async function () {
|
( async function(){
|
||||||
|
|
||||||
Vue.prototype.$accounts = window.ctp.accounts;
|
Vue.prototype.$accounts = window.ctp.accounts;
|
||||||
|
|
||||||
Vue.component('finished-item-table', {
|
Vue.component('finished-item-table',{
|
||||||
props: ['items'],
|
props : [ 'items' ],
|
||||||
methods: {
|
methods: {
|
||||||
getFormattedDateTime: function (dateTime) {
|
getFormattedDateTime: function (dateTime) {
|
||||||
if (!!dateTime) {
|
if (!!dateTime) {
|
||||||
|
@ -14,8 +15,8 @@
|
||||||
this.$emit('remove-item', index)
|
this.$emit('remove-item', index)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `
|
template : `
|
||||||
<table class="table table-bordered bg-white col-sm-12">
|
<table class="table table-bordered bg-white col-sm-12">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
|
@ -26,54 +27,68 @@
|
||||||
<th>Job Card ID</th>
|
<th>Job Card ID</th>
|
||||||
<th>Barcode</th>
|
<th>Barcode</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Account</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(item,index) in items">
|
<tr v-for="(item,index) in items">
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].id'" v-bind:value="item.id">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].id'" v-bind:value="item.id">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].itemId'" v-bind:value="item.itemId">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].itemId'" v-bind:value="item.itemId">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].sku'" v-bind:value="item.sku">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].sku'" v-bind:value="item.sku">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].createdBy'" v-bind:value="item.createdBy">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].createdBy'" v-bind:value="item.createdBy">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(item.createdAt)">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(item.createdAt)">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].barcode'" v-bind:value="item.barcode">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].barcode'" v-bind:value="item.barcode" >
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].isQa'" v-bind:value="item.isQa">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].isQa'" v-bind:value="item.isQa">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].stitchedItemId'" v-bind:value="item.stitchedItemId">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].stitchedItemId'" v-bind:value="item.stitchedItemId">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].isSegregated'" v-bind:value="item.isSegregated">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].isSegregated'" v-bind:value="item.isSegregated">
|
||||||
<span> {{item.id}} </span>
|
<span> {{item.id}} </span>
|
||||||
</td>
|
</td>
|
||||||
<td> {{item.itemId}} </td>
|
<td> {{item.itemId}} </td>
|
||||||
<td> {{item.sku}} </td>
|
<td> {{item.sku}} </td>
|
||||||
<td> {{item.createdBy}} </td>
|
<td> {{item.createdBy}} </td>
|
||||||
<td> {{ getFormattedDateTime(item.createdAt) }} </td>
|
<td> {{ getFormattedDateTime( item.createdAt) }} </td>
|
||||||
<td> {{item.jobCardId}} </td>
|
<td> {{item.jobCardId}}</td>
|
||||||
<td> {{item.barcode}} </td>
|
<td> {{item.barcode}} </td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="!item.qaStatus" class="badge badge-danger">NOT PERFORMED</span>
|
<select class="w-100" required v-bind:name="'items[' + index + '].qaStatus'" v-model="item.qaStatus">
|
||||||
<span v-else-if="item.qaStatus === 'APPROVED'" class="font-lg badge badge-success">{{ item.qaStatus }}</span>
|
<option value="WASHED">WASHED</option>
|
||||||
<span v-else-if="item.qaStatus === 'ALTER' || item.qaStatus === 'B GRADE' || item.qaStatus === 'C GRADE' " class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
<option value="ALTER">ALTER</option>
|
||||||
<span v-else-if="item.qaStatus === 'WASHED'" class="font-lg badge badge-APPROVED">{{ item.qaStatus }}</span>
|
<option value="APPROVED">APPROVED</option>
|
||||||
<span v-else-if="item.qaStatus === 'REJECT'" class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
</select><br>
|
||||||
|
<!-- <textarea class="w-100 mt-1" rows="2" v-model="item.qaRemarks" -->
|
||||||
|
<!-- v-if="item.accountId === '0'" -->
|
||||||
|
<!-- v-bind:name="'items[' + index + '].qaRemarks'"></textarea> -->
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-light" v-on:click="removeItem(index)">
|
<select class="w-100" required v-bind:name="'items[' + index + '].accountId'"
|
||||||
|
v-model="item.accountId"
|
||||||
|
v-bind:disabled="item.qaStatus !== 'APPROVED'"
|
||||||
|
v-bind:required="item.qaStatus === 'APPROVED'">
|
||||||
|
<option v-for="(option,index) in $accounts"
|
||||||
|
v-bind:value="option.id">{{option.title}}</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
`
|
`,
|
||||||
});
|
|
||||||
|
})
|
||||||
|
|
||||||
let app = new Vue({
|
let app = new Vue({
|
||||||
el: '#finishedApp',
|
el : '#finishedApp',
|
||||||
data: {
|
data : {
|
||||||
items: [],
|
items : []
|
||||||
QaStatus: 'APPROVED'
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods : {
|
||||||
onItemSelect: function (id, item) {
|
onItemSelect: function (id, item) {
|
||||||
this.items.push(item);
|
this.items.push(item);
|
||||||
},
|
},
|
||||||
|
@ -85,15 +100,10 @@
|
||||||
const uniqueIds = new Set(ids);
|
const uniqueIds = new Set(ids);
|
||||||
return ids.length !== uniqueIds.size;
|
return ids.length !== uniqueIds.size;
|
||||||
},
|
},
|
||||||
submitWithQaStatus: function (status) {
|
|
||||||
this.QaStatus = status;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
document.getElementById('finishedApp').submit();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted : function () {
|
||||||
console.log(this.$accounts);
|
console.log( this.$accounts )
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
})(jQuery);
|
|
||||||
|
})(jQuery)
|
|
@ -219,11 +219,7 @@
|
||||||
data: {
|
data: {
|
||||||
jobCard: {},
|
jobCard: {},
|
||||||
items: [],
|
items: [],
|
||||||
purchaseOrderID:0,
|
},
|
||||||
articleName: '',
|
|
||||||
purchaseOrderQuantityRequired: 0,
|
|
||||||
purchaseOrderCode: '',
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
addItem: function (e) {
|
addItem: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -263,19 +259,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}, onPoSelect(id,purchaseOrder) {
|
|
||||||
this.purchaseOrderID = id,
|
|
||||||
this.articleName = purchaseOrder.articleName,
|
|
||||||
this.purchaseOrderQuantityRequired = purchaseOrder.purchaseOrderQuantityRequired,
|
|
||||||
this.purchaseOrderCode = purchaseOrder.purchaseOrderCode
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.jobCard = window.ctp.jobCard;
|
this.jobCard = window.ctp.jobCard;
|
||||||
this.purchaseOrderID = this.jobCard.purchaseOrderId,
|
|
||||||
this.articleName = this.jobCard.articleName,
|
|
||||||
this.purchaseOrderQuantityRequired = this.jobCard.poQuantity,
|
|
||||||
this.purchaseOrderCode = this.jobCard.purchaseOrderTitle
|
|
||||||
this.items = this.jobCard.items;
|
this.items = this.jobCard.items;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,112 +0,0 @@
|
||||||
( async function(){
|
|
||||||
|
|
||||||
Vue.prototype.$accounts = window.ctp.accounts;
|
|
||||||
|
|
||||||
Vue.component('finish-item-table',{
|
|
||||||
props : [ 'items' ],
|
|
||||||
methods: {
|
|
||||||
getFormattedDateTime: function (dateTime) {
|
|
||||||
if (!!dateTime) {
|
|
||||||
return dateTime.split('T')[0] + ' ' + dateTime.split('T')[1];
|
|
||||||
}
|
|
||||||
return luxon.DateTime.now().toFormat('yyyy-MM-dd HH:mm:ss');
|
|
||||||
},
|
|
||||||
removeItem: function (index) {
|
|
||||||
this.$emit('remove-item', index)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
template : `
|
|
||||||
<table class="table table-bordered bg-white col-sm-12">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Item ID</th>
|
|
||||||
<th>Sku</th>
|
|
||||||
<th>Created By</th>
|
|
||||||
<th>Created At</th>
|
|
||||||
<th>Job Card ID</th>
|
|
||||||
<th>Barcode</th>
|
|
||||||
<th>Status</th>
|
|
||||||
<th>Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="(item,index) in items">
|
|
||||||
<td>
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].id'" v-bind:value="item.id">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].itemId'" v-bind:value="item.itemId">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].sku'" v-bind:value="item.sku">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].createdBy'" v-bind:value="item.createdBy">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(item.createdAt)">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].barcode'" v-bind:value="item.barcode" >
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].isQa'" v-bind:value="item.isQa">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].stitchedItemId'" v-bind:value="item.stitchedItemId">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].isSegregated'" v-bind:value="item.isSegregated">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].qaStatus'" v-bind:value="item.qaStatus">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].accountId'" v-bind:value="item.accountId">
|
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].operationDate'" v-bind:value="getFormattedDateTime(item.operationDate)">
|
|
||||||
<span> {{item.id}} </span>
|
|
||||||
</td>
|
|
||||||
<td> {{item.itemId}} </td>
|
|
||||||
<td> {{item.sku}} </td>
|
|
||||||
<td> {{item.createdBy}} </td>
|
|
||||||
<td> {{ getFormattedDateTime( item.createdAt) }} </td>
|
|
||||||
<td> {{item.jobCardId}}</td>
|
|
||||||
<td> {{item.barcode}} </td>
|
|
||||||
<td >
|
|
||||||
<span v-if="!item.qaStatus" class="badge badge-danger">NOT PERFORMED</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'APPROVED'" class="font-lg badge badge-success">{{ item.qaStatus }}</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'ALTER' || item.qaStatus === 'B GRADE'" class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'WASHED'" class="font-lg badge badge-APPROVED">{{ item.qaStatus }}</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'REJECT'" class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
`,
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
let app = new Vue({
|
|
||||||
el : '#packagingApp',
|
|
||||||
data : {
|
|
||||||
items : [],
|
|
||||||
reason: '',
|
|
||||||
},
|
|
||||||
methods : {
|
|
||||||
onItemSelect: function (id, item) {
|
|
||||||
this.items.push(item);
|
|
||||||
},
|
|
||||||
removeItem: function (index) {
|
|
||||||
this.items.splice(index, 1);
|
|
||||||
},
|
|
||||||
hasDuplicates: function () {
|
|
||||||
const ids = this.items.map(item => item.id);
|
|
||||||
const uniqueIds = new Set(ids);
|
|
||||||
return ids.length !== uniqueIds.size;
|
|
||||||
},
|
|
||||||
submitWithRejectReason: function (reason) {
|
|
||||||
this.reason = reason;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
const form = document.getElementById('packagingApp');
|
|
||||||
if (form.checkValidity()) {
|
|
||||||
form.submit();
|
|
||||||
} else {
|
|
||||||
form.reportValidity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted : function () {
|
|
||||||
console.log( this.$accounts )
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
})(jQuery)
|
|
File diff suppressed because one or more lines are too long
|
@ -50,10 +50,12 @@
|
||||||
<td> {{item.jobCardId}}</td>
|
<td> {{item.jobCardId}}</td>
|
||||||
<td> {{item.barcode}} </td>
|
<td> {{item.barcode}} </td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="!item.qaStatus" class="badge badge-danger">NOT PERFORMED</span>
|
<select class="w-100" required v-bind:name="'items[' + index + '].qaStatus'" v-model="item.qaStatus">
|
||||||
<span v-else-if="item.qaStatus === 'APPROVED'" class="font-lg badge badge-success">{{ item.qaStatus }}</span>
|
<option value="APPROVED">APPROVED</option>
|
||||||
<span v-else-if="item.qaStatus === 'REJECT'" class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
<option value="REJECT">REJECT</option>
|
||||||
</td>
|
</select><br>
|
||||||
|
<textarea class="w-100 mt-1" rows="2" v-model="item.remarks" v-if="item.qaStatus === 'REJECT'" v-bind:name="'items[' + index + '].qaRemarks'"></textarea>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
|
@ -70,7 +72,6 @@
|
||||||
el: '#qcForm',
|
el: '#qcForm',
|
||||||
data: {
|
data: {
|
||||||
items: [],
|
items: [],
|
||||||
QaStatus: 'APPROVED'
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onItemSelect: function (id, item) {
|
onItemSelect: function (id, item) {
|
||||||
|
@ -85,17 +86,6 @@
|
||||||
const uniqueIds = new Set(ids);
|
const uniqueIds = new Set(ids);
|
||||||
return ids.length !== uniqueIds.size;
|
return ids.length !== uniqueIds.size;
|
||||||
},
|
},
|
||||||
submitWithQaStatus: function (status) {
|
|
||||||
this.QaStatus = status;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
const form = document.getElementById('qcForm');
|
|
||||||
if (form.checkValidity()) {
|
|
||||||
form.submit();
|
|
||||||
} else {
|
|
||||||
form.reportValidity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
|
||||||
|
|
|
@ -4,27 +4,23 @@
|
||||||
Vue.prototype.$accounts = window.ctp.accounts;
|
Vue.prototype.$accounts = window.ctp.accounts;
|
||||||
|
|
||||||
Vue.component('item-rows', {
|
Vue.component('item-rows', {
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
wrapQuantity: 0
|
|
||||||
};
|
|
||||||
},
|
|
||||||
props: ['index', 'item'],
|
props: ['index', 'item'],
|
||||||
methods : {
|
methods : {
|
||||||
populateCuttingAccount : function (){
|
populateCuttingAccount : function (){
|
||||||
return this.$accounts.find(account => account.id === this.item.accountId).title;
|
return this.$accounts.find(account => account.id === this.item.accountId).title;
|
||||||
},
|
},
|
||||||
handleValueChange : function(value){
|
|
||||||
this.wrapQuantity = value
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120">
|
<td width="400">
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId" >
|
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId" >
|
||||||
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardItemId'" v-bind:value="item.id" >
|
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardItemId'" v-bind:value="item.id" >
|
||||||
<span class="form-control" readonly>{{item.id}}</span>
|
<item-search
|
||||||
|
v-bind:id-field-name="'items[' + index + '].itemId'"
|
||||||
|
v-bind:id="item.itemId"
|
||||||
|
v-bind:type="item.type"
|
||||||
|
v-bind:show-label="false"
|
||||||
|
v-bind:disabled="true"></item-search>
|
||||||
</td>
|
</td>
|
||||||
<td width="400">
|
<td width="400">
|
||||||
<span class="form-control" readonly >{{item.sku}}</span>
|
<span class="form-control" readonly >{{item.sku}}</span>
|
||||||
|
@ -40,17 +36,8 @@
|
||||||
<td width="200">
|
<td width="200">
|
||||||
<span class="form-control" readonly>{{item.expectedProduction}}</span>
|
<span class="form-control" readonly>{{item.expectedProduction}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td width="100">
|
|
||||||
<span class="form-control" readonly>{{item.actualProduction}}</span>
|
|
||||||
</td>
|
|
||||||
<td width="200">
|
<td width="200">
|
||||||
<input class="form-control" @input="handleValueChange($event.target.value)" :min="0" type="number" v-bind:name="'items[' + index + '].actualProduction'" required>
|
<input class="form-control" min="0" type="number" v-bind:name="'items[' + index + '].actualProduction'" required>
|
||||||
</td>
|
|
||||||
<td width="200">
|
|
||||||
<input class="form-control" min="1" :max="wrapQuantity" type="number" v-bind:name="'items[' + index + '].perBundleQuantity'" required>
|
|
||||||
</td>
|
|
||||||
<td width="10" style="text-align: center;" >
|
|
||||||
<input type="checkbox" v-bind:name="'items[' + index + '].cuttingComplete'">
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ populateCuttingAccount() }}
|
{{ populateCuttingAccount() }}
|
||||||
|
@ -97,15 +84,12 @@
|
||||||
<table class="table table-bordered bg-white w-100">
|
<table class="table table-bordered bg-white w-100">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>Item</th>
|
||||||
<th>Item Sku/Title</th>
|
<th>Item Sku/Title</th>
|
||||||
<th>Cut Pieces</th>
|
<th>Cut Pieces</th>
|
||||||
<th>Expected Production</th>
|
<th>Expected Production</th>
|
||||||
<th>Current Production</th>
|
|
||||||
<th>Actual Production</th>
|
<th>Actual Production</th>
|
||||||
<th>Per Bundle Quantity</th>
|
<th style="width: 312px" >Account</th>
|
||||||
<th>Cutting Complete</th>
|
|
||||||
<th style="width: 312px" >Account</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -216,7 +216,6 @@ if ( typeof Vue !== 'undefined' ) {
|
||||||
v-bind:disabled="disabled"
|
v-bind:disabled="disabled"
|
||||||
v-bind:readonly="readOnly"
|
v-bind:readonly="readOnly"
|
||||||
v-bind:inputmode="inputMode"
|
v-bind:inputmode="inputMode"
|
||||||
autofocus
|
|
||||||
v-bind:class="{ 'is-invalid': ( showInputErrorOnZeroId && ( entityId === 0 || entityId == null ) ) }"
|
v-bind:class="{ 'is-invalid': ( showInputErrorOnZeroId && ( entityId === 0 || entityId == null ) ) }"
|
||||||
autocomplete="off">
|
autocomplete="off">
|
||||||
<!-- autocomplete list -->
|
<!-- autocomplete list -->
|
||||||
|
@ -1050,35 +1049,6 @@ if ( typeof Vue !== 'undefined' ) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* location site search component
|
|
||||||
*/
|
|
||||||
Vue.component( 'search-job-card-dashBoard', {
|
|
||||||
mixins: [searchComponentMixin],
|
|
||||||
methods: {
|
|
||||||
getSearchUrl: function() {
|
|
||||||
return `/ctp/rest/locations/sites/search?term=${encodeURIComponent( this.list.term )}`;
|
|
||||||
},
|
|
||||||
getEmittedEventName: function() {
|
|
||||||
return 'location-site-select';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
labelText: {
|
|
||||||
default: 'Search Site'
|
|
||||||
},
|
|
||||||
titleFieldName: {
|
|
||||||
default: 'siteTitle'
|
|
||||||
},
|
|
||||||
idFieldName: {
|
|
||||||
default: 'siteId'
|
|
||||||
},
|
|
||||||
codeFieldName: {
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* location site search component
|
* location site search component
|
||||||
|
@ -1180,7 +1150,7 @@ if ( typeof Vue !== 'undefined' ) {
|
||||||
}
|
}
|
||||||
// else format item title with code
|
// else format item title with code
|
||||||
if ( typeof item.code !== 'undefined' ) {
|
if ( typeof item.code !== 'undefined' ) {
|
||||||
return `${item.title} (${item.sku}) (${item.code})`;
|
return `${item.title} (${item.code})`;
|
||||||
}
|
}
|
||||||
// item title only
|
// item title only
|
||||||
return item.title;
|
return item.title;
|
||||||
|
@ -3438,44 +3408,6 @@ if ( typeof Vue !== 'undefined' ) {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* job card search for reporting
|
|
||||||
* */
|
|
||||||
Vue.component('job-card-for-reporting',{
|
|
||||||
mixins: [searchComponentMixin],
|
|
||||||
methods : {
|
|
||||||
getSearchUrl : function () {
|
|
||||||
let url = `/ctp/rest/job-cards/search?term=${encodeURIComponent(this.list.term)}&filter=false`;
|
|
||||||
if( ! this.filter ){
|
|
||||||
url += '&filter=false'
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
},
|
|
||||||
getEmittedEventName: function() {
|
|
||||||
return 'job-card-select';
|
|
||||||
},
|
|
||||||
getTitle: function( card ) {
|
|
||||||
return `(${card.code}) - ${card.createdBy}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
labelText: {
|
|
||||||
default: 'Search Job Card'
|
|
||||||
},
|
|
||||||
titleFieldName: {
|
|
||||||
default: 'cardTitle'
|
|
||||||
},
|
|
||||||
idFieldName: {
|
|
||||||
default: 'jobCardId'
|
|
||||||
},
|
|
||||||
codeFieldName : {
|
|
||||||
default : 'jobCardCode'
|
|
||||||
},
|
|
||||||
filter : {
|
|
||||||
default : true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3592,118 +3524,44 @@ if ( typeof Vue !== 'undefined' ) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* search po
|
* finished item search
|
||||||
* */
|
* */
|
||||||
Vue.component('search-ctp-po',{
|
Vue.component('finished-item-search',{
|
||||||
mixins: [searchComponentMixin],
|
mixins: [searchComponentMixin],
|
||||||
data: {
|
|
||||||
purchaseOrderCode: '',
|
|
||||||
},
|
|
||||||
methods : {
|
methods : {
|
||||||
getSearchUrl : function () {
|
getSearchUrl : function () {
|
||||||
return `/ctp/rest/purchase-orders/ctp-po-search?term=${encodeURIComponent( this.list.term )}`
|
return `/ctp/rest/finished-items/search?term=${encodeURIComponent( this.list.term )}&is-segregated=${this.isSegregated}`
|
||||||
},
|
},
|
||||||
getEmittedEventName: function() {
|
getEmittedEventName: function() {
|
||||||
return 'select-po';
|
return 'finished-item-select';
|
||||||
},
|
},
|
||||||
getTitle: function( po ) {
|
getTitle: function( item ) {
|
||||||
this.purchaseOrderCode = po.purchaseOrderCode;
|
return `${item.id} - ( ${item.barcode} )`;
|
||||||
return this.purchaseOrderCode;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
labelText: {
|
labelText: {
|
||||||
default: 'Search PO '
|
default: 'Search Finished Item'
|
||||||
},
|
},
|
||||||
titleFieldName: {
|
titleFieldName: {
|
||||||
default: 'poCode'
|
default: 'title'
|
||||||
},
|
},
|
||||||
idFieldName: {
|
idFieldName: {
|
||||||
default: 'poId'
|
default: 'id'
|
||||||
},
|
},
|
||||||
codeFieldName : {
|
codeFieldName : {
|
||||||
default : 'poCode'
|
default : 'code'
|
||||||
},
|
},
|
||||||
received : {
|
isSegregated : {
|
||||||
default : false
|
default : false
|
||||||
},
|
},
|
||||||
inputMode: {
|
inputMode: {
|
||||||
default : 'none'
|
default : 'none'
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
Vue.component('search-item', {
|
|
||||||
props: {
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
default: 'Search Finished Item'
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
isSegregated: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
debounceTime: {
|
|
||||||
type: Number,
|
|
||||||
default: 500
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
searchTerm: '',
|
|
||||||
timeout: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleInput() {
|
|
||||||
clearTimeout(this.timeout);
|
|
||||||
this.timeout = setTimeout(() => {
|
|
||||||
this.fetchData();
|
|
||||||
}, this.debounceTime);
|
|
||||||
},
|
|
||||||
async fetchData() {
|
|
||||||
if (this.searchTerm.trim() === '') return;
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${this.url}?term=${encodeURIComponent(this.searchTerm)}&is-segregated=${this.isSegregated}`);
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
if (data.length > 0) {
|
|
||||||
const selectedItem = data[0];
|
|
||||||
this.$emit('finished-item-select', selectedItem.id, selectedItem);
|
|
||||||
this.searchTerm = `${selectedItem.id} - (${selectedItem.barcode})`;
|
|
||||||
setTimeout(() => {
|
|
||||||
this.searchTerm = '';
|
|
||||||
}, 500);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.searchTerm = '';
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching search results:', error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
|
|
||||||
template: `
|
|
||||||
<div class="search-container">
|
|
||||||
<label>{{ label }}</label>
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
v-model="searchTerm"
|
|
||||||
@input="handleInput"
|
|
||||||
placeholder="Scan QR"
|
|
||||||
autocomplete="off"
|
|
||||||
inputmode="none"
|
|
||||||
autofocus>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bundle search component
|
* bundle search component
|
||||||
|
|
|
@ -1,325 +1,215 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
|
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
|
||||||
<head th:fragment="head (title)">
|
<head th:fragment="head (title)">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<meta http-equiv="refresh" content="60" th:if="${refresh == true}">
|
<link rel="shortcut icon" href="../static/img/favicon.ico" th:href="@{/img/favicon.ico}">
|
||||||
<link rel="shortcut icon" href="../static/img/favicon.ico" th:href="@{/img/favicon.ico}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<script th:src="@{/js/vendor/jquery-3.4.1.min.js}"></script>
|
||||||
<script th:src="@{/js/vendor/jquery-3.4.1.min.js}"></script>
|
<script th:src="@{/js/vendor/bootstrap.bundle.js}"></script>
|
||||||
<script th:src="@{/js/vendor/bootstrap.bundle.js}"></script>
|
<script th:src="@{/js/vendor/luxon.min.js}"></script>
|
||||||
<script th:src="@{/js/vendor/luxon.min.js}"></script>
|
<script th:src="@{/js/vendor/datatables.min.js}"></script>
|
||||||
<script th:src="@{/js/vendor/datatables.min.js}"></script>
|
<script th:src="@{/js/vendor/dataTables.fixedColumns.min.js}"></script>
|
||||||
<script th:src="@{/js/vendor/dataTables.fixedColumns.min.js}"></script>
|
<script th:src="@{/js/vendor/jquery-ui.js}"></script>
|
||||||
<script th:src="@{/js/vendor/jquery-ui.js}"></script>
|
<script th:src="@{/js/vendor/vue.js}"></script>
|
||||||
<script th:src="@{/js/vendor/vue.js}"></script>
|
<script th:src="@{/js/vendor/select2.full.min.js}"></script>
|
||||||
<script th:src="@{/js/vendor/select2.full.min.js}"></script>
|
<script th:src="@{/js/vendor/bignumber.min.js}"></script>
|
||||||
<script th:src="@{/js/vendor/bignumber.min.js}"></script>
|
<script th:src="@{/js/vue-components.js}"></script>
|
||||||
<script th:src="@{/js/vue-components.js}"></script>
|
<script th:src="@{/js/utils.js}"></script>
|
||||||
<script th:src="@{/js/utils.js}"></script>
|
<title th:text="${#strings.concat(title, ' - CTP')}"></title>
|
||||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
</head>
|
||||||
<script src="https://code.highcharts.com/highcharts-more.js"></script>
|
<body>
|
||||||
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>
|
|
||||||
<title th:text="${#strings.concat(title, ' - CTP')}"></title>
|
|
||||||
<style>
|
|
||||||
@keyframes blinker {
|
|
||||||
50% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.blink {
|
<header class="row page-header font-sm" th:fragment="page-header">
|
||||||
animation: blinker 1s linear infinite;
|
<!--<editor-fold desc="Description">-->
|
||||||
}
|
<div class="col-sm">
|
||||||
</style>
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark " role="navigation">
|
||||||
</head>
|
<a class="navbar-brand text-white-50" th:href="@{/}">
|
||||||
<body>
|
<img th:src="@{/img/utopia-industries-white.svg}" class="page-header__logo" alt="Utopia Industries">
|
||||||
|
</a>
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_JOB_CARD', 'ROLE_ADMIN')">
|
||||||
|
<a th:href="@{/job-cards/}" class="nav-link"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards') ? 'active' : ''}">Job Cards</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_CUTTING', 'ROLE_ADMIN')">
|
||||||
|
<a th:href="@{/cutting/}" class="nav-link"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting') ? 'active' : ''}">Cutting</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_STITCHING', 'ROLE_ADMIN')">
|
||||||
|
<a th:href="@{/stitching/}" class="nav-link"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching') ? 'active' : ''}">Stitching</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_QUALITY_CONTROL', 'ROLE_ADMIN')">
|
||||||
|
<a th:href="@{/quality-control/}" class="nav-link"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control') ? 'active' : ''}">Quality Control</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_FINISHING', 'ROLE_ADMIN')">
|
||||||
|
<a th:href="@{/finishing/}" class="nav-link"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing') ? 'active' : ''}">Finishing</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_PACKAGING', 'ROLE_ADMIN')">
|
||||||
|
<a th:href="@{/packaging/}" class="nav-link"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging') ? 'active' : ''}">Packaging</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<header class="row page-header font-sm" th:fragment="page-header">
|
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_REPORTING', 'ROLE_ADMIN')">
|
||||||
<!--<editor-fold desc="Description">-->
|
<a th:href="@{/reporting/summary}" class="nav-link"
|
||||||
<div class="col-sm">
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting') ? 'active' : ''}">Reporting</a>
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark " role="navigation">
|
</li>
|
||||||
<a class="navbar-brand text-white-50" th:href="@{/}">
|
|
||||||
<img th:src="@{/img/utopia-industries-white.svg}" class="page-header__logo" alt="Utopia Industries">
|
|
||||||
</a>
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_PURCHASE_ORDER', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/purchase-order/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order') ? 'active' : ''}">Purchase
|
|
||||||
Order</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_JOB_CARD', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/job-cards/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards') ? 'active' : ''}">Job
|
|
||||||
Cards</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_CUTTING', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/cutting/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting') ? 'active' : ''}">Cutting</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_STITCHING', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/stitching/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching') ? 'active' : ''}">Stitching</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_QUALITY_CONTROL', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/quality-control/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control') ? 'active' : ''}">Quality
|
|
||||||
Control</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_FINISHING', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/finishing/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing') ? 'active' : ''}">Finishing</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_PACKAGING', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/packaging/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging') ? 'active' : ''}">Packaging</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_STORE', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/store/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store') ? 'active' : ''}">Store</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_PURCHASE_ORDER', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/po-status/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/po-status') ? 'active' : ''}">Online PO Status</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_REPORTING', 'ROLE_ADMIN')">
|
|
||||||
<a th:href="@{/reporting/}" class="nav-link"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting') ? 'active' : ''}">Reporting</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_ADMIN')">
|
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Admin</a>
|
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_ADMIN')">
|
||||||
<div class="dropdown-menu">
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Admin</a>
|
||||||
<!-- Add Inventory Accounts-->
|
<div class="dropdown-menu">
|
||||||
<a th:href="@{/inventory-accounts}"
|
<!-- Add Inventory Accounts-->
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/inventory-accounts') ? 'active' : ''}"
|
<a th:href="@{/inventory-accounts}"
|
||||||
class="dropdown-item">Inventory Accounts</a>
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/inventory-accounts') ? 'active' : ''}"
|
||||||
<a th:href="@{/processes}"
|
class="dropdown-item">Inventory Accounts</a>
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/processes') ? 'active' : ''}"
|
<a th:href="@{/processes}"
|
||||||
class="dropdown-item">Processes</a>
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/processes') ? 'active' : ''}"
|
||||||
<!-- User and Roles -->
|
class="dropdown-item">Processes</a>
|
||||||
<a th:href="@{/users}"
|
<!-- User and Roles -->
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/users') ? 'active' : ''}"
|
<a th:href="@{/users}"
|
||||||
class="dropdown-item">User And Roles</a>
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/users') ? 'active' : ''}"
|
||||||
|
class="dropdown-item">User And Roles</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="dropdown page-header__user-menu">
|
||||||
|
<a href="#" class="dropdown-toggle btn btn-sm btn-outline-light" data-toggle="dropdown">
|
||||||
|
<i class="bi bi-person"></i>
|
||||||
|
<span sec:authentication="name"></span>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<form th:action="@{/logout}" method="POST" class="page-header__logout">
|
||||||
|
<button type="submit">Logout</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_INVENTORY_ACCOUNT')">
|
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Inventory Accounts</a>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<!-- Add Inventory Accounts-->
|
|
||||||
<a th:href="@{/inventory-accounts}"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/inventory-accounts') ? 'active' : ''}"
|
|
||||||
class="dropdown-item">Inventory Accounts</a>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</nav>
|
||||||
</ul>
|
<!-- second level job cards-->
|
||||||
<div class="dropdown page-header__user-menu">
|
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||||
<a href="#" class="dropdown-toggle btn btn-sm btn-outline-light" data-toggle="dropdown">
|
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards')}">
|
||||||
<i class="bi bi-person"></i>
|
<ul class="navbar-nav">
|
||||||
<span sec:authentication="name"></span>
|
<li class="nav-item"
|
||||||
</a>
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards') ? 'active' : ''}">
|
||||||
<div class="dropdown-menu">
|
<a th:href="@{/job-cards/}" class="nav-link">Cards</a>
|
||||||
<form th:action="@{/logout}" method="POST" class="page-header__logout">
|
</li>
|
||||||
<button type="submit">Logout</button>
|
</ul>
|
||||||
</form>
|
</nav>
|
||||||
|
<!-- second level cutting -->
|
||||||
|
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||||
|
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting')}">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/receive-inventory') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/cutting/receive-inventory}" class="nav-link">Receive Inventory</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/inventory-accounts') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/cutting/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/bundles') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/cutting/bundles}" class="nav-link">Bundles</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/generate-master-barcode') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/cutting/generate-master-barcode}" class="nav-link">Generate Master Barcode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/master-bundles') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/cutting/master-bundles}" class="nav-link">Master Bundles</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<!-- second level stitching -->
|
||||||
|
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||||
|
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching')}">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching/receive-inventory') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/stitching/receive-inventory}" class="nav-link">Receive Inventory</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching/inventory-accounts') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/stitching/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching/stitching-offline-items') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/stitching/stitching-offline-items}" class="nav-link">Stitching Offline Items</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<!-- second level quality control-->
|
||||||
|
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||||
|
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control')}">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control/qc-finished-items') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/quality-control/qc-finished-items}" class="nav-link">QC Finished Item</a>
|
||||||
|
</li>
|
||||||
|
<!-- <li class="nav-item"-->
|
||||||
|
<!-- th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control/inventory-accounts') ? 'active' : ''}">-->
|
||||||
|
<!-- <a th:href="@{/quality-control/inventory-accounts}" class="nav-link">Inventory Accounts</a>-->
|
||||||
|
<!-- </li>-->
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<!-- second level stitching -->
|
||||||
|
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||||
|
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing')}">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing/finished-items') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/finishing/finished-items}" class="nav-link">Finished Items</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing/inventory-accounts') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/finishing/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing/segregate-inventory') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/finishing/segregate-inventory}" class="nav-link">Segregate Inventory</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<!-- second level packaging -->
|
||||||
|
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||||
|
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging')}">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item"
|
||||||
|
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging/inventory-accounts') ? 'active' : ''}">
|
||||||
|
<a th:href="@{/packaging/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<!-- table loading skeleton -->
|
||||||
|
<div class="table-loading-skeleton" th:fragment="table-loading-skeleton">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div>
|
||||||
|
<div class="skeleton-box" style="width:35px;"></div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="skeleton-box" style="width:200px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div th:each="i: ${#numbers.sequence(0, 15)}" class="row">
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="skeleton-box"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1" th:each="j: ${#numbers.sequence(0, 9)}">
|
||||||
|
<div class="skeleton-box"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
|
||||||
<!-- second level purchase Order-->
|
|
||||||
<!-- <nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"-->
|
|
||||||
<!-- th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order')}">-->
|
|
||||||
<!-- <ul class="navbar-nav">-->
|
|
||||||
<!-- <li class="nav-item"-->
|
|
||||||
<!-- th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order') ? 'active' : ''}">-->
|
|
||||||
<!-- <a th:href="@{/purchase-order/}" class="nav-link">Cards</a>-->
|
|
||||||
<!-- </li>-->
|
|
||||||
<!-- </ul>-->
|
|
||||||
<!-- </nav>-->
|
|
||||||
<!-- second level job cards-->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/job-cards/}" class="nav-link">Cards</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<!-- second level purchase order-->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/purchase-order/}" class="nav-link">PO's</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<!-- second level cutting -->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/receive-inventory') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/cutting/receive-inventory}" class="nav-link">Receive Inventory</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/inventory-accounts') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/cutting/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/bundles') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/cutting/bundles}" class="nav-link">Bundles</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/generate-master-barcode') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/cutting/generate-master-barcode}" class="nav-link">Generate Master Barcode</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/master-bundles') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/cutting/master-bundles}" class="nav-link">Master Bundles</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<!--Second level of reporting-->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting/job-card-report') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/reporting/job-card-report}" class="nav-link">Job Card Report</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting/cutting-report') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/reporting/cutting-report}" class="nav-link">Cutting Tables Report</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting/stitching-report') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/reporting/stitching-report}" class="nav-link">Stitching Line Report</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting/summary') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/reporting/summary}" class="nav-link">Summary</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<!--Second level of po-status-->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/po-status')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/po-status/all-pos') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/po-status/all-pos}" class="nav-link">All PO's</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<!-- second level stitching -->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching/receive-inventory') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/stitching/receive-inventory}" class="nav-link">Receive Inventory</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching/inventory-accounts') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/stitching/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching/stitching-offline-items') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/stitching/stitching-offline-items}" class="nav-link">Stitching Offline Items</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<!-- second level quality control-->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control/qc-finished-items') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/quality-control/qc-finished-items}" class="nav-link">QC Finished Item</a>
|
|
||||||
</li>
|
|
||||||
<!-- <li class="nav-item"-->
|
|
||||||
<!-- th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/quality-control/inventory-accounts') ? 'active' : ''}">-->
|
|
||||||
<!-- <a th:href="@{/quality-control/inventory-accounts}" class="nav-link">Inventory Accounts</a>-->
|
|
||||||
<!-- </li>-->
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<!-- second level stitching -->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing/finished-items') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/finishing/finished-items}" class="nav-link">Finished Items</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing/inventory-accounts') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/finishing/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/finishing/segregate-inventory') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/finishing/segregate-inventory}" class="nav-link">Segregate Inventory</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<!-- second level packaging -->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging/receive-inventory') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/packaging/receive-inventory}" class="nav-link">Receive Inventory</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging/inventory-accounts') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/packaging/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<!-- second level store -->
|
|
||||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
|
||||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store')}">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store/receive-inventory') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/store/receive-inventory}" class="nav-link">Receive Inventory</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item"
|
|
||||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store/inventory-accounts') ? 'active' : ''}">
|
|
||||||
<a th:href="@{/store/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<!-- table loading skeleton -->
|
|
||||||
<div class="table-loading-skeleton" th:fragment="table-loading-skeleton">
|
|
||||||
<div class="d-flex justify-content-between">
|
|
||||||
<div>
|
|
||||||
<div class="skeleton-box" style="width:35px;"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<div class="skeleton-box" style="width:200px;"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div th:each="i: ${#numbers.sequence(0, 15)}" class="row">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<div class="skeleton-box"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1" th:each="j: ${#numbers.sequence(0, 9)}">
|
|
||||||
<div class="skeleton-box"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:fragment="page-footer-scripts">
|
<div th:fragment="page-footer-scripts">
|
||||||
<script th:src="@{/js/vendor/lazyload-db.js}"></script>
|
<script th:src="@{/js/vendor/lazyload-db.js}"></script>
|
||||||
<script th:src="@{/js/main.js}"></script>
|
<script th:src="@{/js/main.js}"></script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue