Merge remote-tracking branch 'origin/master'

highway
wws 1 year ago
commit ec9a071b8f

@ -39,7 +39,7 @@ public class QcCheckReportIncomeController extends BaseController {
/**
*
*/
@RequiresPermissions("quality:qcIncomeReport:list")
@RequiresPermissions("quality:incomeReport:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
@ -66,7 +66,7 @@ public class QcCheckReportIncomeController extends BaseController {
/**
*
*/
@RequiresPermissions("quality:qcIncomeReport:export")
@RequiresPermissions("quality:incomeReport:export")
@Log(title = "来料检验", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckReportIncome qcCheckReportIncome) {
@ -94,7 +94,7 @@ public class QcCheckReportIncomeController extends BaseController {
/**
*
*/
@RequiresPermissions("quality:qcIncomeReport:query")
@RequiresPermissions("quality:incomeReport:query")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") String recordId) {
return success(qcCheckReportIncomeService.selectQcCheckReportIncomeByRecordId(recordId));
@ -103,7 +103,7 @@ public class QcCheckReportIncomeController extends BaseController {
/**
*
*/
@RequiresPermissions("quality:qcIncomeReport:add")
@RequiresPermissions("quality:incomeReport:add")
@Log(title = "来料检验", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
@ -117,7 +117,7 @@ public class QcCheckReportIncomeController extends BaseController {
/**
*
*/
@RequiresPermissions("quality:qcIncomeReport:edit")
@RequiresPermissions("quality:incomeReport:edit")
@Log(title = "来料检验", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
@ -127,7 +127,7 @@ public class QcCheckReportIncomeController extends BaseController {
/**
*
*/
@RequiresPermissions("quality:qcIncomeReport:remove")
@RequiresPermissions("quality:incomeReport:remove")
@Log(title = "来料检验", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable String[] recordIds) {

@ -0,0 +1,186 @@
package com.op.quality.controller;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckReportIncome;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.quality.service.IQcCheckReportProduceService;
import com.op.system.api.domain.SysUser;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* Controller
*
* @author Open Platform
* @date 2023-10-19
*/
@RestController
@RequestMapping("/qcProduceReport")
public class QcCheckReportProduceController extends BaseController {
@Autowired
private IQcCheckReportProduceService qcCheckReportProduceService;
/**
*
*/
@RequiresPermissions("quality:produceReport:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
/*if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
}*/
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start
// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end
// }
startPage();
List<QcCheckReportIncome> list = qcCheckReportProduceService.selectQcCheckReportIncomeList(qcCheckReportIncome);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:produceReport:export")
@Log(title = "来料检验", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
}
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start
// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end
// }
List<QcCheckReportIncome> list = qcCheckReportProduceService.selectQcCheckReportIncomeList(qcCheckReportIncome);
ExcelUtil<QcCheckReportIncome> util = new ExcelUtil<QcCheckReportIncome>(QcCheckReportIncome.class);
util.exportExcel(response, list, "来料检验数据");
}
/**
*
*/
@RequiresPermissions("quality:produceReport:query")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") String recordId) {
return success(qcCheckReportProduceService.selectQcCheckReportIncomeByRecordId(recordId));
}
/**
*
*/
@RequiresPermissions("quality:produceReport:add")
@Log(title = "来料检验", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
int r = qcCheckReportProduceService.insertQcCheckReportIncome(qcCheckReportIncome);
if(r>0){
return toAjax(r);
}
return error("添加失败:请检查物料的关联检测项");
}
/**
*
*/
@RequiresPermissions("quality:produceReport:edit")
@Log(title = "来料检验", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
return toAjax(qcCheckReportProduceService.updateQcCheckReportIncome(qcCheckReportIncome));
}
/**
*
*/
@RequiresPermissions("quality:produceReport:remove")
@Log(title = "来料检验", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable String[] recordIds) {
return toAjax(qcCheckReportProduceService.deleteQcCheckReportIncomeByRecordIds(recordIds));
}
/**
* BOM
*/
@GetMapping("/getQcListBom")
public TableDataInfo getQcListBom(QcBomComponent bomComponent) {
startPage();
List<QcBomComponent> list = qcCheckReportProduceService.getQcListBom(bomComponent);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getQcListSupplier")
public TableDataInfo getQcListSupplier(QcSupplier qcSupplier) {
startPage();
List<QcSupplier> list = qcCheckReportProduceService.getQcListSupplier(qcSupplier);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getQcListUser")
public TableDataInfo getQcListUser(SysUser sysUser) {
startPage();
List<SysUser> list = qcCheckReportProduceService.getQcListUser(sysUser);
return getDataTable(list);
}
/**
*
*/
@PutMapping("/changeIncomeStatus")
public AjaxResult changeIncomeStatus(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setUpdateBy(SecurityUtils.getUsername());
qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckReportProduceService.updateIncomeStatus(qcCheckReportIncome));
}
/**
*
* @param
* @return
*/
@GetMapping("/getCkeckProjectList")
public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
startPage();
List<QcCheckTaskDetail> list = qcCheckReportProduceService.getCkeckProjectList(qcCheckTaskDetail);
return getDataTable(list);
}
}

@ -0,0 +1,186 @@
package com.op.quality.controller;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckReportIncome;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.quality.service.IQcCheckReportProductService;
import com.op.system.api.domain.SysUser;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* Controller
*
* @author Open Platform
* @date 2023-10-19
*/
@RestController
@RequestMapping("/qcProductReport")
public class QcCheckReportProductController extends BaseController {
@Autowired
private IQcCheckReportProductService qcCheckReportProductService;
/**
*
*/
@RequiresPermissions("quality:productReport:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
/*if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
}*/
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start
// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end
// }
startPage();
List<QcCheckReportIncome> list = qcCheckReportProductService.selectQcCheckReportIncomeList(qcCheckReportIncome);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:productReport:export")
@Log(title = "来料检验", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
}
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start
// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end
// }
List<QcCheckReportIncome> list = qcCheckReportProductService.selectQcCheckReportIncomeList(qcCheckReportIncome);
ExcelUtil<QcCheckReportIncome> util = new ExcelUtil<QcCheckReportIncome>(QcCheckReportIncome.class);
util.exportExcel(response, list, "来料检验数据");
}
/**
*
*/
@RequiresPermissions("quality:productReport:query")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") String recordId) {
return success(qcCheckReportProductService.selectQcCheckReportIncomeByRecordId(recordId));
}
/**
*
*/
@RequiresPermissions("quality:productReport:add")
@Log(title = "来料检验", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
int r = qcCheckReportProductService.insertQcCheckReportIncome(qcCheckReportIncome);
if(r>0){
return toAjax(r);
}
return error("添加失败:请检查物料的关联检测项");
}
/**
*
*/
@RequiresPermissions("quality:productReport:edit")
@Log(title = "来料检验", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
return toAjax(qcCheckReportProductService.updateQcCheckReportIncome(qcCheckReportIncome));
}
/**
*
*/
@RequiresPermissions("quality:productReport:remove")
@Log(title = "来料检验", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable String[] recordIds) {
return toAjax(qcCheckReportProductService.deleteQcCheckReportIncomeByRecordIds(recordIds));
}
/**
* BOM
*/
@GetMapping("/getQcListBom")
public TableDataInfo getQcListBom(QcBomComponent bomComponent) {
startPage();
List<QcBomComponent> list = qcCheckReportProductService.getQcListBom(bomComponent);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getQcListSupplier")
public TableDataInfo getQcListSupplier(QcSupplier qcSupplier) {
startPage();
List<QcSupplier> list = qcCheckReportProductService.getQcListSupplier(qcSupplier);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getQcListUser")
public TableDataInfo getQcListUser(SysUser sysUser) {
startPage();
List<SysUser> list = qcCheckReportProductService.getQcListUser(sysUser);
return getDataTable(list);
}
/**
*
*/
@PutMapping("/changeIncomeStatus")
public AjaxResult changeIncomeStatus(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setUpdateBy(SecurityUtils.getUsername());
qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckReportProductService.updateIncomeStatus(qcCheckReportIncome));
}
/**
*
* @param
* @return
*/
@GetMapping("/getCkeckProjectList")
public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
startPage();
List<QcCheckTaskDetail> list = qcCheckReportProductService.getCkeckProjectList(qcCheckTaskDetail);
return getDataTable(list);
}
}

@ -0,0 +1,77 @@
package com.op.quality.service;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckReportIncome;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysUser;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-10-19
*/
public interface IQcCheckReportProduceService {
/**
*
*
* @param recordId
* @return
*/
public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public List<QcCheckReportIncome> selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param recordIds
* @return
*/
public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds);
/**
*
*
* @param recordId
* @return
*/
public int deleteQcCheckReportIncomeByRecordId(String recordId);
public List<QcBomComponent> getQcListBom(QcBomComponent bomComponent);
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier);
public List<SysUser> getQcListUser(SysUser sysUser);
int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome);
List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail);
public List<QcCheckReportIncome> getPrintData(QcCheckReportIncome qcCheckReportIncome);
}

@ -0,0 +1,77 @@
package com.op.quality.service;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckReportIncome;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysUser;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-10-19
*/
public interface IQcCheckReportProductService {
/**
*
*
* @param recordId
* @return
*/
public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public List<QcCheckReportIncome> selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param recordIds
* @return
*/
public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds);
/**
*
*
* @param recordId
* @return
*/
public int deleteQcCheckReportIncomeByRecordId(String recordId);
public List<QcBomComponent> getQcListBom(QcBomComponent bomComponent);
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier);
public List<SysUser> getQcListUser(SysUser sysUser);
int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome);
List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail);
public List<QcCheckReportIncome> getPrintData(QcCheckReportIncome qcCheckReportIncome);
}

@ -0,0 +1,203 @@
package com.op.quality.service.serviceImpl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.quality.mapper.QcCheckReportIncomeMapper;
import com.op.quality.mapper.QcCheckTaskDetailMapper;
import com.op.quality.mapper.QcCheckTypeProjectMapper;
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
import com.op.quality.service.IQcCheckReportProduceService;
import com.op.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-10-19
*/
@Service
public class QcCheckReportProduceServiceImpl implements IQcCheckReportProduceService {
@Autowired
private QcCheckReportIncomeMapper qcCheckReportIncomeMapper;
@Autowired
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
@Autowired
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
@Autowired
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId) {
return qcCheckReportIncomeMapper.selectQcCheckReportIncomeByRecordId(recordId);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public List<QcCheckReportIncome> selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setDelFlag("0");
return qcCheckReportIncomeMapper.selectQcCheckReportIncomeList(qcCheckReportIncome);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) {
String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
int liushuiNum = qcCheckReportIncomeMapper.getTodayMaxNum(qcCheckReportIncome);
String liushuiStr = String.format("%04d", liushuiNum);
String createBy = SecurityUtils.getUsername();
Date nowDate= DateUtils.getNowDate();
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_","");
qcCheckReportIncome.setCheckNo(bpDD+liushuiStr);
/**qc_check_task_income**/
String beLongId = IdUtils.fastSimpleUUID();
qcCheckReportIncome.setRecordId(beLongId);
qcCheckReportIncome.setFactoryCode(factoryCode);
qcCheckReportIncome.setCreateTime(nowDate);
qcCheckReportIncomeMapper.insertQcCheckReportIncome(qcCheckReportIncome);
/**取检测项**/
QcCheckTypeProject qctp= new QcCheckTypeProject();
qctp.setTypeId(qcCheckReportIncome.getCheckType());//生产过程检验
qctp.setMaterialCode(qcCheckReportIncome.getMaterialCode());//特性
/**qc_check_type_project**/
List<QcCheckTaskDetail> items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp);
if(CollectionUtils.isEmpty(items)){
/**qc_material_group_detail**/
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckReportIncome.getMaterialCode());
if(group == null){
return 0;//没有找到检测项目
}
qctp.setGroupId(group.getGroupId());//共性
items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
}
/**qc_check_task_detail**/
if(CollectionUtils.isEmpty(items)){
return 0;//没有找到检测项目
}
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
item.setBelongTo(beLongId);
item.setCreateTime(nowDate);
item.setCreateBy(createBy);
item.setFactoryCode(factoryCode);
item.setStatus("N");
}
return qcCheckTaskDetailMapper.addBatch(items);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate());
return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome);
}
/**
*
*
* @param recordIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds) {
return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordIds(recordIds);
}
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckReportIncomeByRecordId(String recordId) {
return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordId(recordId);
}
@Override
@DS("#header.poolName")
public List<QcBomComponent> getQcListBom(QcBomComponent bomComponent) {
return qcCheckReportIncomeMapper.getQcListBom(bomComponent);
}
@Override
@DS("#header.poolName")
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier) {
return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier);
}
//在公共库里不需要切库
@Override
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckReportIncomeMapper.getQcListUser(sysUser);
}
@Override
@DS("#header.poolName")
public int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome) {
return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome);
}
@Override
@DS("#header.poolName")
public List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
return qcCheckReportIncomeMapper.getCkeckProjectList(qcCheckTaskDetail);
}
@Override
public List<QcCheckReportIncome> getPrintData(QcCheckReportIncome qcCheckReportIncome) {
return null;
}
}

@ -0,0 +1,203 @@
package com.op.quality.service.serviceImpl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.quality.mapper.QcCheckReportIncomeMapper;
import com.op.quality.mapper.QcCheckTaskDetailMapper;
import com.op.quality.mapper.QcCheckTypeProjectMapper;
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
import com.op.quality.service.IQcCheckReportProductService;
import com.op.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-10-19
*/
@Service
public class QcCheckReportProductServiceImpl implements IQcCheckReportProductService {
@Autowired
private QcCheckReportIncomeMapper qcCheckReportIncomeMapper;
@Autowired
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
@Autowired
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
@Autowired
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId) {
return qcCheckReportIncomeMapper.selectQcCheckReportIncomeByRecordId(recordId);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public List<QcCheckReportIncome> selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setDelFlag("0");
return qcCheckReportIncomeMapper.selectQcCheckReportIncomeList(qcCheckReportIncome);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) {
String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
int liushuiNum = qcCheckReportIncomeMapper.getTodayMaxNum(qcCheckReportIncome);
String liushuiStr = String.format("%04d", liushuiNum);
String createBy = SecurityUtils.getUsername();
Date nowDate= DateUtils.getNowDate();
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_","");
qcCheckReportIncome.setCheckNo(bpDD+liushuiStr);
/**qc_check_task_income**/
String beLongId = IdUtils.fastSimpleUUID();
qcCheckReportIncome.setRecordId(beLongId);
qcCheckReportIncome.setFactoryCode(factoryCode);
qcCheckReportIncome.setCreateTime(nowDate);
qcCheckReportIncomeMapper.insertQcCheckReportIncome(qcCheckReportIncome);
/**取检测项**/
QcCheckTypeProject qctp= new QcCheckTypeProject();
qctp.setTypeId(qcCheckReportIncome.getCheckType());//生产过程检验
qctp.setMaterialCode(qcCheckReportIncome.getMaterialCode());//特性
/**qc_check_type_project**/
List<QcCheckTaskDetail> items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp);
if(CollectionUtils.isEmpty(items)){
/**qc_material_group_detail**/
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckReportIncome.getMaterialCode());
if(group == null){
return 0;//没有找到检测项目
}
qctp.setGroupId(group.getGroupId());//共性
items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
}
/**qc_check_task_detail**/
if(CollectionUtils.isEmpty(items)){
return 0;//没有找到检测项目
}
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
item.setBelongTo(beLongId);
item.setCreateTime(nowDate);
item.setCreateBy(createBy);
item.setFactoryCode(factoryCode);
item.setStatus("N");
}
return qcCheckTaskDetailMapper.addBatch(items);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate());
return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome);
}
/**
*
*
* @param recordIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds) {
return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordIds(recordIds);
}
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckReportIncomeByRecordId(String recordId) {
return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordId(recordId);
}
@Override
@DS("#header.poolName")
public List<QcBomComponent> getQcListBom(QcBomComponent bomComponent) {
return qcCheckReportIncomeMapper.getQcListBom(bomComponent);
}
@Override
@DS("#header.poolName")
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier) {
return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier);
}
//在公共库里不需要切库
@Override
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckReportIncomeMapper.getQcListUser(sysUser);
}
@Override
@DS("#header.poolName")
public int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome) {
return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome);
}
@Override
@DS("#header.poolName")
public List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
return qcCheckReportIncomeMapper.getCkeckProjectList(qcCheckTaskDetail);
}
@Override
public List<QcCheckReportIncome> getPrintData(QcCheckReportIncome qcCheckReportIncome) {
return null;
}
}

@ -0,0 +1,50 @@
package com.op.scada.controller;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.web.controller.BaseController;
import com.op.scada.service.ScadaService;
import com.op.system.api.domain.dto.WCSDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* mes
*
* @author sf
* @date 2023-05-18
*/
@RestController
@RequestMapping("/scadaInterface")
public class ScadaController extends BaseController {
@Autowired
private ScadaService scadaService;
/**
*
* WCS MES
* AGV
* @param
* @return
*/
//"下一工序机台集合获取"
@PostMapping("/requestDestinationStations")
public WCSDTO requestDestinationStations(@RequestBody WCSDTO wcsdto) {
if(StringUtils.isBlank(wcsdto.getFactory())){
wcsdto.setCode("1");
wcsdto.setMessage("factory is not null");
return wcsdto;
}
return scadaService.requestDestinationStations(wcsdto);
}
public static void main(String args[]){
System.out.println(DateUtils.getDate());
}
}

@ -0,0 +1,27 @@
package com.op.scada.mapper;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* rfidMapper
*
* @author Open Platform
* @date 2023-08-18
*/
@Mapper
public interface ScadaMapper {
public ProRfidProcessDetail getRfidInfo(String rfidNo);
public String getStationType(String equipmentCode);
Integer getEquipNum(String machineCode);
String getEquipStatus(String machineCode);
String getEquipMode(String machineCode);
}

@ -0,0 +1,18 @@
package com.op.scada.service;
import com.op.system.api.domain.dto.WCSDTO;
import java.util.List;
import java.util.Map;
/**
* Service
*
* @author Open Platform
* @date 2023-07-13
*/
public interface ScadaService {
WCSDTO requestDestinationStations(WCSDTO wcsdto);
}

@ -0,0 +1,147 @@
package com.op.scada.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.bean.BeanUtils;
import com.op.scada.mapper.ScadaMapper;
import com.op.scada.service.ScadaService;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
/**
* wcs
*
* @author Open Platform
* @date 2023-07-13
*/
@Service
public class ScadaServiceImpl implements ScadaService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ScadaMapper scadaMapper;
/**
* JSON
* {
* "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID
* "reqTime": "2023-06-30 21:24:04", //请求时间,
* "rfidNo": "r12345" //rfid编号
* "factory"
* }
*
* JSON
* {
* "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID
* "code": 0, //返回代码
* "message": "OK", //返回信息
* "stationType": "2", //目的机台类型 2烘房 3收坯机
* "sku": "sku01", //物料编码
* "spec": "150", //规格
* "productionState": "K01", //当前工艺状态
* "stationNos": [
* {
* "stationNo": "F1", //目的站台编号
* "qty": 2 //针对于烘房前面的当前筛盘车的数量如果数量大于2就不会往改烘房分配
* },
* {
* "stationNo": "F3", //目的站台编号
* "qty": 2 //针对于烘房前面的当前筛盘车的数量如果数量大于2就不会往改烘房分配
* },
* {
* "stationNo": "F3", //目的站台编号
* "qty": 2 //针对于烘房前面的当前筛盘车的数量如果数量大于2就不会往改烘房分配
* }
* ],
* }
* @param wcsdto
* @return
*/
@Override
public WCSDTO requestDestinationStations(WCSDTO wcsdto) {
DynamicDataSourceContextHolder.push("ds_" + wcsdto.getFactory());
WCSDTO dto = new WCSDTO();//最终结果
try {
BeanUtils.copyBeanProp(dto, wcsdto);
//根据rfid跟工单绑定成型机跟工单绑定获取对应工艺。
ProRfidProcessDetail rfidInfo = scadaMapper.getRfidInfo(wcsdto.getRfidNo());
//获取设备类型
if (rfidInfo != null && StringUtils.isNotBlank(rfidInfo.getMachineCode())) {
//设备-工艺路线的设备大范围
String[] machineCodes0 = rfidInfo.getMachineCode().split(",");
String stationType = scadaMapper.getStationType(machineCodes0[0]);
if (StringUtils.isNotBlank(stationType)) {
dto.setStationType(stationType);
}
//设备-根据工单获取实际规划设备路线
String machinecode = rfidInfo.getProdLineCode();//scadaMapper.getActuaEquips(rfidInfo);
JSONArray codeArray = JSONArray.parseArray(machinecode);
List<String> list2 = new ArrayList<>();
for (int c1 = 0; c1 < codeArray.size(); c1++) {
String equipCode0 = codeArray.getJSONArray(c1).getString(1);
list2.add(equipCode0);
}
//取交集
List<String> list1 = Arrays.asList(machineCodes0);
List<String> machineArray = list1.stream()
.filter(u1 -> list2.contains(u1))
.collect(Collectors.toList());
dto.setSku(rfidInfo.getProductCode());
dto.setSpec(rfidInfo.getProductModel());
dto.setProductionState(rfidInfo.getNowProcessId());
List<WCSDataDTO> stationNos = new ArrayList<>();
WCSDataDTO wCSDataDTO = null;
for (String machineCode : machineArray) {
wCSDataDTO = new WCSDataDTO();
if (StringUtils.isNotBlank(machineCode)) {
//设备是否正常
String status = scadaMapper.getEquipStatus(machineCode);
if(StringUtils.isNotBlank(status) && "1".equals(status)){//正常设备且没被删除
wCSDataDTO.setStationNo(machineCode);
if ("2".equals(stationType)) {
Integer qty = scadaMapper.getEquipNum(machineCode);
wCSDataDTO.setQty(qty == null ? 0 : qty);
String mode = scadaMapper.getEquipMode(machineCode);
wCSDataDTO.setFlag(mode);
}
stationNos.add(wCSDataDTO);
}
}
}
dto.setStationNos(stationNos);
dto.setCode("0");
}else{
dto.setCode("1");
dto.setMessage("MES管理系统接口调用异常:数据缺失");
}
}catch (Exception e){
dto.setCode("1");
dto.setMessage("MES管理系统接口调用失败");
}
return dto;
}
public static void main(String args[]){
DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate today = LocalDate.now();
LocalDate lastMonth3 = today.plus(-3, ChronoUnit.MONTHS);
System.out.println("7天之前的日期为:"+lastMonth3.getYear());
}
}

@ -14,16 +14,16 @@ spring:
nacos:
discovery:
namespace: lanju-op
group: prod-new
group: zxl
# 服务注册地址
server-addr: 192.168.202.20:8848
server-addr: 175.27.215.92:8848
config:
namespace: lanju-op
group: prod-new
group: zxl
#命名空间
#group: local
# 配置中心地址
server-addr: 192.168.202.20:8848
server-addr: 175.27.215.92:8848
# 配置文件格式
file-extension: yml
# 共享配置

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.scada.mapper.ScadaMapper">
<!--获取在邦rfid 工单的信息-->
<select id="getRfidInfo" resultType="com.op.system.api.domain.mes.ProRfidProcessDetail">
select
top 1
rfid.workorder_code workorderCode,
rfid.now_process_id nowProcessId,
rfid.next_process_id nextProcessId,
p.equipment machineCode,
bp.product_code productCode,
bp.product_model productModel,
w.prod_line_code prodLineCode
from pro_rfid_process_detail rfid
left join pro_process p on p.process_id = rfid.next_process_id
left join pro_order_workorder w on w.workorder_code = rfid.workorder_code
left join base_product bp on bp.product_code = w.product_code
where rfid.bind_status = '1'
and rfid.rfid = #{rfidNo}
order by rfid.create_time desc
</select>
<select id="getStationType" resultType="java.lang.String">
select
case when equipment_type_code ='equ_type_spj' then '3'
when equipment_type_code ='equ_type_hf' then '2'
else '' end
from base_equipment
where equipment_code = #{equipmentCode}
</select>
<select id="getEquipNum" resultType="java.lang.Integer">
select isvalue from base_equipment_attached
where property = 'dollyNumber'
and device_code = #{machineCode}
</select>
<select id="getEquipStatus" resultType="java.lang.String">
select status from base_equipment where equipment_code = #{machineCode} and del_flag = '0'
</select>
<select id="getEquipMode" resultType="java.lang.String">
select isvalue from base_equipment_attached
where property = 'Mode'
and device_code = #{machineCode}
</select>
</mapper>
Loading…
Cancel
Save