From 4bae9ca274cc687d2584db8e19fb135475a44222 Mon Sep 17 00:00:00 2001 From: shaoyong Date: Wed, 21 Aug 2024 17:18:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=9E=9B=E5=9E=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/op/wms/domain/BaseProduct.java | 9 +++++++++ .../main/java/com/op/wms/domain/BaseProductAttached.java | 9 +++++++++ .../resources/mapper/wms/BaseProductAttachedMapper.xml | 5 ++++- .../src/main/resources/mapper/wms/BaseProductMapper.xml | 5 +++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProduct.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProduct.java index 129af20e..02bc8cbb 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProduct.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProduct.java @@ -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; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProductAttached.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProductAttached.java index cf47713e..f0d05c8f 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProductAttached.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseProductAttached.java @@ -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; diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductAttachedMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductAttachedMapper.xml index 540b1b0a..513633c3 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductAttachedMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductAttachedMapper.xml @@ -88,6 +88,7 @@ man_standar, warehouse_cycle, pallet_num, + pack_type, spray_way, blank_diameter, blank_no, @@ -110,6 +111,7 @@ #{manStandar}, #{warehouseCycle}, #{palletNum}, + #{packType}, #{sprayWay}, #{blankDiameter}, #{blankNo}, @@ -155,7 +157,8 @@ iei = #{iei}, man_standar = #{manStandar}, warehouse_cycle = #{warehouseCycle}, - pallet_num = #{palletNum} + pallet_num = #{palletNum}, + pack_type = #{packType} where id = #{id} diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductMapper.xml index 6337fe2e..b2f48290 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseProductMapper.xml @@ -68,7 +68,7 @@ - + @@ -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} From 5bee31b7e5fb3066a900f01ca80225e80a48312a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=81=92=E6=9D=B0?= <2658502433@qq.com> Date: Thu, 22 Aug 2024 09:59:05 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=89=A9=E6=96=99=E9=99=84=E5=B1=9E?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseProductAttachedController.java | 92 ++++++- .../op/mes/domain/BaseProductAttached.java | 260 ++++++++++-------- .../mes/mapper/BaseProductAttachedMapper.java | 5 + .../service/IBaseProductAttachedService.java | 5 + .../impl/BaseProductAttachedServiceImpl.java | 183 ++++++++++++ .../mapper/mes/BaseProductAttachedMapper.xml | 37 ++- 6 files changed, 466 insertions(+), 116 deletions(-) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/BaseProductAttachedController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/BaseProductAttachedController.java index 0849d568..ddd5f97d 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/BaseProductAttachedController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/BaseProductAttachedController.java @@ -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 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 util = new ExcelUtil<>(BaseProductAttached.class); + // 接收表格信息 + List orderList = util.importExcel(file.getInputStream()); + return baseProductAttachedService.importFile(orderList); + } + } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/BaseProductAttached.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/BaseProductAttached.java index 730984fa..9af6c257 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/BaseProductAttached.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/BaseProductAttached.java @@ -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 + '\'' + + '}'; } } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/BaseProductAttachedMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/BaseProductAttachedMapper.java index 1bea4807..098c9c6e 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/BaseProductAttachedMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/BaseProductAttachedMapper.java @@ -59,4 +59,9 @@ public interface BaseProductAttachedMapper * @return 结果 */ public int deleteBaseProductAttachedByIds(String[] ids); + + BaseProductAttached selectBaseProductAttachedByProductCode(String productCode); + + //检查productCode + String checkSpareCodeUnique(BaseProductAttached baseProductAttached); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IBaseProductAttachedService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IBaseProductAttachedService.java index fd8afd07..301e0d44 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IBaseProductAttachedService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IBaseProductAttachedService.java @@ -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 list); + boolean checkSpareCodeUnique(BaseProductAttached baseProductAttached); + } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/BaseProductAttachedServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/BaseProductAttachedServiceImpl.java index 46a917a7..3c2e32f5 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/BaseProductAttachedServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/BaseProductAttachedServiceImpl.java @@ -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 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) { + 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){ + // 传入对象不能为空 + 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; + } + } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/BaseProductAttachedMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/BaseProductAttachedMapper.xml index 887c5cea..dc025030 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/BaseProductAttachedMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/BaseProductAttachedMapper.xml @@ -24,10 +24,15 @@ + + + - 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 @@ -57,7 +67,18 @@ where id = #{id} - + + + + + insert into base_product_attached @@ -80,6 +101,10 @@ support_plate, other, create_by, + + warehouse_cycle, + pallet_num, + pack_type, #{id}, @@ -101,6 +126,9 @@ #{supportPlate}, #{other}, #{createBy}, + #{warehouseCycle}, + #{palletNum}, + #{packType}, @@ -125,6 +153,11 @@ support_plate = #{supportPlate}, other = #{other}, create_by = #{createBy}, + + + warehouse_cycle = #{warehouseCycle}, + pallet_num = #{palletNum}, + pack_type = #{packType}, where id = #{id} From c75289012a270b378130a2c36905b544bdcd0d94 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 22 Aug 2024 11:45:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E6=8A=A5=E8=A1=A84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/quality/domain/QcCheckTaskDefect.java | 8 ++ .../op/quality/domain/QcCheckTaskDetail.java | 9 ++ .../quality/mapper/QcStaticTableMapper.java | 2 + .../impl/QcCheckTaskIncomeServiceImpl.java | 19 +-- .../service/impl/QcProCheckServiceImpl.java | 2 + .../impl/QcStaticTableServiceImpl.java | 15 +- .../quality/QcCheckTaskDefectMapper.xml | 9 +- .../quality/QcCheckTaskIncomeMapper.xml | 4 +- .../mapper/quality/QcInterfaceMapper.xml | 33 ++--- .../mapper/quality/QcStaticTableMapper.xml | 131 ++++++++++++++---- 10 files changed, 170 insertions(+), 62 deletions(-) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java index 0bb07030..bc848b91 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java @@ -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; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java index e1603e69..fd418b71 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java @@ -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; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java index 3662d820..02e1b577 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java @@ -91,4 +91,6 @@ public interface QcStaticTableMapper { Map getNoOkNum(QcStaticTable qcStaticTable); List getTableHzNoOkData(QcStaticTable qcStaticTable); + @MapKey("ymdms") + Map getNoOkRatioNum(QcStaticTable qcStaticTable); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index 00e1bc59..0a8005d7 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -750,20 +750,17 @@ public class QcCheckTaskIncomeServiceImpl implements } } - + if(qcCheckTaskIncome.getSampleQuality()!=null && qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){ + qcCheckTask.setSampleQuality(sampleQuality); + }else{ + qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality()); + } /**qc_check_task_cg**/ List 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 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 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 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 cols1 = qcStaticTableMapper.getTableHzTitle(qcStaticTable); @@ -887,17 +887,19 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { @DS("#header.poolName") public List getTableHzData(QcStaticTable qcStaticTable) { List dtos = new ArrayList<>(); - qcStaticTable.setDataType("unqualified_remark"); + //qcStaticTable.setDataType("unqualified_remark"); qcStaticTable.setRemark(qcStaticTable.getCheckType()); List noOkTyps = qcStaticTableMapper.getTableHzTitle(qcStaticTable); //第一列日期 List days = this.getHzDays(qcStaticTable.getIncomeTimeStr(),qcStaticTable.getYmdms()); - //抽样数、不良数、不良率 + //抽样数 Map samples = qcStaticTableMapper.getSamplesNum(qcStaticTable); if(samples.isEmpty()){ return dtos; } - //不良数 + //不良数(折算后)、不良率 + Map noOkNumRs = qcStaticTableMapper.getNoOkRatioNum(qcStaticTable); + //不良数(不折算) Map 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{ diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml index 251b177e..d3051a87 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml @@ -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 diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml index bcb89235..a1a6502c 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml @@ -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 ( #{item.recordId},#{item.belongTo},#{item.belongToDetail}, #{item.defectCode},#{item.defectSubclass}, - #{item.noOkQuality}, + #{item.noOkQuality},#{item.classId}, #{item.createBy},#{item.createTime},#{item.factoryCode} ) diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml index 119013bb..072c1270 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml @@ -40,7 +40,7 @@ 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 @@ 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 @@ 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 + From 3a9b3e393ba07746e24449fe6a28fe939efe93b2 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Thu, 22 Aug 2024 12:43:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?2024-08-22=20wms=20-=20=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=20-=20=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/op/wms/domain/BaseEquipment.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java index 446e5a06..920c9462 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java @@ -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; }