|
@@ -1,6 +1,7 @@
|
|
|
package cn.ezhizao.project.business.controller;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -14,6 +15,7 @@ import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
import cn.ezhizao.project.business.domain.*;
|
|
|
import cn.ezhizao.project.business.service.*;
|
|
|
import cn.ezhizao.project.system.service.ISysDeptService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -34,8 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/business/amend")
|
|
|
-public class BizTechnologicalAmendController extends BaseController
|
|
|
-{
|
|
|
+public class BizTechnologicalAmendController extends BaseController {
|
|
|
@Resource
|
|
|
private IBizTechnologicalAmendService bizTechnologicalAmendService;
|
|
|
|
|
@@ -43,7 +44,10 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
private IBizTechnologicalProcessService bizTechnologicalProcessService;
|
|
|
|
|
|
@Resource
|
|
|
- private IBizTechnologicalAmendDetailService bizTechnologicalAmendDetailService;
|
|
|
+ private IBizTechnologicalAmendDetailService bizTechnologicalAmendDetailService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizTechnologicalProcessDetailService bizTechnologicalProcessDetailService;
|
|
|
|
|
|
@Resource
|
|
|
private IBizLotService bizLotService;
|
|
@@ -66,13 +70,18 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
@Resource
|
|
|
private IBizDayworkCarrierService bizDayworkCarrierService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IBizProductionPlanDetailSubDetailService bizProductionPlanDetailSubDetailService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBizDayworkItemService bizDayworkItemService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询修改后工艺列表
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public TableDataInfo list(BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(bizTechnologicalAmend);
|
|
|
startPage();
|
|
|
List<BizTechnologicalAmend> list = bizTechnologicalAmendService.getList(bizTechnologicalAmend);
|
|
@@ -84,43 +93,40 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:processList')")
|
|
|
@GetMapping("/processList")
|
|
|
- public TableDataInfo processList(BizProcess process) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public TableDataInfo processList(BizProcess process) throws NoSuchFieldException, IllegalAccessException {
|
|
|
return getDataTable(bizProcessService.getList(process));
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@GetMapping("/lotParticulars/{lotCode}")
|
|
|
- public AjaxResult lotParticulars(@PathVariable("lotCode") String lotCode) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public AjaxResult lotParticulars(@PathVariable("lotCode") String lotCode) throws NoSuchFieldException, IllegalAccessException {
|
|
|
//根据查询批次信息
|
|
|
- BizLot lot =new BizLot();
|
|
|
+ BizLot lot = new BizLot();
|
|
|
lot.setLotCode(lotCode);
|
|
|
try {
|
|
|
- lot=bizLotService.getList(lot).get(0);
|
|
|
+ lot = bizLotService.getList(lot).get(0);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("批次信息异常!");
|
|
|
}
|
|
|
//查询计划单信息
|
|
|
lot.setProductionPlanDetail(bizProductionPlanDetailService.getById(lot.getProductionPlanDetailId()));
|
|
|
//查询报工信息
|
|
|
- BizDaywork daywork=new BizDaywork();
|
|
|
+ BizDaywork daywork = new BizDaywork();
|
|
|
daywork.setLotId(lot.getId());
|
|
|
- daywork=bizDayworkService.getList(daywork).get(0);
|
|
|
+ daywork = bizDayworkService.getList(daywork).get(0);
|
|
|
lot.setDaywork(daywork);
|
|
|
//根据报工id和计划单id查询 furnaceNoInfo
|
|
|
- BizFurnaceNoInfo furnaceNoInfo=new BizFurnaceNoInfo();
|
|
|
+ BizFurnaceNoInfo furnaceNoInfo = new BizFurnaceNoInfo();
|
|
|
furnaceNoInfo.setProductionPlanDetailId(lot.getProductionPlanDetailId());
|
|
|
furnaceNoInfo.setDayworkId(daywork.getId());
|
|
|
|
|
|
//查询箱号
|
|
|
- BizDayworkCarrier dayworkCarrier=new BizDayworkCarrier();
|
|
|
+ BizDayworkCarrier dayworkCarrier = new BizDayworkCarrier();
|
|
|
dayworkCarrier.setDayworkId(daywork.getId());
|
|
|
dayworkCarrier.setIsChanged(0);
|
|
|
- List <BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
|
- StringBuffer carrierName=new StringBuffer();
|
|
|
- dayworkCarriers.forEach(item->{
|
|
|
+ List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.getList(dayworkCarrier);
|
|
|
+ StringBuffer carrierName = new StringBuffer();
|
|
|
+ dayworkCarriers.forEach(item -> {
|
|
|
carrierName.append(item.getCarrierCode()).append(", ");
|
|
|
});
|
|
|
// 删除末尾多余的逗号和空格
|
|
@@ -129,19 +135,80 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
}
|
|
|
lot.setCarrierName(carrierName.toString());
|
|
|
//设置furnaceNoInfo
|
|
|
- lot.setFurnaceNoInfo(bizFurnaceNoInfoService.getList(furnaceNoInfo).size()>0?bizFurnaceNoInfoService.getList(furnaceNoInfo).get(0):null);
|
|
|
+ lot.setFurnaceNoInfo(bizFurnaceNoInfoService.getList(furnaceNoInfo).size() > 0 ? bizFurnaceNoInfoService.getList(furnaceNoInfo).get(0) : null);
|
|
|
lot.getProductionPlanDetail().setRequisitionDepartmentName(sysDeptService.selectDeptById(daywork.getDeptId()).getDeptName());
|
|
|
+ lot = getLot(lot);
|
|
|
+
|
|
|
return success(lot);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询工序信息
|
|
|
+ */
|
|
|
+ private BizLot getLot(BizLot lot) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+
|
|
|
+ BizTechnologicalProcessDetail processDetail = new BizTechnologicalProcessDetail();
|
|
|
+
|
|
|
+ //是否单批单改
|
|
|
+ if (lot.getIsAmend() == 1) {
|
|
|
+
|
|
|
+ } else if (lot.getIsWasteRecycling() == 1) { //是否废品回用
|
|
|
+
|
|
|
+ } else {
|
|
|
+ processDetail.setTechnologicalProcessId(lot.getTechnologicalProcessId());
|
|
|
+ List<BizTechnologicalProcessDetail> processDetailList = bizTechnologicalProcessDetailService.query().eq("technological_process_id", lot.getTechnologicalProcessId()).list();
|
|
|
+ BizDayworkItem item = new BizDayworkItem();
|
|
|
+ item.setDayworkId(lot.getDaywork().getId());
|
|
|
+ List<BizDayworkItem> dayworkItems = bizDayworkItemService.selectList(item);
|
|
|
+
|
|
|
+ for (BizTechnologicalProcessDetail t : processDetailList) {
|
|
|
+ if (processDetailList.get(0).getProcessId().equals(t.getProcessId())) {
|
|
|
+ t.setInvestNum(lot.getProductionQuantity());
|
|
|
+ t.setAbandonNum(0);
|
|
|
+ t.setQualifiedNum(lot.getProductionQuantity());
|
|
|
+ t.setStatus("2");
|
|
|
+ }
|
|
|
+ for (BizDayworkItem d : dayworkItems) {
|
|
|
+ if (t.getProcessId().equals(d.getProcessId())) {
|
|
|
+
|
|
|
+ if(d.getStatus().equals("2")||d.getStatus().equals("3")){
|
|
|
+ System.out.println(d.getRejectNum()+",+++++++++++++++++++++++++++++++++++++++++++++++++");
|
|
|
+ if(d.getRejectNum()!=null){
|
|
|
+ t.setAbandonNum(t.getAbandonNum()==null?d.getRejectNum():t.getAbandonNum() + d.getRejectNum());
|
|
|
+
|
|
|
+ }else {
|
|
|
+ t.setAbandonNum(0);
|
|
|
+ }
|
|
|
+ t.setQualifiedNum(t.getQualifiedNum()==null?d.getQualifiedNum():t.getQualifiedNum() + d.getQualifiedNum());
|
|
|
+ t.setInvestNum(d.getProdNum());
|
|
|
+ }
|
|
|
+ if (d.getStatus().equals("0")) {
|
|
|
+ t.setAbandonNum(0);
|
|
|
+ t.setQualifiedNum(0);
|
|
|
+ t.setInvestNum(d.getProdNum());
|
|
|
+ t.setStatus("0");
|
|
|
+ } else if (d.getStatus().equals("1") || d.getStatus().equals("2")) {
|
|
|
+ t.setInvestNum(d.getProdNum());
|
|
|
+ t.setStatus("1");
|
|
|
+ } else {
|
|
|
+ t.setStatus("2");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lot.setTechnologicalProcessDetailList(processDetailList);
|
|
|
+ }
|
|
|
+ return lot;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导出修改后工艺列表
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:export')")
|
|
|
@Log(title = "修改后工艺", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public void export(HttpServletResponse response, BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(bizTechnologicalAmend);
|
|
|
List<BizTechnologicalAmend> list = bizTechnologicalAmendService.getList(bizTechnologicalAmend);
|
|
|
ExcelUtil<BizTechnologicalAmend> util = new ExcelUtil<BizTechnologicalAmend>(BizTechnologicalAmend.class);
|
|
@@ -154,17 +221,16 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
@Log(title = "修改后工艺", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("/addAmend/{lotId}")
|
|
|
@Transactional
|
|
|
- public AjaxResult addAmend(@PathVariable("lotId") Long lotId, @RequestBody List<BizProcess> processList)
|
|
|
- {
|
|
|
+ public AjaxResult addAmend(@PathVariable("lotId") Long lotId, @RequestBody List<BizProcess> processList) {
|
|
|
//根据id查询批次信息
|
|
|
BizLot lot = bizLotService.getById(lotId);
|
|
|
|
|
|
- BizTechnologicalProcess technologicalProcess =new BizTechnologicalProcess();
|
|
|
+ BizTechnologicalProcess technologicalProcess = new BizTechnologicalProcess();
|
|
|
//是否进行过单批单改
|
|
|
- if(lot.getIsAmend()==1){
|
|
|
+ if (lot.getIsAmend() == 1) {
|
|
|
BizTechnologicalAmend technologicalAmend = bizTechnologicalAmendService.getById(lot.getTechnologicalProcessId());
|
|
|
technologicalProcess = bizTechnologicalProcessService.getById(technologicalAmend.getTechnologicalProcessId());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
technologicalProcess = bizTechnologicalProcessService.getById(lot.getTechnologicalProcessId());
|
|
|
}
|
|
|
|
|
@@ -210,7 +276,7 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
//修改批次工艺信息
|
|
|
lot.setTechnologicalProcessId(amend.getId());
|
|
|
lot.setIsAmend(1);
|
|
|
- return success(bizTechnologicalAmendDetailService.saveBatch(amendDetailList)&&bizLotService.updateById(lot));
|
|
|
+ return success(bizTechnologicalAmendDetailService.saveBatch(amendDetailList) && bizLotService.updateById(lot));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -218,8 +284,7 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:query')")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
return success(bizTechnologicalAmendService.getById(id));
|
|
|
}
|
|
|
|
|
@@ -229,8 +294,7 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:add')")
|
|
|
@Log(title = "修改后工艺", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public AjaxResult add(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(bizTechnologicalAmend);
|
|
|
return toAjax(bizTechnologicalAmendService.save(bizTechnologicalAmend));
|
|
|
}
|
|
@@ -241,8 +305,7 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:edit')")
|
|
|
@Log(title = "修改后工艺", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody BizTechnologicalAmend bizTechnologicalAmend) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(bizTechnologicalAmend);
|
|
|
return toAjax(bizTechnologicalAmendService.updateById(bizTechnologicalAmend));
|
|
|
}
|
|
@@ -252,9 +315,8 @@ public class BizTechnologicalAmendController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('business:amend:remove')")
|
|
|
@Log(title = "修改后工艺", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable List<Long> ids)
|
|
|
- {
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
return toAjax(bizTechnologicalAmendService.removeBatchByIds(ids));
|
|
|
}
|
|
|
}
|