Merge remote-tracking branch 'origin/master'

master
zhaoxiaolin 7 months ago
commit ac959caf49

@ -1,12 +1,20 @@
package com.op.device.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.device.domain.EquRepairOrder;
import com.op.device.domain.SparePartsLedger;
import com.op.device.domain.WorkCenter;
import com.op.device.domain.dto.EquCheckItemDTO;
import com.op.device.domain.dto.SummaryReportDTO;
import com.op.device.domain.vo.EquCheckItemImportVO;
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;
@ -25,6 +33,7 @@ import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
@ -149,4 +158,80 @@ public class EquCheckItemController extends BaseController {
public AjaxResult selectMatchListByEquipmentCode(SummaryReportDTO summaryReportDTO) {
return equCheckItemService.selectMatchListByEquipmentCode(summaryReportDTO);
}
// /**
// * 导出检查项汇总列表
// */
// @RequiresPermissions("device:summaryReport:export")
// @Log(title = "导出检查项汇总列表", businessType = BusinessType.EXPORT)
// @PostMapping("/summaryExport")
// public void summaryExport(HttpServletResponse response, EquCheckItem equCheckItem) {
// List<EquCheckItem> list = equCheckItemService.selectEquCheckItemList(equCheckItem);
// ExcelUtil<EquCheckItem> util = new ExcelUtil<EquCheckItem>(EquCheckItem.class);
// util.exportExcel(response, list, "检查项维护数据");
// }
/**
*
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "导入检查项基本信息", businessType = BusinessType.IMPORT)
@PostMapping("/importFile")
@RequiresPermissions("device:item:import")
public AjaxResult importFile(MultipartFile file) throws Exception {
// 创建接收对象
ExcelUtil<EquCheckItemImportVO> util = new ExcelUtil<>(EquCheckItemImportVO.class);
// 接收表格信息
List<EquCheckItemImportVO> list = util.importExcel(file.getInputStream());
return equCheckItemService.importFile(list);
}
/**
*
*
* @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("检查项编码11位年月日加流水号例如20240601001", "itemCode", 20));
excelCols.add(new ExcelCol("检查项详情编码14位检查项编码加流水号例如20240601001001", "detailCode", 20));
excelCols.add(new ExcelCol("部位(检查项名称)", "itemName", 20));
excelCols.add(new ExcelCol("检查方法", "itemMethod", 20));
excelCols.add(new ExcelCol("检查工具", "itemTools", 20));
excelCols.add(new ExcelCol("周期(数字)", "itemLoop", 20));
excelCols.add(new ExcelCol("周期类型(填:日、周、月、季、年)", "itemLoopType", 20));
// excelCols.add(new ExcelCol("维护类型编码", "itemType", 20));
excelCols.add(new ExcelCol("维护类型名称(填:保养、巡检、点检)", "itemTypeName", 20));
excelCols.add(new ExcelCol("标准类型(填:定性或定量)", "standardType", 20));
excelCols.add(new ExcelCol("标准名称", "standardName", 20));
excelCols.add(new ExcelCol("上限", "detailUpLimit", 20));
excelCols.add(new ExcelCol("下限", "detailDownLimit", 20));
excelCols.add(new ExcelCol("单位", "detailUnit", 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();
}
}
}
}

@ -0,0 +1,470 @@
package com.op.device.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
*
*/
public class EquCheckItemImportVO extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String itemId;
/**
*
*/
@Excel(name = "检查项编码11位年月日加流水号例如20240601001")
private String itemCode;
/**
*
*/
@Excel(name = "部位(检查项名称)")
private String itemName;
/**
*
*/
@Excel(name = "检查方法")
private String itemMethod;
/**
*
*/
@Excel(name = "维护类型编码")
private String itemType;
/**
*
*/
@Excel(name = "维护类型名称(填:保养、巡检、点检)")
private String itemTypeName;
// 检查项工具
@Excel(name = "检查工具")
private String itemTools;
// 循环周期类型
@Excel(name = "周期类型(填:日、周、月、季、年)")
private String itemLoopType;
// 循环周期
@Excel(name = "周期(数字)")
private String itemLoop;
/**
*
*/
@Excel(name = "检查项备注")
private String itemRemark;
/**
*
*/
@Excel(name = "工厂")
private String factoryCode;
/**
* 1
*/
private String attr1;
/**
* 2
*/
private String attr2;
/**
* 3
*/
private String attr3;
/**
*
*/
private String delFlag;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createTime;
/**
*
*/
@Excel(name = "创建人")
private String createBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateTime;
/**
*
*/
@Excel(name = "更新人")
private String updateBy;
// 创建日期范围list
private List<Date> createTimeArray;
// 更新日期范围list
private List<Date> updateTimeArray;
// 更新日期开始
private String updateTimeStart;
// 更新日期结束
private String updateTimeEnd;
/////////////////////////////////////导入用
/**
*
*/
private String detailId;
/**
*
*/
@Excel(name = "检查项详情编码14位检查项编码加流水号例如20240601001001")
private String detailCode;
/**
*
*/
@Excel(name = "主检查项编码")
private String parentCode;
//标准类型
@Excel(name = "标准类型(填:定性或定量)")
private String standardType;
//标准名称
@Excel(name = "标准名称")
private String standardName;
//上限
@Excel(name = "上限")
private BigDecimal detailUpLimit;
//下限
@Excel(name = "下限")
private BigDecimal detailDownLimit;
//单位
@Excel(name = "单位")
private String detailUnit;
public String getItemLoop() {
return itemLoop;
}
public void setItemLoop(String itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public List<Date> getUpdateTimeArray() {
return updateTimeArray;
}
public void setUpdateTimeArray(List<Date> updateTimeArray) {
this.updateTimeArray = updateTimeArray;
}
public String getUpdateTimeStart() {
return updateTimeStart;
}
public void setUpdateTimeStart(String updateTimeStart) {
this.updateTimeStart = updateTimeStart;
}
public String getUpdateTimeEnd() {
return updateTimeEnd;
}
public void setUpdateTimeEnd(String updateTimeEnd) {
this.updateTimeEnd = updateTimeEnd;
}
// 创建日期开始
private String createTimeStart;
// 创建日期结束
private String createTimeEnd;
public String getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(String createTimeStart) {
this.createTimeStart = createTimeStart;
}
public String getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(String createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public List<Date> getCreateTimeArray() {
return createTimeArray;
}
public void setCreateTimeArray(List<Date> createTimeArray) {
this.createTimeArray = createTimeArray;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getItemId() {
return itemId;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public String getItemCode() {
return itemCode;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getItemName() {
return itemName;
}
public void setItemMethod(String itemMethod) {
this.itemMethod = itemMethod;
}
public String getItemMethod() {
return itemMethod;
}
public void setItemType(String itemType) {
this.itemType = itemType;
}
public String getItemType() {
return itemType;
}
public void setItemTypeName(String itemTypeName) {
this.itemTypeName = itemTypeName;
}
public String getItemTypeName() {
return itemTypeName;
}
public void setItemRemark(String itemRemark) {
this.itemRemark = itemRemark;
}
public String getItemRemark() {
return itemRemark;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getCreateBy() {
return createBy;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getUpdateBy() {
return updateBy;
}
/////////导入用
public void setDetailId(String detailId) {
this.detailId = detailId;
}
public String getDetailId() {
return detailId;
}
public String getDetailCode() {
return detailCode;
}
public void setDetailCode(String detailCode) {
this.detailCode = detailCode;
}
public void setDetailUpLimit(BigDecimal detailUpLimit) {
this.detailUpLimit = detailUpLimit;
}
public BigDecimal getDetailUpLimit() {
return detailUpLimit;
}
public void setDetailDownLimit(BigDecimal detailDownLimit) {
this.detailDownLimit = detailDownLimit;
}
public BigDecimal getDetailDownLimit() {
return detailDownLimit;
}
public void setDetailUnit(String detailUnit) {
this.detailUnit = detailUnit;
}
public String getDetailUnit() {
return detailUnit;
}
public void setStandardType(String standardType) {
this.standardType = standardType;
}
public String getStandardType() {
return standardType;
}
public void setStandardName(String standardName) {
this.standardName = standardName;
}
public String getStandardName() {
return standardName;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public String getParentCode() {
return parentCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("itemId", getItemId())
.append("itemCode", getItemCode())
.append("itemName", getItemName())
.append("itemMethod", getItemMethod())
.append("itemType", getItemType())
.append("itemTypeName", getItemTypeName())
.append("itemRemark", getItemRemark())
.append("factoryCode", getFactoryCode())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("delFlag", getDelFlag())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("createTimeArray", getCreateTimeArray())
.toString();
}
}

@ -100,4 +100,5 @@ public interface EquCheckItemDetailMapper {
*/
List<EquCheckItemDetail> selectCheckItemDetailByItemCode(String itemCode);
EquCheckItemDetail selectExistByDetailCode(String detailCode);
}

@ -3,9 +3,11 @@ package com.op.device.mapper;
import java.util.List;
import com.op.device.domain.EquCheckItem;
import com.op.device.domain.EquCheckItemDetail;
import com.op.device.domain.EquPlanDetail;
import com.op.device.domain.WorkCenter;
import com.op.device.domain.dto.SummaryReportDTO;
import com.op.device.domain.vo.EquCheckItemImportVO;
import com.op.device.domain.vo.EquCheckItemVO;
import org.apache.ibatis.annotations.Param;
@ -127,4 +129,6 @@ public interface EquCheckItemMapper {
* @return
*/
List<SummaryReportDTO> selectMatchListByEquipmentCode(SummaryReportDTO summaryReportDTO);
EquCheckItem selectExistByItemCode(String itemCode);
}

@ -7,6 +7,7 @@ import com.op.device.domain.EquCheckItem;
import com.op.device.domain.EquRepairOrder;
import com.op.device.domain.dto.EquCheckItemDTO;
import com.op.device.domain.dto.SummaryReportDTO;
import com.op.device.domain.vo.EquCheckItemImportVO;
import com.op.device.domain.vo.EquCheckItemVO;
/**
@ -98,4 +99,6 @@ public interface IEquCheckItemService {
* @return
*/
public AjaxResult selectMatchListByEquipmentCode(SummaryReportDTO summaryReportDTO);
AjaxResult importFile(List<EquCheckItemImportVO> list);
}

@ -9,14 +9,19 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
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.device.domain.*;
import com.op.device.domain.dto.EquCheckItemDTO;
import com.op.device.domain.dto.SummaryReportDTO;
import com.op.device.domain.vo.EquCheckItemImportVO;
import com.op.device.domain.vo.EquCheckItemVO;
import com.op.device.mapper.EquCheckItemDetailMapper;
import com.op.device.mapper.EquItemEquipmentMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -47,6 +52,7 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
@Autowired
private EquItemEquipmentMapper equItemEquipmentMapper;
protected Logger logger = LoggerFactory.getLogger(getClass());
/**
*
*
@ -357,7 +363,6 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
return success(workCenterList);
}
/**
*
*
@ -371,4 +376,202 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService {
List<SummaryReportDTO> matchList = equCheckItemMapper.selectMatchListByEquipmentCode(summaryReportDTO);
return success(matchList);
}
/**
*
*
* @param equCheckItemImportVO
* @return
*/
@Override
@DS("#header.poolName")
@Transactional
public AjaxResult importFile(List<EquCheckItemImportVO> equCheckItemImportVO) {
EquCheckItem example = null;
// 数据校验
AjaxResult checkResult = checkImportFile(equCheckItemImportVO);
for (EquCheckItemImportVO table : equCheckItemImportVO) {
table.setItemId(IdUtils.fastSimpleUUID());
table.setDetailId(IdUtils.fastSimpleUUID());
table.setParentCode(table.getItemCode()); //父code
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
table.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); //工厂号
table.setCreateBy(SecurityUtils.getUsername()); //创建人
table.setCreateTime(DateUtils.getNowDate()); //创建时间
table.setUpdateBy(SecurityUtils.getUsername()); //创建人
table.setUpdateTime(DateUtils.getNowDate()); //创建时间
table.setDelFlag("0"); //删除标志
}
// 如果数据校验成功
if (checkResult.isSuccess()) {
String info = syncImportFunc(equCheckItemImportVO);
return success("信息导入完成。检查项表中检查编码作为主键,导入编码重复。其中导入失败检查项:" + info);
}
// 校验失败
return checkResult;
}
/**
*
*
* @param equCheckItemImportVO
*/
public AjaxResult checkImportFile(List<EquCheckItemImportVO> equCheckItemImportVO) {
// 传入对象不能为空
if (equCheckItemImportVO.size() == 0 || StringUtils.isNull(equCheckItemImportVO)) {
return error(500, "导入的检查项信息不能为空!信息导入失败!");
}
// 循环遍历校验数据是否为空
for (EquCheckItemImportVO table : equCheckItemImportVO) {
// 检查项编码
if (StringUtils.isEmpty(table.getItemCode()) || table.getItemCode() == null ||table.getItemCode().equals("")) {
return error(500, "检查项编码不能为空!信息导入失败!");
}
//检查项详情编码
if (StringUtils.isEmpty(table.getDetailCode()) || table.getDetailCode() == null ||table.getDetailCode().equals("")) {
return error(500, "检查项详情编码不能为空!信息导入失败!");
}
// 部位
if (StringUtils.isEmpty(table.getItemName()) || table.getItemName() == null||table.getItemName().equals("")) {
return error(500, "部位(检查项名称)不能为空!信息导入失败!");
}
// 方法
if (StringUtils.isEmpty(table.getItemMethod()) || table.getItemMethod() == null||table.getItemMethod().equals("")) {
return error(500, "方法不能为空!信息导入失败!");
}
// 工具
if (StringUtils.isEmpty(table.getItemTools()) || table.getItemTools() == null||table.getItemTools().equals("")) {
return error(500, "工具不能为空!信息导入失败!");
}
// 周期
if (StringUtils.isEmpty(table.getItemLoop()) || table.getItemLoop() == null||table.getItemLoop().equals("")) {
return error(500, "周期不能为空!信息导入失败!");
}
// 周期类型
if (StringUtils.isEmpty(table.getItemLoopType()) || table.getItemLoopType() == null ||table.getItemLoopType().equals("")) {
return error(500, "周期类型不能为空!信息导入失败!");
}else{
if(!(table.getItemLoopType().equals("日") || table.getItemLoopType().equals("周") || table.getItemLoopType().equals("月") || table.getItemLoopType().equals("季") || table.getItemLoopType().equals("年"))){
return error(500, "周期类型录入格式错误!信息导入失败!");
}
}
// // 维护类型编码
// if (table.getItemType().isEmpty() || table.getItemType() == null) {
// return error(500, "维护类型编码不能为空!信息导入失败!");
// }else{
//
// }
// 维护类型名称
if (StringUtils.isEmpty(table.getItemTypeName()) || table.getItemTypeName() == null ||table.getItemTypeName().equals("")) {
return error(500, "维护类型名称不能为空!信息导入失败!");
}else{
if(!(table.getItemTypeName().equals("点检") || table.getItemTypeName().equals("巡检") || table.getItemTypeName().equals("保养"))){
return error(500, "维护类型名称格式录入错误!信息导入失败!");
}
}
// 标准类型
if (StringUtils.isEmpty(table.getStandardType()) || table.getStandardType() == null ||table.getStandardType().equals("")) {
return error(500, "标准类型不能为空!信息导入失败!");
}else{
if(!(table.getStandardType().equals("定性") || table.getStandardType().equals("定量"))){
return error(500, "标准类型名称格式录入错误!信息导入失败!");
}
}
// 标准名称
if (StringUtils.isEmpty(table.getStandardName()) || table.getStandardName() == null ||table.getStandardName().equals("")) {
return error(500, "标准名称不能为空!信息导入失败!");
}
//定量的判断
if(table.getStandardType().equals("定量")){
// 上限
if (table.getDetailUpLimit() == null) {
return error(500, "定量的标准上限不能为空!信息导入失败!");
}
// 下限
if (table.getDetailDownLimit() == null) {
return error(500, "定量的标准下限不能为空!信息导入失败!");
}
// 单位
if (StringUtils.isEmpty(table.getDetailUnit()) || table.getDetailUnit() == null ||table.getDetailUnit().equals("")) {
return error(500, "定量的单位不能为空!信息导入失败!");
}
}
}
return success();
}
public String syncImportFunc(List<EquCheckItemImportVO> equCheckItemImportVO) {
String failCheckItem = "";
for (EquCheckItemImportVO table : equCheckItemImportVO) {
String msg = syncFunc(table);
if (StringUtils.isNotBlank(msg)) {
failCheckItem += msg + ",";
}
}
return failCheckItem;
}
@Transactional(rollbackFor = Exception.class)
public String syncFunc(EquCheckItemImportVO table) {
String failCheckItem = "";
EquCheckItem itemExist = equCheckItemMapper.selectExistByItemCode(table.getItemCode());
EquCheckItemDetail detailExist = equCheckItemDetailMapper.selectExistByDetailCode(table.getDetailCode());
//主对象
EquCheckItem equCheckItem = new EquCheckItem();
BeanUtils.copyProperties(table,equCheckItem);
if(equCheckItem.getItemTypeName().equals("点检")){
equCheckItem.setItemType("spotInspection");
}else if(equCheckItem.getItemTypeName().equals("巡检")){
equCheckItem.setItemType("inspection");
}else if(equCheckItem.getItemTypeName().equals("保养")){
equCheckItem.setItemType("maintenance");
}
//周期类型
if(equCheckItem.getItemLoopType().equals("日")){
equCheckItem.setItemLoopType("day");
}else if(equCheckItem.getItemLoopType().equals("周")){
equCheckItem.setItemLoopType("week");
}else if(equCheckItem.getItemTypeName().equals("月")){
equCheckItem.setItemLoopType("month");
}else if(equCheckItem.getItemLoopType().equals("季")){
equCheckItem.setItemLoopType("season");
}else if(equCheckItem.getItemTypeName().equals("年")){
equCheckItem.setItemLoopType("year");
}
equCheckItem.setItemLoop(Integer.valueOf(table.getItemLoop()));
//详情对象
EquCheckItemDetail equCheckItemDetail = new EquCheckItemDetail();
BeanUtils.copyProperties(table,equCheckItemDetail);
if(equCheckItemDetail.getStandardType().equals("定性")){
equCheckItemDetail.setStandardType("qualitative");
}else if(equCheckItemDetail.getStandardType().equals("定量")){
equCheckItemDetail.setStandardType("quantify");
}
//不存在就插入
if (itemExist == null) {
equCheckItemMapper.insertEquCheckItem(equCheckItem);
logger.info("=======检查项[" + table.getItemCode() + "]=======导入成功");
if(detailExist == null){
equCheckItemDetailMapper.insertEquCheckItemDetail(equCheckItemDetail);
logger.info("=======检查项[" + table.getItemCode() +"]的["+ table.getDetailCode() + "]=======导入成功");
}else{
failCheckItem = '['+table.getItemCode() + "]的[" + table.getDetailCode() + "]";
logger.info("=======检查项[" + table.getItemCode() +"]的["+ table.getDetailCode() + "]=======导入失败");
}
} else {
failCheckItem = '['+table.getItemCode() + ']';
logger.info("=======检查项[" + failCheckItem + "]=======导入失败");
}
return failCheckItem;
}
}

@ -164,4 +164,10 @@
where parent_code = (
select item_code from equ_check_item where item_id = #{itemId} )
</delete>
<select id="selectExistByDetailCode" parameterType="java.lang.String" resultMap="EquCheckItemDetailResult">
<include refid="selectEquCheckItemDetailVo"/>
where detail_code = #{detailCode}
and del_flag ='0'
</select>
</mapper>

@ -226,4 +226,9 @@
and CONVERT(varchar,order_end,21) like concat('%',#{yearMouth}, '%')
</select>
<select id="selectExistByItemCode" parameterType="java.lang.String" resultMap="EquCheckItemResult">
<include refid="selectEquCheckItemVo"/>
where item_code = #{itemCode}
</select>
</mapper>

@ -342,14 +342,7 @@ public class WmsToWCSmissionController {
return AjaxResult.success(wmsProductPutService.selectFinishedProductSales(wmsSellOutEmbryo));
}
/**
* 退--
*
*/
@PostMapping("/finishedProductSalesReturnTD")
public AjaxResult finishedProductSalesReturnTD(@RequestBody WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
return AjaxResult.success(wmsProductPutService.finishedProductSalesReturnTD(wmsRuturnPutEmbryo));
}
/**
* --
@ -377,7 +370,14 @@ public class WmsToWCSmissionController {
return AjaxResult.success(wmsProductPutService.ScanCodeSingleBox(wmsProductPutTrayCode));
}
/**
* 退--
*
*/
@PostMapping("/finishedProductSalesReturnTD")
public AjaxResult finishedProductSalesReturnTD(@RequestBody WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
return AjaxResult.success(wmsProductPutService.finishedProductSalesReturnTD(wmsRuturnPutEmbryo));
}
/**
* 退--

@ -908,7 +908,67 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
List<WmsSellOutEmbryo> wmsSellOutEmbryoList= wmsSellOutEmbryoMapper.selectWmsSellOutEmbryoList(wmsSellOutEmbryo);
return wmsSellOutEmbryoList;
}
@Override
public String finishedProductSalesReturnTD(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
String results="提单成功";//退货单
DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode());
Map<String, Object> objectMap=new HashMap<>();
objectMap.put("S_MATNR",wmsRuturnPutEmbryo.getProductCode());//物料号,
objectMap.put("S_TDDAT",wmsRuturnPutEmbryo.getAttr1());//String 计划运输日期
objectMap.put("S_VBELN",wmsRuturnPutEmbryo.getProductOrder());//成品销售退货单
objectMap.put("S_AUART","ZRE");
R result = remoteSapService.FPinventory(objectMap);
int code = result.getCode();
String msg = result.getMsg();
if(code==200){
List<Map<String,String>> mapList= (List<Map<String, String>>) result.getData();
for ( Map<String,String> stringStringMap: mapList){
String MAKTX=stringStringMap.get("MAKTX");//物料描述
String MATNR=stringStringMap.get("MATNR");//物料号
String KUNNR=stringStringMap.get("KUNNR");//送达方
String VBELN=stringStringMap.get("VBELN");//交货单---一销售单对多交货单
String VBELN_VA=stringStringMap.get("VBELN_VA");//销售单
String MENGE=stringStringMap.get("MENGE");//数量
String MEINS=stringStringMap.get("MEINS");//单位
String TDDAT=stringStringMap.get("TDDAT");//计划日期
String KUNNR_NM=stringStringMap.get("KUNNR_NM");//送达方描述
String LIFNR=stringStringMap.get("LIFNR");//货运代理
String LIFNR_NM=stringStringMap.get("LIFNR_NM");//货运代理描述
String ZSAREA=stringStringMap.get("ZSAREA");//销售大区
String BZTXT1=stringStringMap.get("BZTXT1");//销售大区描述
WmsSellOutEmbryo wmsSellOutEmbryo1=new WmsSellOutEmbryo();
wmsSellOutEmbryo1.setId(IdUtils.fastSimpleUUID());
wmsSellOutEmbryo1.setDeliveryOrder(VBELN);//交货单号
wmsSellOutEmbryo1.setAttr1(VBELN_VA);
wmsSellOutEmbryo1.setProductCode(MATNR);
wmsSellOutEmbryo1.setProductName(MAKTX);
wmsSellOutEmbryo1.setFactoryCode(wmsRuturnPutEmbryo.getFactoryCode());
wmsSellOutEmbryo1.setOutQuantity(new BigDecimal("0"));
wmsSellOutEmbryo1.setAttr2(KUNNR);
wmsSellOutEmbryo1.setAttr3(KUNNR_NM);
wmsSellOutEmbryo1.setAttr4(LIFNR);
wmsSellOutEmbryo1.setAttr5(LIFNR_NM);
wmsSellOutEmbryo1.setAttr6(ZSAREA);
wmsSellOutEmbryo1.setAttr7(BZTXT1);
wmsSellOutEmbryo1.setAttr8(TDDAT);
wmsSellOutEmbryo1.setPlanQuantity(new BigDecimal(MENGE));
wmsSellOutEmbryo1.setUnitOfMeasure(MEINS);
wmsSellOutEmbryo1.setStatus("0");
wmsSellOutEmbryo1.setSapStatus("0");
wmsSellOutEmbryo1.setActiveFlag("1");
wmsSellOutEmbryo1.setCreateBy(wmsRuturnPutEmbryo.getCreateBy());
wmsSellOutEmbryo1.setCreateTime(new Date());
//用行项目和订单进行判断
// WmsSellOutEmbryo wmsSellOutEmbryo2= wmsRuturnPutEmbryoMapper.selectWmsRuturnPutEmbryo(VBELN,MATNR);
// if (wmsSellOutEmbryo2==null){
// wmsSellOutEmbryoMapper.insertWmsSellOutEmbryo(wmsSellOutEmbryo1);
// }else {
// results="已经存在";
// }
}
}
return results;
}
@Override
public List<WmsRuturnPutEmbryo> FinishedProductSalesReturn(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode());
@ -1146,67 +1206,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
return wmsRuturnPutEmbryoMapper.selectWmsRuturnPutEmbryoList(wmsRuturnPutEmbryo);
}
@Override
public String finishedProductSalesReturnTD(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
String results="提单成功";//退货单
DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode());
Map<String, Object> objectMap=new HashMap<>();
objectMap.put("S_MATNR",wmsRuturnPutEmbryo.getProductCode());//物料号,
objectMap.put("S_TDDAT",wmsRuturnPutEmbryo.getAttr1());//String 计划运输日期
objectMap.put("S_VBELN",wmsRuturnPutEmbryo.getProductOrder());//成品销售退货单
objectMap.put("S_AUART","ZRE");//销售退货凭证
R result = remoteSapService.FPinventory(objectMap);
int code = result.getCode();
String msg = result.getMsg();
if(code==200){
List<Map<String,String>> mapList= (List<Map<String, String>>) result.getData();
for ( Map<String,String> stringStringMap: mapList){
String MAKTX=stringStringMap.get("MAKTX");//物料描述
String MATNR=stringStringMap.get("MATNR");//物料号
String KUNNR=stringStringMap.get("KUNNR");//送达方
String VBELN=stringStringMap.get("VBELN");//交货单---一销售单对多交货单
String VBELN_VA=stringStringMap.get("VBELN_VA");//销售单
String MENGE=stringStringMap.get("MENGE");//数量
String MEINS=stringStringMap.get("MEINS");//单位
String TDDAT=stringStringMap.get("TDDAT");//计划日期
String KUNNR_NM=stringStringMap.get("KUNNR_NM");//送达方描述
String LIFNR=stringStringMap.get("LIFNR");//货运代理
String LIFNR_NM=stringStringMap.get("LIFNR_NM");//货运代理描述
String ZSAREA=stringStringMap.get("ZSAREA");//销售大区
String BZTXT1=stringStringMap.get("BZTXT1");//销售大区描述
WmsSellOutEmbryo wmsSellOutEmbryo1=new WmsSellOutEmbryo();
wmsSellOutEmbryo1.setId(IdUtils.fastSimpleUUID());
wmsSellOutEmbryo1.setDeliveryOrder(VBELN);//交货单号
wmsSellOutEmbryo1.setAttr1(VBELN_VA);
wmsSellOutEmbryo1.setProductCode(MATNR);
wmsSellOutEmbryo1.setProductName(MAKTX);
wmsSellOutEmbryo1.setFactoryCode(wmsRuturnPutEmbryo.getFactoryCode());
wmsSellOutEmbryo1.setOutQuantity(new BigDecimal("0"));
wmsSellOutEmbryo1.setAttr2(KUNNR);
wmsSellOutEmbryo1.setAttr3(KUNNR_NM);
wmsSellOutEmbryo1.setAttr4(LIFNR);
wmsSellOutEmbryo1.setAttr5(LIFNR_NM);
wmsSellOutEmbryo1.setAttr6(ZSAREA);
wmsSellOutEmbryo1.setAttr7(BZTXT1);
wmsSellOutEmbryo1.setAttr8(TDDAT);
wmsSellOutEmbryo1.setPlanQuantity(new BigDecimal(MENGE));
wmsSellOutEmbryo1.setUnitOfMeasure(MEINS);
wmsSellOutEmbryo1.setStatus("0");
wmsSellOutEmbryo1.setSapStatus("0");
wmsSellOutEmbryo1.setActiveFlag("1");
wmsSellOutEmbryo1.setCreateBy(wmsRuturnPutEmbryo.getCreateBy());
wmsSellOutEmbryo1.setCreateTime(new Date());
//判断有没有这个单子,。如果有的话,就跳过吧
WmsSellOutEmbryo wmsSellOutEmbryo2= wmsSellOutEmbryoMapper.selectWmsSellOutEmbryoByOrderCodeAndProductCode(VBELN,MATNR);
// if (wmsSellOutEmbryo2==null){
// wmsSellOutEmbryoMapper.insertWmsSellOutEmbryo(wmsSellOutEmbryo1);
// }else {
// results="已经存在";
// }
}
}
return results;
}
//去除空格截取规则例子20270106LJ20240107CBCD0J——》240107CBCD

Loading…
Cancel
Save