报表数据修改、增加打卡记录、领料单差异

master
Yangwl 4 weeks ago
parent 1b1c023906
commit c990e5244f

@ -0,0 +1,98 @@
package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.op.mes.domain.MesAttendanceRecords;
import com.op.mes.service.IMesAttendanceRecordsService;
/**
* MESController
*
* @author Yangwl
* @date 2025-02-19
*/
@RestController
@RequestMapping("/AttendanceRecords")
public class MesAttendanceRecordsController extends BaseController
{
@Autowired
private IMesAttendanceRecordsService mesAttendanceRecordsService;
/**
* MES
*/
@RequiresPermissions("mes:AttendanceRecords:list")
@GetMapping("/list")
public TableDataInfo list(MesAttendanceRecords mesAttendanceRecords)
{
startPage();
List<MesAttendanceRecords> list = mesAttendanceRecordsService.selectMesAttendanceRecordsList(mesAttendanceRecords);
return getDataTable(list);
}
// /**
// * 导出MES打卡记录列表
// */
// @PreAuthorize("@ss.hasPermi('mes:AttendanceRecords:export')")
// @Log(title = "MES打卡记录", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, MesAttendanceRecords mesAttendanceRecords)
// {
// List<MesAttendanceRecords> list = mesAttendanceRecordsService.selectMesAttendanceRecordsList(mesAttendanceRecords);
// ExcelUtil<MesAttendanceRecords> util = new ExcelUtil<MesAttendanceRecords>(MesAttendanceRecords.class);
// util.exportExcel(response, list, "MES打卡记录数据");
// }
// /**
// * 获取MES打卡记录详细信息
// */
// @PreAuthorize("@ss.hasPermi('mes:AttendanceRecords:query')")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") String id)
// {
// return success(mesAttendanceRecordsService.selectMesAttendanceRecordsById(id));
// }
//
// /**
// * 新增MES打卡记录
// */
// @PreAuthorize("@ss.hasPermi('mes:AttendanceRecords:add')")
// @Log(title = "MES打卡记录", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody MesAttendanceRecords mesAttendanceRecords)
// {
// return toAjax(mesAttendanceRecordsService.insertMesAttendanceRecords(mesAttendanceRecords));
// }
//
// /**
// * 修改MES打卡记录
// */
// @PreAuthorize("@ss.hasPermi('mes:AttendanceRecords:edit')")
// @Log(title = "MES打卡记录", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody MesAttendanceRecords mesAttendanceRecords)
// {
// return toAjax(mesAttendanceRecordsService.updateMesAttendanceRecords(mesAttendanceRecords));
// }
//
// /**
// * 删除MES打卡记录
// */
// @PreAuthorize("@ss.hasPermi('mes:AttendanceRecords:remove')")
// @Log(title = "MES打卡记录", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable String[] ids)
// {
// return toAjax(mesAttendanceRecordsService.deleteMesAttendanceRecordsByIds(ids));
// }
}

@ -39,11 +39,11 @@ public class MesReportWorksController extends BaseController {
*/
@RequiresPermissions("mes:reportWork:lists")
@GetMapping("/lists")
public TableDataInfo lists(MesReportWork mesReportWork) {
// startPage();
// List<MesReportWork> hzlist = mesReportWorksService.getReportWorksList(mesReportWork);
// return getDataTable(hzlist);
return null;
public TableDataInfo lists(ConsumptionDiff consumptionDiff) {
startPage();
List<ConsumptionDiff> hzlist = mesReportWorksService.getReportWorksList(consumptionDiff);
return getDataTable(hzlist);
}
/**

@ -0,0 +1,200 @@
package com.op.mes.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public class ConsumptionDiff extends BaseEntity {
private String parentOrder;
private String workorderCodeSap;
private String workorderCode;
private String productCode;
private String productName;
private String unit;
private String atrr2;
@Excel(name = "工单日期",dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date productDate;//工单日期
private BigDecimal planNumber;
private BigDecimal proNumber;
private String materialCode;
private String materialName;
private BigDecimal quantity;
private String recoil;
private BigDecimal standar;
private String erfme;
private BigDecimal diff;
private BigDecimal orderQuantity;
private BigDecimal quantityFeedback;
private BigDecimal should;
public BigDecimal getShould() {
return should;
}
public void setShould(BigDecimal should) {
this.should = should;
}
public BigDecimal getOrderQuantity() {
return orderQuantity;
}
public void setOrderQuantity(BigDecimal orderQuantity) {
this.orderQuantity = orderQuantity;
}
public BigDecimal getQuantityFeedback() {
return quantityFeedback;
}
public void setQuantityFeedback(BigDecimal quantityFeedback) {
this.quantityFeedback = quantityFeedback;
}
public Date getProductDate() {
return productDate;
}
public void setProductDate(Date productDate) {
this.productDate = productDate;
}
public BigDecimal getDiff() {
if (should != null && quantity != null) {
this.diff = quantity.subtract(should).setScale(2, BigDecimal.ROUND_HALF_UP);
} else {
this.diff = null; // 或者根据需求处理
}
return diff;
}
public void setDiff(BigDecimal diff) {
this.diff = diff;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getParentOrder() {
return parentOrder;
}
public void setParentOrder(String parentOrder) {
this.parentOrder = parentOrder;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getAtrr2() {
return atrr2;
}
public void setAtrr2(String atrr2) {
this.atrr2 = atrr2;
}
public BigDecimal getPlanNumber() {
return planNumber;
}
public void setPlanNumber(BigDecimal planNumber) {
this.planNumber = planNumber;
}
public BigDecimal getProNumber() {
return proNumber;
}
public void setProNumber(BigDecimal proNumber) {
this.proNumber = proNumber;
}
public String getWorkorderCodeSap() {
return workorderCodeSap;
}
public void setWorkorderCodeSap(String workorderCodeSap) {
this.workorderCodeSap = workorderCodeSap;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
public String getRecoil() {
return recoil;
}
public void setRecoil(String recoil) {
this.recoil = recoil;
}
public BigDecimal getStandar() {
return standar;
}
public void setStandar(BigDecimal standar) {
this.standar = standar;
}
public String getErfme() {
return erfme;
}
public void setErfme(String erfme) {
this.erfme = erfme;
}
}

@ -18,6 +18,15 @@ public class H5 {
private String feedbackTime;
private String parentOrder;
private String reason;
private String shift;
public String getShift() {
return shift;
}
public void setShift(String shift) {
this.shift = shift;
}
public String getReason() {
return reason;

@ -0,0 +1,240 @@
package com.op.mes.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* MES mes_attendance_records
*
* @author Yangwl
* @date 2025-02-19
*/
public class MesAttendanceRecords extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增id */
private String id;
/** 用户编码 */
@Excel(name = "用户编码")
private String userId;
/** 用户名称 */
@Excel(name = "用户名称")
private String userName;
/** 考勤状态 */
@Excel(name = "考勤状态")
private String attendanceStatus;
/** 性别 */
@Excel(name = "性别")
private String sex;
/** 年龄 */
@Excel(name = "年龄")
private Long age;
/** 身份证号 */
@Excel(name = "身份证号")
private String idNumber;
/** 上班打卡时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上班打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 上班打卡地点 */
@Excel(name = "上班打卡地点")
private String startAddr;
/** 下班打卡时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "下班打卡时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 下班打开地点 */
@Excel(name = "下班打开地点")
private String endAddr;
/** 考勤时间段 */
@Excel(name = "考勤时间段")
private String attendanceTime;
/** 考勤日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "考勤日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date attendanceDate;
/** 工作时长 */
@Excel(name = "工作时长")
private Long workHours;
/** 岗位 */
@Excel(name = "岗位")
private String post;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setAttendanceStatus(String attendanceStatus)
{
this.attendanceStatus = attendanceStatus;
}
public String getAttendanceStatus()
{
return attendanceStatus;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setAge(Long age)
{
this.age = age;
}
public Long getAge()
{
return age;
}
public void setIdNumber(String idNumber)
{
this.idNumber = idNumber;
}
public String getIdNumber()
{
return idNumber;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setStartAddr(String startAddr)
{
this.startAddr = startAddr;
}
public String getStartAddr()
{
return startAddr;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setEndAddr(String endAddr)
{
this.endAddr = endAddr;
}
public String getEndAddr()
{
return endAddr;
}
public void setAttendanceTime(String attendanceTime)
{
this.attendanceTime = attendanceTime;
}
public String getAttendanceTime()
{
return attendanceTime;
}
public void setAttendanceDate(Date attendanceDate)
{
this.attendanceDate = attendanceDate;
}
public Date getAttendanceDate()
{
return attendanceDate;
}
public void setWorkHours(Long workHours)
{
this.workHours = workHours;
}
public Long getWorkHours()
{
return workHours;
}
public void setPost(String post)
{
this.post = post;
}
public String getPost()
{
return post;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("userName", getUserName())
.append("attendanceStatus", getAttendanceStatus())
.append("sex", getSex())
.append("age", getAge())
.append("idNumber", getIdNumber())
.append("startTime", getStartTime())
.append("startAddr", getStartAddr())
.append("endTime", getEndTime())
.append("endAddr", getEndAddr())
.append("attendanceTime", getAttendanceTime())
.append("attendanceDate", getAttendanceDate())
.append("workHours", getWorkHours())
.append("createTime", getCreateTime())
.append("post", getPost())
.toString();
}
}

@ -0,0 +1,61 @@
package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesAttendanceRecords;
/**
* MESMapper
*
* @author Yangwl
* @date 2025-02-19
*/
public interface MesAttendanceRecordsMapper
{
/**
* MES
*
* @param id MES
* @return MES
*/
public MesAttendanceRecords selectMesAttendanceRecordsById(String id);
/**
* MES
*
* @param mesAttendanceRecords MES
* @return MES
*/
public List<MesAttendanceRecords> selectMesAttendanceRecordsList(MesAttendanceRecords mesAttendanceRecords);
/**
* MES
*
* @param mesAttendanceRecords MES
* @return
*/
public int insertMesAttendanceRecords(MesAttendanceRecords mesAttendanceRecords);
/**
* MES
*
* @param mesAttendanceRecords MES
* @return
*/
public int updateMesAttendanceRecords(MesAttendanceRecords mesAttendanceRecords);
/**
* MES
*
* @param id MES
* @return
*/
public int deleteMesAttendanceRecordsById(String id);
/**
* MES
*
* @param ids
* @return
*/
public int deleteMesAttendanceRecordsByIds(String[] ids);
}

@ -238,4 +238,7 @@ public interface MesReportWorkMapper {
List<MesHourReport> getCXJEquNames(MesHourReport mesHourReport);
int updateReportWorkW3(MesReportWork mesReportWork);
List<ConsumptionDiff> getReportWorksList(ConsumptionDiff consumptionDiff);
}

@ -0,0 +1,61 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesAttendanceRecords;
/**
* MESService
*
* @author Yangwl
* @date 2025-02-19
*/
public interface IMesAttendanceRecordsService
{
/**
* MES
*
* @param id MES
* @return MES
*/
public MesAttendanceRecords selectMesAttendanceRecordsById(String id);
/**
* MES
*
* @param mesAttendanceRecords MES
* @return MES
*/
public List<MesAttendanceRecords> selectMesAttendanceRecordsList(MesAttendanceRecords mesAttendanceRecords);
/**
* MES
*
* @param mesAttendanceRecords MES
* @return
*/
public int insertMesAttendanceRecords(MesAttendanceRecords mesAttendanceRecords);
/**
* MES
*
* @param mesAttendanceRecords MES
* @return
*/
public int updateMesAttendanceRecords(MesAttendanceRecords mesAttendanceRecords);
/**
* MES
*
* @param ids MES
* @return
*/
public int deleteMesAttendanceRecordsByIds(String[] ids);
/**
* MES
*
* @param id MES
* @return
*/
public int deleteMesAttendanceRecordsById(String id);
}

@ -1,6 +1,7 @@
package com.op.mes.service;
import com.op.common.core.domain.R;
import com.op.mes.domain.ConsumptionDiff;
import com.op.mes.domain.HFProduction;
import com.op.mes.domain.MesProductTrace;
import com.op.mes.domain.MesReportWork;
@ -11,7 +12,7 @@ import java.util.Map;
public interface IMesReportWorksService {
List<MesReportWork> getReportWorksList(MesReportWork mesReportWork);
List<ConsumptionDiff> getReportWorksList(ConsumptionDiff consumptionDiff);
R mesProTask();

@ -30,7 +30,7 @@ public class H5ApiServiceImpl implements H5ApiService {
public List<H5> dailyProductDetil(String workTime) {
//查询当天的生产情况
H5 h5=new H5();
h5.setFeedbackTime(workTime);
h5.setFeedbackTime("2025-03-05");
//报工信息
List<H5> h5List=h5ApiMapper.selectMesLineProdceList(h5);
//报工信息处理
@ -73,6 +73,7 @@ public class H5ApiServiceImpl implements H5ApiService {
resultH5.setPlanProduction((int) Math.round(totalPlanProduction)); // 总和
resultH5.setProduction((int) Math.round(totalProduction)); // 总和
resultH5.setReason(list.get(0).getReason());
resultH5.setShift(list.get(0).getShift());
return resultH5;
}
)

@ -0,0 +1,98 @@
package com.op.mes.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesAttendanceRecordsMapper;
import com.op.mes.domain.MesAttendanceRecords;
import com.op.mes.service.IMesAttendanceRecordsService;
/**
* MESService
*
* @author Yangwl
* @date 2025-02-19
*/
@Service
public class MesAttendanceRecordsServiceImpl implements IMesAttendanceRecordsService
{
@Autowired
private MesAttendanceRecordsMapper mesAttendanceRecordsMapper;
/**
* MES
*
* @param id MES
* @return MES
*/
@Override
public MesAttendanceRecords selectMesAttendanceRecordsById(String id)
{
return mesAttendanceRecordsMapper.selectMesAttendanceRecordsById(id);
}
/**
* MES
*
* @param mesAttendanceRecords MES
* @return MES
*/
@Override
@DS("#header.poolName")
public List<MesAttendanceRecords> selectMesAttendanceRecordsList(MesAttendanceRecords mesAttendanceRecords)
{
return mesAttendanceRecordsMapper.selectMesAttendanceRecordsList(mesAttendanceRecords);
}
/**
* MES
*
* @param mesAttendanceRecords MES
* @return
*/
@Override
public int insertMesAttendanceRecords(MesAttendanceRecords mesAttendanceRecords)
{
mesAttendanceRecords.setCreateTime(DateUtils.getNowDate());
return mesAttendanceRecordsMapper.insertMesAttendanceRecords(mesAttendanceRecords);
}
/**
* MES
*
* @param mesAttendanceRecords MES
* @return
*/
@Override
public int updateMesAttendanceRecords(MesAttendanceRecords mesAttendanceRecords)
{
return mesAttendanceRecordsMapper.updateMesAttendanceRecords(mesAttendanceRecords);
}
/**
* MES
*
* @param ids MES
* @return
*/
@Override
public int deleteMesAttendanceRecordsByIds(String[] ids)
{
return mesAttendanceRecordsMapper.deleteMesAttendanceRecordsByIds(ids);
}
/**
* MES
*
* @param id MES
* @return
*/
@Override
public int deleteMesAttendanceRecordsById(String id)
{
return mesAttendanceRecordsMapper.deleteMesAttendanceRecordsById(id);
}
}

@ -54,8 +54,16 @@ public class MesReportWorksServiceImpl implements IMesReportWorksService {
@Override
@DS("#header.poolName")
public List<MesReportWork> getReportWorksList(MesReportWork mesReportWork) {
return null;//mesReportWorksMapper.getReportWorkList(mesReportWork);
public List<ConsumptionDiff> getReportWorksList(ConsumptionDiff consumptionDiff) {
List<ConsumptionDiff> consumptionDiffList = mesReportWorkMapper.getReportWorksList(consumptionDiff);
// for (ConsumptionDiff consumption:consumptionDiffList){
// if (consumption.getParentOrder().equals("0")){
// consumption.setShould();
// }
// }
return consumptionDiffList;
}
@Override

@ -19,6 +19,7 @@
<result property="actualEfficiency" column="actualEfficiency"/>
<result property="efficiencyAcRate" column="efficiencyAcRate"/>
<result property="reason" column="reason"/>
<result property="shift" column="shift"/>
</resultMap>
<select id="selectMesLineProdceList" parameterType="H5" resultMap="H5Result">
SELECT
@ -35,15 +36,16 @@ SELECT
CAST(ROUND(mlp.efficiency / NULLIF(mlp.attr1, 0) / NULLIF(mlp.use_man, 0), 1) AS FLOAT) AS standardEfficiency,
CAST(ROUND(mrws.quantity_feedback / NULLIF(mrws.work_time, 0) / NULLIF(mrws.use_man, 0), 1) AS FLOAT) AS actualEfficiency,
mrws.parent_order,
mrws.remark as reason
mrws.remark as reason,bst.Shift_Desc AS shift
FROM
[dbo].[mes_report_work] mrws
LEFT JOIN pro_order_workorder pow ON mrws.workorder_code = pow.workorder_code
LEFT JOIN base_product_attached bpa ON bpa.product_code = RIGHT(mrws.product_code, 11)
LEFT JOIN base_product bp ON bp.product_code = mrws.product_code
LEFT JOIN mes_line_product mlp ON mlp.product_code = mrws.product_code AND mlp.line_code = mrws.machine_code
LEFT JOIN base_shifts_t bst ON bst.Shift_Id=mrws.shift_code
WHERE
CAST(mrws.feedback_time AS DATE) = #{feedbackTime}
CAST(pow.product_date AS DATE) = #{feedbackTime}
AND mrws.del_flag = '0'
ORDER BY mrws.machine_name ASC;
</select>

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.mes.mapper.MesAttendanceRecordsMapper">
<resultMap type="MesAttendanceRecords" id="MesAttendanceRecordsResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="attendanceStatus" column="attendance_status" />
<result property="sex" column="sex" />
<result property="age" column="age" />
<result property="idNumber" column="id_number" />
<result property="startTime" column="start_time" />
<result property="startAddr" column="start_addr" />
<result property="endTime" column="end_time" />
<result property="endAddr" column="end_addr" />
<result property="attendanceTime" column="attendance_time" />
<result property="attendanceDate" column="attendance_date" />
<result property="workHours" column="work_hours" />
<result property="createTime" column="create_time" />
<result property="post" column="post" />
</resultMap>
<sql id="selectMesAttendanceRecordsVo">
select id, user_id, user_name, attendance_status, sex, age, id_number, start_time, start_addr, end_time, end_addr, attendance_time, attendance_date, work_hours, create_time, post from mes_attendance_records
</sql>
<select id="selectMesAttendanceRecordsList" parameterType="MesAttendanceRecords" resultMap="MesAttendanceRecordsResult">
<include refid="selectMesAttendanceRecordsVo"/>
<where>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="attendanceStatus != null and attendanceStatus != ''"> and attendance_status = #{attendanceStatus}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="attendanceTime != null and attendanceTime != ''"> and attendance_time = #{attendanceTime}</if>
<if test="post != null and post != ''"> and post = #{post}</if>
</where>
ORDER BY attendance_date DESC, start_addr ASC;
</select>
<select id="selectMesAttendanceRecordsById" parameterType="String" resultMap="MesAttendanceRecordsResult">
<include refid="selectMesAttendanceRecordsVo"/>
where id = #{id}
</select>
<insert id="insertMesAttendanceRecords" parameterType="MesAttendanceRecords">
insert into mes_attendance_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="attendanceStatus != null">attendance_status,</if>
<if test="sex != null">sex,</if>
<if test="age != null">age,</if>
<if test="idNumber != null">id_number,</if>
<if test="startTime != null">start_time,</if>
<if test="startAddr != null">start_addr,</if>
<if test="endTime != null">end_time,</if>
<if test="endAddr != null">end_addr,</if>
<if test="attendanceTime != null">attendance_time,</if>
<if test="attendanceDate != null">attendance_date,</if>
<if test="workHours != null">work_hours,</if>
<if test="createTime != null">create_time,</if>
<if test="post != null">post,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="attendanceStatus != null">#{attendanceStatus},</if>
<if test="sex != null">#{sex},</if>
<if test="age != null">#{age},</if>
<if test="idNumber != null">#{idNumber},</if>
<if test="startTime != null">#{startTime},</if>
<if test="startAddr != null">#{startAddr},</if>
<if test="endTime != null">#{endTime},</if>
<if test="endAddr != null">#{endAddr},</if>
<if test="attendanceTime != null">#{attendanceTime},</if>
<if test="attendanceDate != null">#{attendanceDate},</if>
<if test="workHours != null">#{workHours},</if>
<if test="createTime != null">#{createTime},</if>
<if test="post != null">#{post},</if>
</trim>
</insert>
<update id="updateMesAttendanceRecords" parameterType="MesAttendanceRecords">
update mes_attendance_records
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="attendanceStatus != null">attendance_status = #{attendanceStatus},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="age != null">age = #{age},</if>
<if test="idNumber != null">id_number = #{idNumber},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="startAddr != null">start_addr = #{startAddr},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="endAddr != null">end_addr = #{endAddr},</if>
<if test="attendanceTime != null">attendance_time = #{attendanceTime},</if>
<if test="attendanceDate != null">attendance_date = #{attendanceDate},</if>
<if test="workHours != null">work_hours = #{workHours},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="post != null">post = #{post},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMesAttendanceRecordsById" parameterType="String">
delete from mes_attendance_records where id = #{id}
</delete>
<delete id="deleteMesAttendanceRecordsByIds" parameterType="String">
delete from mes_attendance_records where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -1427,6 +1427,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
equ.equipment_name
order by equ.equipment_name
</select>
<resultMap type="ConsumptionDiff" id="ConsumptionDiff">
<result property="parentOrder" column="parent_order" />
<result property="workorderCodeSap" column="workorder_code_sap" />
<result property="workorderCode" column="workorder_code" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="unit" column="unit" />
<result property="atrr2" column="atrr2" />
<result property="productDate" column="product_date" />
<result property="orderQuantity" column="order_quantity" />
<result property="quantityFeedback" column="quantity_feedback" />
<result property="planNumber" column="planNumber" />
<result property="proNumber" column="proNumber" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="quantity" column="quantity" />
<result property="recoil" column="recoil" />
<result property="standar" column="standar" />
<result property="erfme" column="erfme" />
<result property="should" column="should" />
</resultMap>
<select id="getReportWorksList" resultMap="ConsumptionDiff">
SELECT
A.workorder_code,
B.workorder_code_sap,
B.quantity_split AS order_quantity,
E.quantity_feedback,
A.material_code,
A.material_name,
A.quantity,
C.erfmg AS standar,
C.erfme,
A.recoil,
A.del_flag,
B.product_date,
CAST(ROUND(C.erfmg * (E.quantity_feedback/B.quantity_split), 2) AS DECIMAL(18,2)) AS should
FROM
mes_report_work_consume A
LEFT JOIN (SELECT workorder_code_sap,workorder_code,product_date,SUM(quantity_split) AS quantity_split FROM pro_order_workorder GROUP BY workorder_code_sap,workorder_code,product_date) B ON A.workorder_code=B.workorder_code AND B.workorder_code_sap is not null
LEFT JOIN ( SELECT workorder_code, SUM ( quantity ) AS quantity, SUM ( quantity_feedback ) AS quantity_feedback FROM mes_report_work GROUP BY workorder_code ) E ON E.workorder_code= B.workorder_code
JOIN (
SELECT
mp.workorder_code,
material_code,
material_name,
erfmg,
erfme
FROM
mes_prepare mp
LEFT JOIN mes_prepare_detail mpd ON mpd.prepare_id= mp.prepare_id
) C ON C.workorder_code= A.workorder_code AND C.material_code= A.material_code
<where>
and A.del_flag='0'
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and CONVERT(varchar(30),B.product_date, 120) >= CONVERT(varchar(30),#{params.beginTime}, 120)
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and CONVERT(varchar(30),B.product_date, 120) &lt;= CONVERT(varchar(30),#{params.endTime}, 120)
</if>
<if test="workorderCodeSap != null and workorderCodeSap != ''">
AND B.workorder_code_sap like concat('%', #{workorderCodeSap}, '%') OR A.material_code like concat('%', #{workorderCodeSap}, '%')
</if>
</where>
ORDER BY B.product_date DESC
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save