Merge remote-tracking branch 'origin/master'

master
mengjiao 7 months ago
commit ee790d3c58

@ -1,8 +1,13 @@
package com.op.mes.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.domain.ExcelCol;
import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
@ -12,6 +17,7 @@ import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.BaseProductAttached;
import com.op.mes.service.IBaseProductAttachedService;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -22,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.op.common.log.annotation.Log;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
@ -83,7 +90,12 @@ public class BaseProductAttachedController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody BaseProductAttached baseProductAttached)
{
return toAjax(baseProductAttachedService.insertBaseProductAttached(baseProductAttached));
if (baseProductAttachedService.checkSpareCodeUnique(baseProductAttached)) {
return AjaxResult.error("备品备件编码已存在!");
} else {
return toAjax(baseProductAttachedService.insertBaseProductAttached(baseProductAttached));
}
}
/**
@ -109,4 +121,82 @@ public class BaseProductAttachedController extends BaseController
{
return toAjax(baseProductAttachedService.deleteBaseProductAttachedByIds(ids));
}
/**
*
*
* @param response
* @throws IOException
*/
@PostMapping("/importTemplate")
@Log(title = "生成备品备件信息模板", businessType = BusinessType.EXPORT)
public void importTemplate(HttpServletResponse response) throws IOException {
ArrayList<ExcelCol> excelCols = new ArrayList<>();
excelCols.add(new ExcelCol("产品编号", "productCode", 20));
excelCols.add(new ExcelCol("品类", "category", 20));
excelCols.add(new ExcelCol("每PC单圈", "pc", 20));
excelCols.add(new ExcelCol("标准效率", "iei", 20));
excelCols.add(new ExcelCol("标准用人", "manStandar", 20));
excelCols.add(new ExcelCol("喷药方式", "sprayWay", 20));
excelCols.add(new ExcelCol("白坯直径", "blankDiameter", 20));
excelCols.add(new ExcelCol("白坯物料号", "blankNo", 20));
excelCols.add(new ExcelCol("标准喷药量", "sprayVolume", 20));
excelCols.add(new ExcelCol("药液料号", "liquidNo", 20));
excelCols.add(new ExcelCol("标准内膜用量", "endometrialDosage", 20));
excelCols.add(new ExcelCol("标准外模用量(KG/PC)", "outerFilmDosage", 20));
excelCols.add(new ExcelCol("支架", "support", 20));
excelCols.add(new ExcelCol("支架物料号", "supportNo", 20));
excelCols.add(new ExcelCol("吸塑", "pvc", 20));
excelCols.add(new ExcelCol("支架盘", "supportPlate", 20));
excelCols.add(new ExcelCol("创建人", "createBy", 20));
excelCols.add(new ExcelCol("库检周期", "warehouseCycle", 20));
excelCols.add(new ExcelCol("托盘上箱数", "palletNum", 20));
excelCols.add(new ExcelCol("垛形", "packType", 20));
String titleName = "物料附属信息导入";
SXSSFWorkbook workbook = null;
try {
//设置响应头
response.setHeader("Content-disposition",
"attachment; filename=" + titleName);
response.setContentType("application/octet-stream;charset=UTF-8");
ServletOutputStream outputStream = response.getOutputStream();
//调用工具类
workbook = ExcelMapUtil.initWorkbook(titleName, null, excelCols, null);
workbook.write(outputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (workbook != null) {
workbook.dispose();
}
}
}
/**
*
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "导入物料基本信息", businessType = BusinessType.IMPORT)
@PostMapping("/importFile")
@RequiresPermissions("mes:attached:import")
public AjaxResult importFile(MultipartFile file) throws Exception {
// 创建接收对象
ExcelUtil<BaseProductAttached> util = new ExcelUtil<>(BaseProductAttached.class);
// 接收表格信息
List<BaseProductAttached> orderList = util.importExcel(file.getInputStream());
return baseProductAttachedService.importFile(orderList);
}
}

@ -54,7 +54,7 @@ public class BaseProductAttached extends BaseEntity
private String blankNo;
/** 标准喷药量KG/PC */
@Excel(name = "标准喷药量", readConverterExp = "K=G/PC")
@Excel(name = "标准喷药量")
private BigDecimal sprayVolume;
/** 药液料号 */
@ -62,7 +62,7 @@ public class BaseProductAttached extends BaseEntity
private String liquidNo;
/** 标准内膜用量KG/PC */
@Excel(name = "标准内膜用量", readConverterExp = "K=G/PC")
@Excel(name = "标准内膜用量")
private BigDecimal endometrialDosage;
/** 标准外模用量(KG/PC) */
@ -89,191 +89,225 @@ public class BaseProductAttached extends BaseEntity
@Excel(name = "其它")
private String other;
public void setId(String id)
{
/** 创建人 */
@Excel(name = "创建人")
private String createBy;
/** 库检周期 */
@Excel(name = "库检周期")
private String warehouseCycle;
/** 托盘上箱数 */
@Excel(name = "托盘上箱数")
private BigDecimal palletNum;
/** 垛形 */
@Excel(name = "垛形")
private String packType;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getId()
{
return id;
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode)
{
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode()
{
return productCode;
public String getCategory() {
return category;
}
public void setCategory(String category)
{
public void setCategory(String category) {
this.category = category;
}
public String getCategory()
{
return category;
public String getPc() {
return pc;
}
public void setPc(String pc)
{
public void setPc(String pc) {
this.pc = pc;
}
public String getPc()
{
return pc;
public BigDecimal getIei() {
return iei;
}
public void setIei(BigDecimal iei)
{
public void setIei(BigDecimal iei) {
this.iei = iei;
}
public BigDecimal getIei()
{
return iei;
public BigDecimal getManStandar() {
return manStandar;
}
public void setManStandar(BigDecimal manStandar)
{
public void setManStandar(BigDecimal manStandar) {
this.manStandar = manStandar;
}
public BigDecimal getManStandar()
{
return manStandar;
public String getSprayWay() {
return sprayWay;
}
public void setSprayWay(String sprayWay)
{
public void setSprayWay(String sprayWay) {
this.sprayWay = sprayWay;
}
public String getSprayWay()
{
return sprayWay;
public BigDecimal getBlankDiameter() {
return blankDiameter;
}
public void setBlankDiameter(BigDecimal blankDiameter)
{
public void setBlankDiameter(BigDecimal blankDiameter) {
this.blankDiameter = blankDiameter;
}
public BigDecimal getBlankDiameter()
{
return blankDiameter;
public String getBlankNo() {
return blankNo;
}
public void setBlankNo(String blankNo)
{
public void setBlankNo(String blankNo) {
this.blankNo = blankNo;
}
public String getBlankNo()
{
return blankNo;
public BigDecimal getSprayVolume() {
return sprayVolume;
}
public void setSprayVolume(BigDecimal sprayVolume)
{
public void setSprayVolume(BigDecimal sprayVolume) {
this.sprayVolume = sprayVolume;
}
public BigDecimal getSprayVolume()
{
return sprayVolume;
public String getLiquidNo() {
return liquidNo;
}
public void setLiquidNo(String liquidNo)
{
public void setLiquidNo(String liquidNo) {
this.liquidNo = liquidNo;
}
public String getLiquidNo()
{
return liquidNo;
public BigDecimal getEndometrialDosage() {
return endometrialDosage;
}
public void setEndometrialDosage(BigDecimal endometrialDosage)
{
public void setEndometrialDosage(BigDecimal endometrialDosage) {
this.endometrialDosage = endometrialDosage;
}
public BigDecimal getEndometrialDosage()
{
return endometrialDosage;
public BigDecimal getOuterFilmDosage() {
return outerFilmDosage;
}
public void setOuterFilmDosage(BigDecimal outerFilmDosage)
{
public void setOuterFilmDosage(BigDecimal outerFilmDosage) {
this.outerFilmDosage = outerFilmDosage;
}
public BigDecimal getOuterFilmDosage()
{
return outerFilmDosage;
public Long getSupport() {
return support;
}
public void setSupport(Long support)
{
public void setSupport(Long support) {
this.support = support;
}
public Long getSupport()
{
return support;
public String getSupportNo() {
return supportNo;
}
public void setSupportNo(String supportNo)
{
public void setSupportNo(String supportNo) {
this.supportNo = supportNo;
}
public String getSupportNo()
{
return supportNo;
public Long getPvc() {
return pvc;
}
public void setPvc(Long pvc)
{
public void setPvc(Long pvc) {
this.pvc = pvc;
}
public Long getPvc()
{
return pvc;
public Long getSupportPlate() {
return supportPlate;
}
public void setSupportPlate(Long supportPlate)
{
public void setSupportPlate(Long supportPlate) {
this.supportPlate = supportPlate;
}
public Long getSupportPlate()
{
return supportPlate;
public String getOther() {
return other;
}
public void setOther(String other)
{
public void setOther(String other) {
this.other = other;
}
public String getOther()
{
return other;
@Override
public String getCreateBy() {
return createBy;
}
@Override
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getWarehouseCycle() {
return warehouseCycle;
}
public void setWarehouseCycle(String warehouseCycle) {
this.warehouseCycle = warehouseCycle;
}
public BigDecimal getPalletNum() {
return palletNum;
}
public void setPalletNum(BigDecimal palletNum) {
this.palletNum = palletNum;
}
public String getPackType() {
return packType;
}
public void setPackType(String packType) {
this.packType = packType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("productCode", getProductCode())
.append("category", getCategory())
.append("pc", getPc())
.append("iei", getIei())
.append("manStandar", getManStandar())
.append("sprayWay", getSprayWay())
.append("blankDiameter", getBlankDiameter())
.append("blankNo", getBlankNo())
.append("sprayVolume", getSprayVolume())
.append("liquidNo", getLiquidNo())
.append("endometrialDosage", getEndometrialDosage())
.append("outerFilmDosage", getOuterFilmDosage())
.append("support", getSupport())
.append("supportNo", getSupportNo())
.append("pvc", getPvc())
.append("supportPlate", getSupportPlate())
.append("other", getOther())
.append("createBy", getCreateBy())
.toString();
return "BaseProductAttached{" +
"id='" + id + '\'' +
", productCode='" + productCode + '\'' +
", category='" + category + '\'' +
", pc='" + pc + '\'' +
", iei=" + iei +
", manStandar=" + manStandar +
", sprayWay='" + sprayWay + '\'' +
", blankDiameter=" + blankDiameter +
", blankNo='" + blankNo + '\'' +
", sprayVolume=" + sprayVolume +
", liquidNo='" + liquidNo + '\'' +
", endometrialDosage=" + endometrialDosage +
", outerFilmDosage=" + outerFilmDosage +
", support=" + support +
", supportNo='" + supportNo + '\'' +
", pvc=" + pvc +
", supportPlate=" + supportPlate +
", other='" + other + '\'' +
", createBy='" + createBy + '\'' +
", warehouseCycle='" + warehouseCycle + '\'' +
", palletNum=" + palletNum +
", packType='" + packType + '\'' +
'}';
}
}

@ -59,4 +59,9 @@ public interface BaseProductAttachedMapper
* @return
*/
public int deleteBaseProductAttachedByIds(String[] ids);
BaseProductAttached selectBaseProductAttachedByProductCode(String productCode);
//检查productCode
String checkSpareCodeUnique(BaseProductAttached baseProductAttached);
}

@ -3,6 +3,7 @@ package com.op.mes.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.BaseProductAttached;
@ -61,4 +62,8 @@ public interface IBaseProductAttachedService
* @return
*/
public int deleteBaseProductAttachedById(String id);
AjaxResult importFile(List<BaseProductAttached> list);
boolean checkSpareCodeUnique(BaseProductAttached baseProductAttached);
}

@ -4,12 +4,25 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils;
import com.op.mes.domain.BaseProductAttached;
import com.op.mes.mapper.BaseProductAttachedMapper;
import com.op.mes.service.IBaseProductAttachedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@ -24,6 +37,8 @@ public class BaseProductAttachedServiceImpl implements IBaseProductAttachedServi
@Autowired
private BaseProductAttachedMapper baseProductAttachedMapper;
protected Logger logger = LoggerFactory.getLogger(getClass());
/**
*
*
@ -62,6 +77,7 @@ public class BaseProductAttachedServiceImpl implements IBaseProductAttachedServi
{
baseProductAttached.setId(IdUtils.fastSimpleUUID());
baseProductAttached.setCreateTime(DateUtils.getNowDate());
baseProductAttached.setCreateBy(SecurityUtils.getUsername());
return baseProductAttachedMapper.insertBaseProductAttached(baseProductAttached);
}
@ -104,4 +120,171 @@ public class BaseProductAttachedServiceImpl implements IBaseProductAttachedServi
{
return baseProductAttachedMapper.deleteBaseProductAttachedById(id);
}
/**
*
* @param baseProductAttached
* @return
*/
@Override
@DS("#header.poolName")
@Transactional
public AjaxResult importFile(List<BaseProductAttached> baseProductAttached) {
BaseProductAttached example=null;
for (BaseProductAttached table : baseProductAttached) {
table.setId(IdUtils.fastSimpleUUID());
table.setCreateBy(SecurityUtils.getUsername());
}
//数据校验
// 数据校验
AjaxResult checkResult = checkImportFile(baseProductAttached);
// 如果数据校验成功
if (checkResult.isSuccess()) {
String info = syncImportFunc(baseProductAttached);
return success("信息导入完成。其中导入失败的信息:" + info);
}
// 校验失败
return checkResult;
}
private String syncImportFunc(List<BaseProductAttached> baseProductAttached) {
String failEquipment = "";
for (BaseProductAttached table : baseProductAttached) {
String msg = syncFunc(table);
if (StringUtils.isNotBlank(msg)) {
failEquipment += msg + ",";
}
}
return failEquipment;
}
@Transactional(rollbackFor = Exception.class)
public String syncFunc(BaseProductAttached table) {
String failSpareParts = "";
BaseProductAttached Exist = baseProductAttachedMapper.selectBaseProductAttachedByProductCode(table.getProductCode());
//不存在就插入
if (Exist == null) {
baseProductAttachedMapper.insertBaseProductAttached(table);
logger.info("=======物料附属信息" + table.getProductCode() + "=======导入成功");
//存在,不允许插入
} else {
failSpareParts = table.getProductCode();
logger.info("=======物料附属信息" + failSpareParts + "=======导入失败");
}
return failSpareParts;
}
/**
*
*/
public AjaxResult checkImportFile(List<BaseProductAttached> baseProductAttached){
// 传入对象不能为空
if (baseProductAttached.size() == 0 || StringUtils.isNull(baseProductAttached)) {
return error(500, "导入的信息不能为空!信息导入失败!");
}
for (BaseProductAttached productAttached : baseProductAttached) {
//产品编码
if (productAttached.getProductCode().isEmpty() || productAttached.getProductCode()==null){
return error(500, "产品编号不能为空!信息导入失败!");
}
//品类
if (productAttached.getCategory().isEmpty() || productAttached.getCategory()==null){
return error(500, "品类不能为空!信息导入失败!");
}
//每PC单圈
if (productAttached.getPc().isEmpty() || productAttached.getPc()==null){
return error(500, "每PC单圈不能为空信息导入失败");
}
//标准效率
if (productAttached.getIei().toString().isEmpty() || productAttached.getIei()==null){
return error(500, "标准效率不能为空!信息导入失败!");
}
//标准用人
if (productAttached.getManStandar().toString().isEmpty() || productAttached.getManStandar()==null){
return error(500, "标准用人不能为空!信息导入失败!");
}
//喷药方式
// if (productAttached.getSprayWay().isEmpty() || productAttached.getSprayWay()==null){
// return error(500, "喷药方式不能为空!信息导入失败!");
// }
//白坯直径
if (productAttached.getBlankDiameter().toString().isEmpty() || productAttached.getBlankDiameter()==null){
return error(500, "白坯直径不能为空!信息导入失败!");
}
//白坯物料号
if (productAttached.getBlankNo().isEmpty() || productAttached.getBlankNo()==null){
return error(500, "白坯物料号不能为空!信息导入失败!");
}
//标准喷药量
if (productAttached.getSprayVolume().toString().isEmpty() || productAttached.getSprayVolume()==null){
return error(500, "标准喷药量不能为空!信息导入失败!");
}
//药液料号
if (productAttached.getLiquidNo().isEmpty() || productAttached.getLiquidNo()==null){
return error(500, "药液料号不能为空!信息导入失败!");
}
//标准内膜用量
if (productAttached.getEndometrialDosage().toString().isEmpty() || productAttached.getEndometrialDosage()==null){
return error(500, "标准内膜用量不能为空!信息导入失败!");
}
//标准外膜用量
if (productAttached.getOuterFilmDosage().toString().isEmpty() || productAttached.getOuterFilmDosage()==null){
return error(500, "标准外膜用量不能为空!信息导入失败!");
}
//支架
if (productAttached.getSupport().toString().isEmpty() || productAttached.getSupport()==null){
return error(500, "支架不能为空!信息导入失败!");
}
//支架物料号
if (productAttached.getSupportNo().isEmpty() || productAttached.getSupportNo()==null){
return error(500, "支架物料号不能为空!信息导入失败!");
}
//吸塑
if (productAttached.getPvc().toString().isEmpty() || productAttached.getPvc()==null){
return error(500, "吸塑不能为空!信息导入失败!");
}
//支架盘
if (productAttached.getSupportPlate().toString().isEmpty() || productAttached.getSupportPlate()==null){
return error(500, "支架盘不能为空!信息导入失败!");
}
//库检周期
if (productAttached.getWarehouseCycle().isEmpty() || productAttached.getSupportPlate()==null){
return error(500, "库检周期不能为空!信息导入失败!");
}
//库检周期
if (productAttached.getWarehouseCycle().isEmpty() || productAttached.getWarehouseCycle()==null){
return error(500, "库检周期不能为空!信息导入失败!");
}
//托盘上箱数
if (productAttached.getPalletNum().toString().isEmpty() || productAttached.getPalletNum()==null){
return error(500, "托盘上箱数不能为空!信息导入失败!");
}
//垛形
if (productAttached.getPackType().isEmpty() || productAttached.getPackType()==null){
return error(500, "垛形不能为空!信息导入失败!");
}
}
return success();
}
@Override
@DS("#header.poolName")
public boolean checkSpareCodeUnique(BaseProductAttached baseProductAttached) {
String spareCode = baseProductAttachedMapper.checkSpareCodeUnique(baseProductAttached);
if (spareCode == null) {
return false;
} else {
return true;
}
}
}

@ -24,10 +24,15 @@
<result property="supportPlate" column="support_plate" />
<result property="other" column="other" />
<result property="createBy" column="create_by" />
<result property="warehouseCycle" column="warehouse_cycle" />
<result property="palletNum" column="pallet_num" />
<result property="packType" column="pack_type" />
</resultMap>
<sql id="selectBaseProductAttachedVo">
select id, product_code, category, pc, iei, man_standar, spray_way, blank_diameter, blank_no, spray_volume, liquid_no, endometrial_dosage, outer_film_dosage, support, support_no, pvc, support_plate, other, create_by from base_product_attached
select id, product_code, category, pc, iei, man_standar, spray_way, blank_diameter, blank_no, spray_volume, liquid_no, endometrial_dosage, outer_film_dosage, support, support_no, pvc,
support_plate,
other, create_by, warehouse_cycle,pallet_num,pack_type from base_product_attached
</sql>
<select id="selectBaseProductAttachedList" parameterType="BaseProductAttached" resultMap="BaseProductAttachedResult">
@ -50,6 +55,11 @@
<if test="pvc != null "> and pvc = #{pvc}</if>
<if test="supportPlate != null "> and support_plate = #{supportPlate}</if>
<if test="other != null and other != ''"> and other = #{other}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="warehouseCycle != null and warehouseCycle != ''"> and warehouse_cycle = #{warehouseCycle}</if>
<if test="palletNum != null and palletNum != ''"> and pallet_num = #{palletNum}</if>
<if test="packType != null and packType != ''"> and pack_type = #{packType}</if>
</where>
</select>
@ -57,7 +67,18 @@
<include refid="selectBaseProductAttachedVo"/>
where id = #{id}
</select>
<select id="selectBaseProductAttachedByProductCode" parameterType="String" resultMap="BaseProductAttachedResult">
<include refid="selectBaseProductAttachedVo"/>
where product_code = #{productCode}
</select>
<select id="checkSpareCodeUnique" parameterType="BaseProductAttached" resultType="java.lang.String">
select product_code
from base_product_attached
where product_code = #{productCode}
</select>
<insert id="insertBaseProductAttached" parameterType="BaseProductAttached">
insert into base_product_attached
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -80,6 +101,10 @@
<if test="supportPlate != null">support_plate,</if>
<if test="other != null">other,</if>
<if test="createBy != null">create_by,</if>
<if test="warehouseCycle != null">warehouse_cycle,</if>
<if test="palletNum != null">pallet_num,</if>
<if test="packType != null">pack_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -101,6 +126,9 @@
<if test="supportPlate != null">#{supportPlate},</if>
<if test="other != null">#{other},</if>
<if test="createBy != null">#{createBy},</if>
<if test="warehouseCycle != null">#{warehouseCycle},</if>
<if test="palletNum != null">#{palletNum},</if>
<if test="packType != null">#{packType},</if>
</trim>
</insert>
@ -125,6 +153,11 @@
<if test="supportPlate != null">support_plate = #{supportPlate},</if>
<if test="other != null">other = #{other},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="warehouseCycle != null">warehouse_cycle = #{warehouseCycle},</if>
<if test="palletNum != null">pallet_num = #{palletNum},</if>
<if test="packType != null">pack_type = #{packType},</if>
</trim>
where id = #{id}
</update>

@ -93,7 +93,15 @@ public class QcCheckTaskDefect extends BaseEntity {
private String defectCodes;
private String defectNames;
private String defectQualitys;
private String classId;
public String getClassId() {
return classId;
}
public void setClassId(String classId) {
this.classId = classId;
}
public String getDefectCodes() {
return defectCodes;
}

@ -138,6 +138,7 @@ public class QcCheckTaskDetail extends BaseEntity {
private String defectCodes;
private String defectNames;
private String defectQualitys;
private String classTypeCodes;
private String itemType;
private String judgeRate;
private String samplePlan;
@ -147,6 +148,14 @@ public class QcCheckTaskDetail extends BaseEntity {
private String sampleAql;
private String checkLevel;
public String getClassTypeCodes() {
return classTypeCodes;
}
public void setClassTypeCodes(String classTypeCodes) {
this.classTypeCodes = classTypeCodes;
}
public String getCheckLevel() {
return checkLevel;
}

@ -91,4 +91,6 @@ public interface QcStaticTableMapper {
Map<String, QcStaticTable> getNoOkNum(QcStaticTable qcStaticTable);
List<QcStaticTable> getTableHzNoOkData(QcStaticTable qcStaticTable);
@MapKey("ymdms")
Map<String, QcStaticTable> getNoOkRatioNum(QcStaticTable qcStaticTable);
}

@ -750,20 +750,17 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
}
}
if(qcCheckTaskIncome.getSampleQuality()!=null && qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){
qcCheckTask.setSampleQuality(sampleQuality);
}else{
qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality());
}
/**qc_check_task_cg**/
List<QcCheckTaskIncome> valiData = qcCheckTaskIncomeMapper.selectQcCheckTaskCgByRecordId(belongId);
// 判断表中是否存在此条数据
if (valiData != null && valiData.size() > 0) {
n = qcCheckTaskIncomeMapper.updateQcCheckTaskCg(qcCheckTask);//updateQcCheckTaskCG
}else {
if(qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){
qcCheckTask.setSampleQuality(sampleQuality);
}else{
qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality());
}
qcCheckTask.setCheckNo(qcCheckTaskIncome.getCheckNo());
qcCheckTask.setOrderNo(qcCheckTaskIncome.getOrderNo());
qcCheckTask.setMaterialCode(qcCheckTaskIncome.getMaterialCode());
@ -798,10 +795,12 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
String[] defectCodes = detail.getDefectCodes().split(",");
String[] defectNames = detail.getDefectNames().split(",");
String[] defectQualitys = detail.getDefectQualitys().split(",");
String[] classIds = detail.getClassTypeCodes().split(",");
for(int d=0;d<defectCodes.length;d++){
defect = new QcCheckTaskDefect();
defect.setDefectCode(defectCodes[d]);
defect.setDefectSubclass(defectNames[d].split(":")[0]);
defect.setClassId(classIds[d]);
defect.setNoOkQuality(new BigDecimal(defectQualitys[d]));
defect.setRecordId(IdUtils.fastSimpleUUID());
defect.setCreateTime(nowTime);
@ -899,7 +898,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
}
}
if(qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){
if(qcCheckTaskIncome.getSampleQuality()!=null && qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){
qcCheckTask.setSampleQuality(sampleQuality);
}else{
qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality());
@ -923,11 +922,13 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
String[] defectCodes = detail.getDefectCodes().split(",");
String[] defectNames = detail.getDefectNames().split(",");
String[] defectQualitys = detail.getDefectQualitys().split(",");
String[] classIds = detail.getClassTypeCodes().split(",");
for(int d=0;d<defectCodes.length;d++){
defect = new QcCheckTaskDefect();
defect.setDefectCode(defectCodes[d]);
defect.setDefectSubclass(defectNames[d].split(":")[0]);
defect.setNoOkQuality(new BigDecimal(defectQualitys[d]));
defect.setClassId(classIds[d]);
defect.setRecordId(IdUtils.fastSimpleUUID());
defect.setCreateTime(nowTime);
defect.setCreateBy(updateBy);

@ -166,6 +166,7 @@ public class QcProCheckServiceImpl implements QcProCheckService {
qcd.setDefectCodes(defectInfo.getDefectCodes());
qcd.setDefectNames(defectInfo.getDefectNames());
qcd.setDefectQualitys(defectInfo.getDefectQualitys());
qcd.setClassTypeCodes(defectInfo.getClassId());
}
}
@ -205,6 +206,7 @@ public class QcProCheckServiceImpl implements QcProCheckService {
qcd.setDefectCodes(defectInfo.getDefectCodes());
qcd.setDefectNames(defectInfo.getDefectNames());
qcd.setDefectQualitys(defectInfo.getDefectQualitys());
qcd.setClassTypeCodes(defectInfo.getClassId());
}
}

@ -792,7 +792,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
@DS("#header.poolName")
public QcStaticTable getTableHzTitle(QcStaticTable qcStaticTable) {
QcStaticTable dto = new QcStaticTable();
qcStaticTable.setDataType("unqualified_remark");
//qcStaticTable.setDataType("unqualified_remark");
qcStaticTable.setRemark(qcStaticTable.getCheckType());
List<String> cols1 = qcStaticTableMapper.getTableHzTitle(qcStaticTable);
@ -887,17 +887,19 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
@DS("#header.poolName")
public List<HashMap> getTableHzData(QcStaticTable qcStaticTable) {
List<HashMap> dtos = new ArrayList<>();
qcStaticTable.setDataType("unqualified_remark");
//qcStaticTable.setDataType("unqualified_remark");
qcStaticTable.setRemark(qcStaticTable.getCheckType());
List<String> noOkTyps = qcStaticTableMapper.getTableHzTitle(qcStaticTable);
//第一列日期
List<String> days = this.getHzDays(qcStaticTable.getIncomeTimeStr(),qcStaticTable.getYmdms());
//抽样数、不良数、不良率
//抽样数
Map<String,QcStaticTable> samples = qcStaticTableMapper.getSamplesNum(qcStaticTable);
if(samples.isEmpty()){
return dtos;
}
//不良数
//不良数(折算后)、不良率
Map<String,QcStaticTable> noOkNumRs = qcStaticTableMapper.getNoOkRatioNum(qcStaticTable);
//不良数(不折算)
Map<String,QcStaticTable> noOks = qcStaticTableMapper.getNoOkNum(qcStaticTable);
HashMap colMap = null;
for(String col:days){
@ -905,9 +907,10 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
colMap.put("timeCol",col);
String samKey = col;
QcStaticTable sampl = samples.get(samKey);
if(sampl!=null&&!sampl.getSampleQuality().equals("0.00")){
QcStaticTable noOkNumR = noOkNumRs.get(samKey);
if(sampl!=null&&!sampl.getSampleQuality().equals("0.00")&&noOkNumR!=null && !noOkNumR.getNoOkQuality().equals("0.00")){
colMap.put("sampleQuality",sampl.getSampleQuality().replaceAll("\\..*", ""));
BigDecimal noOkRate = new BigDecimal(sampl.getNoOkQuality()).multiply(new BigDecimal("100.00"))
BigDecimal noOkRate = new BigDecimal(noOkNumR.getNoOkQuality()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(sampl.getSampleQuality()),2, BigDecimal.ROUND_HALF_UP);
colMap.put("noOkRate",noOkRate);
}else{

@ -158,7 +158,14 @@
WHERE belong_to_detail = qctd.belong_to_detail and belong_to = qctd.belong_to
FOR xml path('')
),1,1,''
) defectQualitys
) defectQualitys,
STUFF(
(SELECT ',' + CAST(class_id AS VARCHAR(40))
FROM qc_check_task_defect
WHERE belong_to_detail = qctd.belong_to_detail and belong_to = qctd.belong_to
FOR xml path('')
),1,1,''
) classId
FROM qc_check_task_defect qctd where qctd.del_flag = '0' and belong_to= #{belongTo}
and belong_to_detail is not null
GROUP by qctd.belong_to,qctd.belong_to_detail

@ -686,14 +686,14 @@
insert into qc_check_task_defect(
record_id,belong_to,belong_to_detail,
defect_code,defect_subclass,
noOk_quality,
noOk_quality,class_id,
create_by,create_time,factory_code
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.recordId},#{item.belongTo},#{item.belongToDetail},
#{item.defectCode},#{item.defectSubclass},
#{item.noOkQuality},
#{item.noOkQuality},#{item.classId},
#{item.createBy},#{item.createTime},#{item.factoryCode}
)
</foreach>

@ -40,7 +40,7 @@
</if>
</select>
<select id="getCheckProjectsPie" resultType="com.op.quality.domain.QcInterface">
<!--
select count(0) quality,
qctd.project_no,
qctd.rule_name projectName
@ -56,21 +56,22 @@
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qcu.update_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by qctd.project_no,qctd.rule_name-->
select qct.remark projectName,
count(0) quality
from qc_check_task qct
where qct.type_code = 'produce' and qct.check_result = 'N' and qct.remark is not null
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qct.check_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.check_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.check_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by qct.remark
group by qctd.project_no,qctd.rule_name
<!--
select qct.remark projectName,
count(0) quality
from qc_check_task qct
where qct.type_code = 'produce' and qct.check_result = 'N' and qct.remark is not null
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qct.check_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.check_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.check_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by qct.remark-->
</select>
<select id="getSupplierBadTOP5" resultType="com.op.quality.domain.QcInterface">
select top 5 * from(

@ -491,9 +491,11 @@
GROUP by qctd.belong_to,qctd.belong_to_detail
</select>
<select id="getTableHzTitle" resultType="java.lang.String">
select dict_label from base_dict_data
where dict_type = #{dataType}
and remark = #{remark} order by dict_sort
select dtc.class_name
from qc_defect_type dt
left join qc_defect_type_class dtc on dt.defect_code = dtc.defect_code
where dt.defect_type in (select type_code from qc_check_type where order_code = #{remark} and del_flag = '0')
and dtc.del_flag = '0' order by dtc.sort
</select>
<select id="getTableHzTitle2" resultType="java.lang.String">
select defect_subclass from qc_defect_type where defect_type = #{typeCode} and del_flag = '0'
@ -501,10 +503,9 @@
<select id="getSamplesNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality,
ymdms
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS ymdms, qct.sample_quality, qct.noOk_quality
select CONVERT(varchar(7),qct.create_time, 120) AS ymdms, qct.sample_quality
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
@ -514,10 +515,9 @@
</if>
<if test="ymdms == 'mm'">
select sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality,
ymdms
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS ymdms, qct.sample_quality, qct.noOk_quality
select CONVERT(varchar(10),qct.create_time, 120) AS ymdms, qct.sample_quality
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
@ -527,10 +527,9 @@
</if>
<if test="ymdms == 'dd'">
select sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality,
RIGHT('00' + CAST(ymdms AS VARCHAR(2)), 2) ymdms
FROM(
select DATEPART(HOUR, qct.create_time) AS ymdms, qct.sample_quality, qct.noOk_quality
select DATEPART(HOUR, qct.create_time) AS ymdms, qct.sample_quality
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
@ -539,55 +538,112 @@
group by ymdms
</if>
</select>
<select id="getNoOkRatioNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(noOkQuality) noOkQuality,
ymdms
FROM(
select
CONVERT(varchar(7),qct.create_time, 120) AS ymdms,
qctd.class_id,
qctd.noOk_quality*qdt.ratio noOkQuality
from qc_check_task qct
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
left join qc_defect_type qdt on qdt.defect_code = qdtc.defect_code
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and qdt.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0' and qct.del_flag='0'
) t
group by ymdms
</if>
<if test="ymdms == 'mm'">
select sum(noOkQuality) noOkQuality,
ymdms
FROM(
select
CONVERT(varchar(10),qct.create_time, 120) AS ymdms,
qctd.class_id,
qctd.noOk_quality*qdt.ratio noOkQuality
from qc_check_task qct
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
left join qc_defect_type qdt on qdt.defect_code = qdtc.defect_code
where qct.check_type = #{checkType} and qdt.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0'
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr} and qct.del_flag='0' and qct.check_status = '2'
) t
group by ymdms
</if>
<if test="ymdms == 'dd'">
select sum(noOkQuality) noOkQuality,
RIGHT('00' + CAST(ymdms AS VARCHAR(2)), 2) ymdms
FROM(
select
DATEPART(HOUR, qct.create_time) AS ymdms,
qctd.class_id,
qctd.noOk_quality*qdt.ratio noOkQuality
from qc_check_task qct
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
left join qc_defect_type qdt on qdt.defect_code = qdtc.defect_code
where qct.check_type = #{checkType} and qdt.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0'
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr} and qct.del_flag='0' and qct.check_status = '2'
) t
group by ymdms
</if>
</select>
<select id="getNoOkNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(noOk_quality) noOkQuality,
concat(hourName,dict_label) ymdUntype
concat(hourName,class_name) ymdUntype
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS hourName,
qct.noOk_quality,
bdd.dict_label
qctd.noOk_quality,
qdtc.class_name
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0' and bdd.dict_label is not null
and qdtc.del_flag = '0' and qctd.del_flag = '0'
) t
group by hourName,dict_label
group by hourName,class_name
</if>
<if test="ymdms == 'mm'">
select sum(noOk_quality) noOkQuality,
concat(hourName,dict_label) ymdUntype
concat(hourName,class_name) ymdUntype
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS hourName,
qct.noOk_quality,
bdd.dict_label
qctd.noOk_quality,
qdtc.class_name
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0' and bdd.dict_label is not null
and qdtc.del_flag = '0' and qctd.del_flag = '0'
) t
group by hourName,dict_label
group by hourName,class_name
</if>
<if test="ymdms == 'dd'">
select sum(noOk_quality) noOkQuality,
concat(hourName,dict_label) ymdUntype
concat(hourName,class_name) ymdUntype
FROM(
select RIGHT('00' + CAST(DATEPART(HOUR, qct.create_time) AS VARCHAR(2)), 2) AS hourName,
qct.noOk_quality,
bdd.dict_label
qctd.noOk_quality,
qdtc.class_name
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0' and bdd.dict_label is not null
and qdtc.del_flag = '0' and qctd.del_flag = '0'
) t
group by hourName,dict_label
group by hourName,class_name
</if>
</select>
<select id="getTableHzNoOkData" resultType="com.op.quality.domain.QcStaticTable">
select * from (
<!--select * from (
select sum(t.noOk_quality) noOkQuality,
t.dict_label dataType
FROM(
@ -608,6 +664,25 @@
and del_flag = '0' and qct.remark_code is not null
) t
group by t.dict_label
) t0 order by noOkQuality desc-->
select * from (
select sum(t.noOk_quality) noOkQuality,
t.class_name dataType
FROM(
select
qctd.noOk_quality,
qdtc.class_name
from qc_check_task qct
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
where qct.check_type = #{checkType} and qct.check_status = '2'
<if test="ymdms == 'yyyy'">and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'mm'">and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'dd'"> and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}</if>
and qct.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0'
) t
group by t.class_name
) t0 order by noOkQuality desc
</select>
</mapper>

@ -63,10 +63,10 @@ public class BaseEquipment extends BaseEntity {
private String attr2;
@Excel(name = "预留字段3")
private Long attr3;
private String attr3;
@Excel(name = "预留字段4")
private Long attr4;
private String attr4;
@Excel(name = "单台能力工时")
private String unitWorkingHours;
@ -677,19 +677,19 @@ public class BaseEquipment extends BaseEntity {
return attr2;
}
public void setAttr3(Long attr3) {
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public Long getAttr3() {
public String getAttr3() {
return attr3;
}
public void setAttr4(Long attr4) {
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public Long getAttr4() {
public String getAttr4() {
return attr4;
}

@ -355,6 +355,15 @@ public class BaseProduct extends BaseEntity {
private String mvgr5;
private String palletNum;
private String warehouseCycle;
private String packType;
public String getPackType() {
return packType;
}
public void setPackType(String packType) {
this.packType = packType;
}
public String getMvgr5() {
return mvgr5;

@ -124,6 +124,15 @@ public class BaseProductAttached extends BaseEntity {
private String other;
private String warehouseCycle;
private String palletNum;
private String packType;
public String getPackType() {
return packType;
}
public void setPackType(String packType) {
this.packType = packType;
}
public String getPalletNum() {
return palletNum;

@ -88,6 +88,7 @@
man_standar,
warehouse_cycle,
pallet_num,
<if test="packType != null">pack_type,</if>
<if test="sprayWay != null">spray_way,</if>
<if test="blankDiameter != null">blank_diameter,</if>
<if test="blankNo != null">blank_no,</if>
@ -110,6 +111,7 @@
#{manStandar},
#{warehouseCycle},
#{palletNum},
<if test="packType != null">#{packType},</if>
<if test="sprayWay != null">#{sprayWay},</if>
<if test="blankDiameter != null">#{blankDiameter},</if>
<if test="blankNo != null">#{blankNo},</if>
@ -155,7 +157,8 @@
iei = #{iei},
man_standar = #{manStandar},
warehouse_cycle = #{warehouseCycle},
pallet_num = #{palletNum}
pallet_num = #{palletNum},
pack_type = #{packType}
where id = #{id}
</update>

@ -68,7 +68,7 @@
<result property="mvgr5Nm" column="mvgr5_nm"/>
<result property="palletNum" column="palletNum"/>
<result property="warehouseCycle" column="warehouse_cycle"/>
<result property="packType" column="pack_type"/>
<!--附属属性-->
<result property="id" column="id"/>
</resultMap>
@ -185,7 +185,8 @@
bpa.support_no,
bpa.pvc,
bpa.support_plate,
bpa.other,bpa.warehouse_cycle,bpa.pallet_num palletNum
bpa.other,bpa.warehouse_cycle,bpa.pallet_num palletNum,
bpa.pack_type
from base_product bp
left join base_product_attached bpa on bpa.product_code = right(bp.product_code,11)
where product_id = #{productId}

Loading…
Cancel
Save