箱型改单表,生产日报表导出修改。

master
Yangwl 7 months ago
parent 59b032d6b5
commit 86fd98b6db

@ -1,5 +1,6 @@
package com.op.mes.controller; package com.op.mes.controller;
import java.io.IOException;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -24,6 +25,7 @@ import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo; import com.op.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -59,7 +61,25 @@ public class MesBoxController extends BaseController {
ExcelUtil<MesBox> util = new ExcelUtil<MesBox>(MesBox.class); ExcelUtil<MesBox> util = new ExcelUtil<MesBox>(MesBox.class);
util.exportExcel(response, list, "箱体类型数据"); util.exportExcel(response, list, "箱体类型数据");
} }
/**
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
ExcelUtil<MesBox> util = new ExcelUtil<MesBox>(MesBox.class);
util.importTemplateExcel(response, "箱体类型导入模板");
}
@Log(title = "箱体类型导入", businessType = BusinessType.IMPORT)
@RequiresPermissions("mes:mesBox:import")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<MesBox> util = new ExcelUtil<MesBox>(MesBox.class);
List<MesBox> mesBoxList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
String message = mesBoxService.importMesBoxTypes(mesBoxList, updateSupport, operName);
return success(message);
}
/** /**
* *
*/ */

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel; import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity; import com.op.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/** /**
* mes_box * mes_box
* *
@ -18,17 +20,58 @@ private static final long serialVersionUID=1L;
private Long boxId; private Long boxId;
/** 字典名称 */ /** 字典名称 */
@Excel(name = "字典名称") @Excel(name = "箱体名称")
private String boxName; private String boxName;
/** 字典类型 */ /** 字典类型 */
@Excel(name = "字典类型") @Excel(name = "箱体类型1-F")
private String boxType; private String boxType;
/** 状态0正常 */ /** 状态0正常 */
@Excel(name = "状态", readConverterExp = "状态0正常") //@Excel(name = "状态", readConverterExp = "状态0正常")
private String status; private String status;
@Excel(name = "长")
private BigDecimal length;
@Excel(name = "宽")
private BigDecimal width;
@Excel(name = "高")
private BigDecimal height;
private String delFlag;
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public BigDecimal getLength() {
return length;
}
public void setLength(BigDecimal length) {
this.length = length;
}
public BigDecimal getWidth() {
return width;
}
public void setWidth(BigDecimal width) {
this.width = width;
}
public BigDecimal getHeight() {
return height;
}
public void setHeight(BigDecimal height) {
this.height = height;
}
public void setBoxId(Long boxId){ public void setBoxId(Long boxId){
this.boxId = boxId; this.boxId = boxId;
} }

@ -67,15 +67,15 @@ public class MesDailyReportVo extends BaseEntity {
private String teamDesc; private String teamDesc;
//计划产量 //计划产量
// 标准用人 // 实际用人
@Excel(name = "标准用人") @Excel(name = "实际用人")
private BigDecimal useMan; private BigDecimal useMan;
private String workorderName; private String workorderName;
private String quantity;//计划产量(箱) private String quantity;//计划产量(箱)
@Excel(name = "标准用人") @Excel(name = "标准用人")
private String manStandard;//实际用人 private String manStandard;//标准用人
@Excel(name = "标准工时") @Excel(name = "标准工时")
private String workTimeStandard;//工时-标准 private String workTimeStandard;//工时-标准
@Excel(name = "实际工时") @Excel(name = "实际工时")

@ -64,4 +64,6 @@ public interface MesBoxMapper {
MesBox checkBoxTypeUnique(String boxType); MesBox checkBoxTypeUnique(String boxType);
int countBoxDataByType(String boxType); int countBoxDataByType(String boxType);
MesBox selectBoxByBoxType(String boxType);
} }

@ -62,4 +62,6 @@ public interface IMesBoxService {
List<MesBox> selectDictTypeAll(); List<MesBox> selectDictTypeAll();
boolean checkBoxTypeUnique(MesBox mesBox); boolean checkBoxTypeUnique(MesBox mesBox);
String importMesBoxTypes(List<MesBox> mesBoxList, boolean updateSupport, String operName);
} }

@ -7,15 +7,20 @@ import com.op.common.core.constant.UserConstants;
import com.op.common.core.exception.ServiceException; import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.bean.BeanValidators;
import com.op.common.security.utils.DictUtils; import com.op.common.security.utils.DictUtils;
import com.op.common.security.utils.SecurityUtils; import com.op.common.security.utils.SecurityUtils;
import com.op.system.api.domain.SysDictType; import com.op.system.api.domain.SysDictType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesBoxMapper; import com.op.mes.mapper.MesBoxMapper;
import com.op.mes.domain.MesBox; import com.op.mes.domain.MesBox;
import com.op.mes.service.IMesBoxService; import com.op.mes.service.IMesBoxService;
import javax.validation.Validator;
/** /**
* Service * Service
* *
@ -24,9 +29,13 @@ import com.op.mes.service.IMesBoxService;
*/ */
@Service @Service
public class MesBoxServiceImpl implements IMesBoxService { public class MesBoxServiceImpl implements IMesBoxService {
private static final Logger log = LoggerFactory.getLogger(MesBoxServiceImpl.class);
@Autowired @Autowired
private MesBoxMapper mesBoxMapper; private MesBoxMapper mesBoxMapper;
@Autowired
protected Validator validator;
/** /**
* *
* *
@ -128,4 +137,54 @@ public class MesBoxServiceImpl implements IMesBoxService {
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
@Override
@DS("#header.poolName")
public String importMesBoxTypes(List<MesBox> mesBoxList, boolean updateSupport, String operName) {
if (StringUtils.isNull(mesBoxList) || mesBoxList.size() == 0) {
throw new ServiceException("导入箱型数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (MesBox mesBox : mesBoxList) {
try {
// 验证是否存在这个箱型
MesBox u = mesBoxMapper.selectBoxByBoxType(mesBox.getBoxType());
if (StringUtils.isNull(u)) {
BeanValidators.validateWithException(validator, mesBox);
mesBox.setStatus("0");
mesBox.setDelFlag("0");
mesBox.setCreateTime(DateUtils.getNowDate());
mesBox.setCreateBy(operName);
mesBoxMapper.insertMesBox(mesBox);
successNum++;
successMsg.append("<br/>" + successNum + "、箱型 " + mesBox.getBoxName() + " 导入成功");
} else if (updateSupport) {
BeanValidators.validateWithException(validator, mesBox);
mesBox.setUpdateTime(DateUtils.getNowDate());
mesBox.setUpdateBy(operName);
mesBoxMapper.updateMesBox(mesBox);
successNum++;
successMsg.append("<br/>" + successNum + "、箱型 " + mesBox.getBoxName() + " 更新成功");
} else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、箱型 " + mesBox.getBoxName() + " 已存在");
}
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、箱型 " + mesBox.getBoxName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
} }

@ -14,10 +14,13 @@
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
<result property="length" column="length"/>
<result property="width" column="width"/>
<result property="height" column="height"/>
</resultMap> </resultMap>
<sql id="selectMesBoxVo"> <sql id="selectMesBoxVo">
select box_id, box_name, box_type, status, create_by, create_time, update_by, update_time, remark from mes_box select box_id, box_name, box_type, status,length, width, height, create_by, create_time, update_by, update_time, remark from mes_box
</sql> </sql>
<select id="selectMesBoxList" parameterType="MesBox" resultMap="MesBoxResult"> <select id="selectMesBoxList" parameterType="MesBox" resultMap="MesBoxResult">
@ -45,44 +48,32 @@
<insert id="insertMesBox" parameterType="MesBox"> <insert id="insertMesBox" parameterType="MesBox">
insert into mes_box insert into mes_box
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="boxId != null">box_id, <if test="boxId != null">box_id,</if>
</if> <if test="boxName != null">box_name,</if>
<if test="boxName != null">box_name, <if test="boxType != null">box_type,</if>
</if> <if test="status != null">status,</if>
<if test="boxType != null">box_type, <if test="createBy != null">create_by,</if>
</if> <if test="length != null">length,</if>
<if test="status != null">status, <if test="width != null">width,</if>
</if> <if test="height != null">height,</if>
<if test="createBy != null">create_by, <if test="createTime != null">create_time,</if>
</if> <if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time, <if test="updateTime != null">update_time,</if>
</if> <if test="remark != null">remark,</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="remark != null">remark,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="boxId != null">#{boxId}, <if test="boxId != null">#{boxId},</if>
</if> <if test="boxName != null">#{boxName},</if>
<if test="boxName != null">#{boxName}, <if test="boxType != null">#{boxType},</if>
</if> <if test="status != null">#{status},</if>
<if test="boxType != null">#{boxType}, <if test="createBy != null">#{createBy},</if>
</if> <if test="length != null">#{length},</if>
<if test="status != null">#{status}, <if test="width != null">#{width},</if>
</if> <if test="height != null">#{height},</if>
<if test="createBy != null">#{createBy}, <if test="createTime != null">#{createTime},</if>
</if> <if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime}, <if test="updateTime != null">#{updateTime},</if>
</if> <if test="remark != null">#{remark},</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="remark != null">#{remark},
</if>
</trim> </trim>
</insert> </insert>
@ -98,6 +89,15 @@
<if test="status != null">status = <if test="status != null">status =
#{status}, #{status},
</if> </if>
<if test="length != null">length =
#{length},
</if>
<if test="width != null">width =
#{width},
</if>
<if test="height != null">height =
#{height},
</if>
<if test="createBy != null">create_by = <if test="createBy != null">create_by =
#{createBy}, #{createBy},
</if> </if>
@ -141,4 +141,10 @@
from mes_box from mes_box
where box_type = #{boxType} where box_type = #{boxType}
</select> </select>
<select id="selectBoxByBoxType" parameterType="String" resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
where box_type = #{boxType} and del_flag = '0'
</select>
</mapper> </mapper>

@ -1,5 +1,6 @@
package com.op.wms.controller; package com.op.wms.controller;
import java.io.IOException;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -57,7 +58,6 @@ public class BaseProductController extends BaseController {
ExcelUtil<BaseProduct> util = new ExcelUtil<BaseProduct>(BaseProduct.class); ExcelUtil<BaseProduct> util = new ExcelUtil<BaseProduct>(BaseProduct.class);
util.exportExcel(response, list, "物料信息数据"); util.exportExcel(response, list, "物料信息数据");
} }
/** /**
* *
*/ */

@ -89,6 +89,8 @@ public class BaseProduct extends BaseEntity {
@Excel(name = "高") @Excel(name = "高")
private BigDecimal height; private BigDecimal height;
private String boxType;
/** /**
* *
*/ */
@ -361,6 +363,14 @@ public class BaseProduct extends BaseEntity {
private String warehouseCycle; private String warehouseCycle;
private String packType; private String packType;
public String getBoxType() {
return boxType;
}
public void setBoxType(String boxType) {
this.boxType = boxType;
}
public String getCpkType() { public String getCpkType() {
return cpkType; return cpkType;
} }

@ -17,6 +17,7 @@
<result property="length" column="length"/> <result property="length" column="length"/>
<result property="width" column="width"/> <result property="width" column="width"/>
<result property="height" column="height"/> <result property="height" column="height"/>
<result property="boxType" column="box_type"/>
<result property="grossWeight" column="gross_weight"/> <result property="grossWeight" column="gross_weight"/>
<result property="netWeight" column="net_weight"/> <result property="netWeight" column="net_weight"/>
<result property="tareWeight" column="tare_weight"/> <result property="tareWeight" column="tare_weight"/>
@ -171,6 +172,7 @@
bp.length, bp.length,
bp.width, bp.width,
bp.height, bp.height,
bp.box_type,
bp.gross_weight, bp.gross_weight,
bp.net_weight, bp.net_weight,
bp.tare_weight, bp.tare_weight,
@ -243,6 +245,7 @@
<if test="length != null">length,</if> <if test="length != null">length,</if>
<if test="width != null">width,</if> <if test="width != null">width,</if>
<if test="height != null">height,</if> <if test="height != null">height,</if>
<if test="boxType != null">box_type,</if>
<if test="grossWeight != null">gross_weight,</if> <if test="grossWeight != null">gross_weight,</if>
<if test="netWeight != null">net_weight,</if> <if test="netWeight != null">net_weight,</if>
<if test="tareWeight != null">tare_weight,</if> <if test="tareWeight != null">tare_weight,</if>
@ -290,6 +293,7 @@
<if test="length != null">#{length},</if> <if test="length != null">#{length},</if>
<if test="width != null">#{width},</if> <if test="width != null">#{width},</if>
<if test="height != null">#{height},</if> <if test="height != null">#{height},</if>
<if test="boxType != null">#{boxType},</if>
<if test="grossWeight != null">#{grossWeight},</if> <if test="grossWeight != null">#{grossWeight},</if>
<if test="netWeight != null">#{netWeight},</if> <if test="netWeight != null">#{netWeight},</if>
<if test="tareWeight != null">#{tareWeight},</if> <if test="tareWeight != null">#{tareWeight},</if>
@ -340,6 +344,7 @@
<if test="length != null">length = #{length},</if> <if test="length != null">length = #{length},</if>
<if test="width != null">width = #{width},</if> <if test="width != null">width = #{width},</if>
<if test="height != null">height = #{height},</if> <if test="height != null">height = #{height},</if>
<if test="boxType != null">box_type = #{boxType},</if>
<if test="grossWeight != null">gross_weight = #{grossWeight},</if> <if test="grossWeight != null">gross_weight = #{grossWeight},</if>
<if test="netWeight != null">net_weight = #{netWeight},</if> <if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="tareWeight != null">tare_weight = #{tareWeight},</if> <if test="tareWeight != null">tare_weight = #{tareWeight},</if>

Loading…
Cancel
Save