Merge remote-tracking branch 'origin/master'

master
陈恒杰 1 year ago
commit 2113fc5927

@ -11,7 +11,7 @@ import java.util.Date;
public class ReportOrderEnergyDTO extends BaseEntity {
private String workorderId;
@Excel(name = "单号")
@Excel(name = "单号")
private String workorderCode;
@Excel(name = "产线编码")
private String workorderName;
@ -19,8 +19,14 @@ public class ReportOrderEnergyDTO extends BaseEntity {
private String equipmentName;
@Excel(name = "产品编码")
private String productCode;
@Excel(name = "品类")
private String category;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "产线组长")
private String lineLeader;
@Excel(name = "规格")
private int umrez;
@Excel(name = "生产数量(箱)")
private int totalQuantityFeedback;
@Excel(name = "电表编号")
@ -66,6 +72,40 @@ public class ReportOrderEnergyDTO extends BaseEntity {
}
@Excel(name = "能耗KW·h")
private BigDecimal kw;
@Excel(name = "单箱电耗(电量/产能)")
private BigDecimal singleKw;
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getLineLeader() {
return lineLeader;
}
public void setLineLeader(String lineLeader) {
this.lineLeader = lineLeader;
}
public int getUmrez() {
return umrez;
}
public void setUmrez(int umrez) {
this.umrez = umrez;
}
public BigDecimal getSingleKw() {
return singleKw;
}
public void setSingleKw(BigDecimal singleKw) {
this.singleKw = singleKw;
}
public BigDecimal getKw() {
return kw;

@ -1037,6 +1037,9 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
reportOrderEnergyDTOList.get(i).setEndKW(recordDnbInstantList.get(1).getZxyg());
reportOrderEnergyDTOList.get(i).setMultiplier(recordDnbInstantList.get(0).getCt());
reportOrderEnergyDTOList.get(i).setKw(kw);
BigDecimal totalQuantityFeedbackBD = new BigDecimal(reportOrderEnergyDTOList.get(i).getTotalQuantityFeedback());
reportOrderEnergyDTOList.get(i).setSingleKw(kw.divide(totalQuantityFeedbackBD, BigDecimal.ROUND_HALF_UP));
}
}
}

@ -55,6 +55,9 @@
<result property="productCode" column="product_code"/>
<result property="productDate" column="product_date"/>
<result property="productName" column="product_name"/>
<result property="umrez" column="umrez"/>
<result property="category" column="category"/>
<result property="lineLeader" column="line_leader"/>
<result property="totalQuantityFeedback" column="total_quantity_feedback"/>
<result property="electricityNo" column="electricity_no"/>
<result property="startWorkTime" column="start_work_time"/>
@ -261,29 +264,26 @@
order by m.parentName, m.monitor_name
</select>
<select id="OrderEnergyList" resultMap="ReportOrderEnergyDTOResult">
SELECT
pow.workorder_code_sap as workorder_code,
pow.workorder_name,
be.equipment_name,
pow.product_code,
pow.product_date,
pow.product_name,
mrw_summary.total_quantity_feedback,
pow.start_work_time,
pow.end_work_time,
be.attr2 AS electricity_no
FROM
pro_order_workorder pow
LEFT JOIN base_equipment be ON pow.workorder_name = be.equipment_code
LEFT JOIN (
SELECT
workorder_code,
SUM(quantity_feedback) AS total_quantity_feedback
FROM
mes_report_work
GROUP BY
workorder_code
) mrw_summary ON pow.workorder_code = mrw_summary.workorder_code
SELECT
pow.workorder_code_sap AS workorder_code,
pow.workorder_name,
be.equipment_name,
RIGHT ( pow.product_code, 11 ) AS product_code,
pow.product_date,
pow.product_name,
bp.umrez,
bpa.category,
mrw_summary.total_quantity_feedback,
mrw_summary.create_by as line_leader,
pow.start_work_time,
pow.end_work_time,
be.attr2 AS electricity_no
FROM
pro_order_workorder pow
LEFT JOIN base_equipment be ON pow.workorder_name = be.equipment_code
LEFT JOIN ( SELECT workorder_code, create_by, SUM ( quantity_feedback ) AS total_quantity_feedback FROM mes_report_work GROUP BY workorder_code, create_by ) mrw_summary ON pow.workorder_code = mrw_summary.workorder_code
LEFT JOIN base_product_attached bpa ON bpa.product_code = RIGHT ( pow.product_code, 11 )
LEFT JOIN base_product bp ON bp.product_code = pow.product_code
<where>
<if test="electricityNo != null and electricityNo != ''">and be.attr2 = #{electricityNo}</if>
<if test="workorderName != null and workorderName != ''">and pow.workorder_name like concat('%', #{workorderName}, '%')</if>
@ -292,7 +292,7 @@
and pow.product_date between #{params.beginTime} and #{params.endTime}
</if>
AND pow.status = 'w3'
AND pow.parent_order = '0';
AND pow.parent_order = '0'
</where>
</select>

@ -32,5 +32,4 @@ public class H5ApiController {
List<H5> list = h5ApiService.dailyProductDetil(workTime);
return list;
}
}

@ -0,0 +1,110 @@
package com.op.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.system.api.domain.SysDictType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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 com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.MesBox;
import com.op.mes.service.IMesBoxService;
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;
/**
* Controller
*
* @author Open Platform
* @date 2024-08-20
*/
@RestController
@RequestMapping("/mesBox")
public class MesBoxController extends BaseController {
@Autowired
private IMesBoxService mesBoxService;
/**
*
*/
@RequiresPermissions("mes:mesBox:list")
@GetMapping("/list")
public TableDataInfo list(MesBox mesBox) {
startPage();
List<MesBox> list = mesBoxService.selectMesBoxList(mesBox);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:mesBox:export")
@Log(title = "箱体类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesBox mesBox) {
List<MesBox> list = mesBoxService.selectMesBoxList(mesBox);
ExcelUtil<MesBox> util = new ExcelUtil<MesBox>(MesBox. class);
util.exportExcel(response, list, "箱体类型数据");
}
/**
*
*/
@RequiresPermissions("mes:mesBox:query")
@GetMapping(value = "/{boxId}")
public AjaxResult getInfo(@PathVariable("boxId") Long boxId) {
return success(mesBoxService.selectMesBoxByBoxId(boxId));
}
/**
*
*/
@RequiresPermissions("mes:mesBox:add")
@Log(title = "箱体类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesBox mesBox) {
return toAjax(mesBoxService.insertMesBox(mesBox));
}
/**
*
*/
@RequiresPermissions("mes:mesBox:edit")
@Log(title = "箱体类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesBox mesBox) {
return toAjax(mesBoxService.updateMesBox(mesBox));
}
/**
*
*/
@RequiresPermissions("mes:mesBox:remove")
@Log(title = "箱体类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{boxIds}")
public AjaxResult remove(@PathVariable Long[] boxIds) {
return toAjax(mesBoxService.deleteMesBoxByBoxIds(boxIds));
}
/**
*
*/
@GetMapping("/optionSelect")
@DS("#header.poolName")
public AjaxResult optionSelect() {
List<MesBox> boxTypes = mesBoxService.selectDictTypeAll();
return success(boxTypes);
}
}

@ -0,0 +1,115 @@
package com.op.mes.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.StringUtils;
import com.op.system.api.domain.SysDictData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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 com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.MesBoxDetail;
import com.op.mes.service.IMesBoxDetailService;
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;
/**
* Controller
*
* @author Open Platform
* @date 2024-08-20
*/
@RestController
@RequestMapping("/mesBoxDetail")
public class MesBoxDetailController extends BaseController {
@Autowired
private IMesBoxDetailService mesBoxDetailService;
/**
*
*/
@RequiresPermissions("mes:mesBoxDetail:list")
@GetMapping("/list")
public TableDataInfo list(MesBoxDetail mesBoxDetail) {
startPage();
List<MesBoxDetail> list = mesBoxDetailService.selectMesBoxDetailList(mesBoxDetail);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:mesBoxDetail:export")
@Log(title = "箱体数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesBoxDetail mesBoxDetail) {
List<MesBoxDetail> list = mesBoxDetailService.selectMesBoxDetailList(mesBoxDetail);
ExcelUtil<MesBoxDetail> util = new ExcelUtil<MesBoxDetail>(MesBoxDetail. class);
util.exportExcel(response, list, "箱体数据数据");
}
/**
*
*/
@RequiresPermissions("mes:mesBoxDetail:query")
@GetMapping(value = "/{boxCode}")
public AjaxResult getInfo(@PathVariable("boxCode") Long boxCode) {
return success(mesBoxDetailService.selectMesBoxDetailByBoxCode(boxCode));
}
/**
*
*/
@GetMapping(value = "/type/{boxType}")
@DS("#header.poolName")
public AjaxResult dictType(@PathVariable String boxType) {
List<SysDictData> data = mesBoxDetailService.selectBoxDataByType(boxType);
if (StringUtils.isNull(data)) {
data = new ArrayList<SysDictData>();
}
return success(data);
}
/**
*
*/
@RequiresPermissions("mes:mesBoxDetail:add")
@Log(title = "箱体数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesBoxDetail mesBoxDetail) {
return toAjax(mesBoxDetailService.insertMesBoxDetail(mesBoxDetail));
}
/**
*
*/
@RequiresPermissions("mes:mesBoxDetail:edit")
@Log(title = "箱体数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesBoxDetail mesBoxDetail) {
return toAjax(mesBoxDetailService.updateMesBoxDetail(mesBoxDetail));
}
/**
*
*/
@RequiresPermissions("mes:mesBoxDetail:remove")
@Log(title = "箱体数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{boxCodes}")
public AjaxResult remove(@PathVariable Long[] boxCodes) {
return toAjax(mesBoxDetailService.deleteMesBoxDetailByBoxCodes(boxCodes));
}
}

@ -6,8 +6,8 @@ public class H5 {
private String productName;
private String category;
private String specifications;
private String StandardStaffing;
private String actualEmployment;
private int StandardStaffing;
private int actualEmployment;
private String productionDuration;
private int planProduction;
private int production;
@ -83,19 +83,19 @@ public class H5 {
this.specifications = specifications;
}
public String getStandardStaffing() {
public int getStandardStaffing() {
return StandardStaffing;
}
public void setStandardStaffing(String standardStaffing) {
public void setStandardStaffing(int standardStaffing) {
StandardStaffing = standardStaffing;
}
public String getActualEmployment() {
public int getActualEmployment() {
return actualEmployment;
}
public void setActualEmployment(String actualEmployment) {
public void setActualEmployment(int actualEmployment) {
this.actualEmployment = actualEmployment;
}

@ -0,0 +1,75 @@
package com.op.mes.domain;
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;
/**
* mes_box
*
* @author Open Platform
* @date 2024-08-20
*/
public class MesBox extends BaseEntity {
private static final long serialVersionUID=1L;
/** 字典主键 */
private Long boxId;
/** 字典名称 */
@Excel(name = "字典名称")
private String boxName;
/** 字典类型 */
@Excel(name = "字典类型")
private String boxType;
/** 状态0正常 */
@Excel(name = "状态", readConverterExp = "状态0正常")
private String status;
public void setBoxId(Long boxId){
this.boxId = boxId;
}
public Long getBoxId(){
return boxId;
}
public void setBoxName(String boxName){
this.boxName = boxName;
}
public String getBoxName(){
return boxName;
}
public void setBoxType(String boxType){
this.boxType = boxType;
}
public String getBoxType(){
return boxType;
}
public void setStatus(String status){
this.status = status;
}
public String getStatus(){
return status;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("boxId",getBoxId())
.append("boxName",getBoxName())
.append("boxType",getBoxType())
.append("status",getStatus())
.append("createBy",getCreateBy())
.append("createTime",getCreateTime())
.append("updateBy",getUpdateBy())
.append("updateTime",getUpdateTime())
.append("remark",getRemark())
.toString();
}
}

@ -0,0 +1,176 @@
package com.op.mes.domain;
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;
/**
* mes_box_detail
*
* @author Open Platform
* @date 2024-08-20
*/
public class MesBoxDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long boxCode;
/**
*
*/
@Excel(name = "箱型排序")
private Long boxSort;
/**
*
*/
@Excel(name = "箱型标签")
private String boxLabel;
/**
*
*/
@Excel(name = "箱型关键字")
private String boxKey;
/**
*
*/
@Excel(name = "箱型值")
private String boxValue;
/**
*
*/
@Excel(name = "箱型类型")
private String boxType;
/**
*
*/
@Excel(name = "样式属性", readConverterExp = "其=他样式扩展")
private String cssClass;
/**
*
*/
@Excel(name = "表格回显样式")
private String listClass;
/**
* Y
*/
@Excel(name = "是否默认", readConverterExp = "是否默认Y是")
private String isDefault;
/**
* 0
*/
@Excel(name = "状态", readConverterExp = "状态0正常")
private String status;
public void setBoxCode(Long boxCode) {
this.boxCode = boxCode;
}
public Long getBoxCode() {
return boxCode;
}
public void setBoxSort(Long boxSort) {
this.boxSort = boxSort;
}
public Long getBoxSort() {
return boxSort;
}
public void setBoxLabel(String boxLabel) {
this.boxLabel = boxLabel;
}
public String getBoxLabel() {
return boxLabel;
}
public String getBoxKey() {
return boxKey;
}
public void setBoxKey(String boxKey) {
this.boxKey = boxKey;
}
public void setBoxValue(String boxValue) {
this.boxValue = boxValue;
}
public String getBoxValue() {
return boxValue;
}
public void setBoxType(String boxType) {
this.boxType = boxType;
}
public String getBoxType() {
return boxType;
}
public void setCssClass(String cssClass) {
this.cssClass = cssClass;
}
public String getCssClass() {
return cssClass;
}
public void setListClass(String listClass) {
this.listClass = listClass;
}
public String getListClass() {
return listClass;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsDefault() {
return isDefault;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("boxCode", getBoxCode())
.append("boxSort", getBoxSort())
.append("boxLabel", getBoxLabel())
.append("boxValue", getBoxValue())
.append("boxType", getBoxType())
.append("cssClass", getCssClass())
.append("listClass", getListClass())
.append("isDefault", getIsDefault())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,61 @@
package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesBoxDetail;
/**
* Mapper
*
* @author Open Platform
* @date 2024-08-20
*/
public interface MesBoxDetailMapper {
/**
*
*
* @param boxCode
* @return
*/
public MesBoxDetail selectMesBoxDetailByBoxCode(Long boxCode);
/**
*
*
* @param mesBoxDetail
* @return
*/
public List<MesBoxDetail> selectMesBoxDetailList(MesBoxDetail mesBoxDetail);
/**
*
*
* @param mesBoxDetail
* @return
*/
public int insertMesBoxDetail(MesBoxDetail mesBoxDetail);
/**
*
*
* @param mesBoxDetail
* @return
*/
public int updateMesBoxDetail(MesBoxDetail mesBoxDetail);
/**
*
*
* @param boxCode
* @return
*/
public int deleteMesBoxDetailByBoxCode(Long boxCode);
/**
*
*
* @param boxCodes
* @return
*/
public int deleteMesBoxDetailByBoxCodes(Long[] boxCodes);
}

@ -0,0 +1,63 @@
package com.op.mes.mapper;
import java.util.List;
import com.op.mes.domain.MesBox;
/**
* Mapper
*
* @author Open Platform
* @date 2024-08-20
*/
public interface MesBoxMapper {
/**
*
*
* @param boxId
* @return
*/
public MesBox selectMesBoxByBoxId(Long boxId);
/**
*
*
* @param mesBox
* @return
*/
public List<MesBox> selectMesBoxList(MesBox mesBox);
/**
*
*
* @param mesBox
* @return
*/
public int insertMesBox(MesBox mesBox);
/**
*
*
* @param mesBox
* @return
*/
public int updateMesBox(MesBox mesBox);
/**
*
*
* @param boxId
* @return
*/
public int deleteMesBoxByBoxId(Long boxId);
/**
*
*
* @param boxIds
* @return
*/
public int deleteMesBoxByBoxIds(Long[] boxIds);
List<MesBox> selectDictTypeAll();
}

@ -0,0 +1,64 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesBoxDetail;
import com.op.system.api.domain.SysDictData;
/**
* Service
*
* @author Open Platform
* @date 2024-08-20
*/
public interface IMesBoxDetailService {
/**
*
*
* @param boxCode
* @return
*/
public MesBoxDetail selectMesBoxDetailByBoxCode(Long boxCode);
/**
*
*
* @param mesBoxDetail
* @return
*/
public List<MesBoxDetail> selectMesBoxDetailList(MesBoxDetail mesBoxDetail);
/**
*
*
* @param mesBoxDetail
* @return
*/
public int insertMesBoxDetail(MesBoxDetail mesBoxDetail);
/**
*
*
* @param mesBoxDetail
* @return
*/
public int updateMesBoxDetail(MesBoxDetail mesBoxDetail);
/**
*
*
* @param boxCodes
* @return
*/
public int deleteMesBoxDetailByBoxCodes(Long[] boxCodes);
/**
*
*
* @param boxCode
* @return
*/
public int deleteMesBoxDetailByBoxCode(Long boxCode);
List<SysDictData> selectBoxDataByType(String boxType);
}

@ -0,0 +1,63 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesBox;
/**
* Service
*
* @author Open Platform
* @date 2024-08-20
*/
public interface IMesBoxService {
/**
*
*
* @param boxId
* @return
*/
public MesBox selectMesBoxByBoxId(Long boxId);
/**
*
*
* @param mesBox
* @return
*/
public List<MesBox> selectMesBoxList(MesBox mesBox);
/**
*
*
* @param mesBox
* @return
*/
public int insertMesBox(MesBox mesBox);
/**
*
*
* @param mesBox
* @return
*/
public int updateMesBox(MesBox mesBox);
/**
*
*
* @param boxIds
* @return
*/
public int deleteMesBoxByBoxIds(Long[] boxIds);
/**
*
*
* @param boxId
* @return
*/
public int deleteMesBoxByBoxId(Long boxId);
List<MesBox> selectDictTypeAll();
}

@ -0,0 +1,106 @@
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 com.op.common.security.utils.SecurityUtils;
import com.op.system.api.domain.SysDictData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesBoxDetailMapper;
import com.op.mes.domain.MesBoxDetail;
import com.op.mes.service.IMesBoxDetailService;
/**
* Service
*
* @author Open Platform
* @date 2024-08-20
*/
@Service
public class MesBoxDetailServiceImpl implements IMesBoxDetailService {
@Autowired
private MesBoxDetailMapper mesBoxDetailMapper;
/**
*
*
* @param boxCode
* @return
*/
@Override
@DS("#header.poolName")
public MesBoxDetail selectMesBoxDetailByBoxCode(Long boxCode) {
return mesBoxDetailMapper.selectMesBoxDetailByBoxCode(boxCode);
}
/**
*
*
* @param mesBoxDetail
* @return
*/
@Override
@DS("#header.poolName")
public List<MesBoxDetail> selectMesBoxDetailList(MesBoxDetail mesBoxDetail) {
return mesBoxDetailMapper.selectMesBoxDetailList(mesBoxDetail);
}
/**
*
*
* @param mesBoxDetail
* @return
*/
@Override
@DS("#header.poolName")
public int insertMesBoxDetail(MesBoxDetail mesBoxDetail) {
mesBoxDetail.setCreateBy(SecurityUtils.getUsername());
mesBoxDetail.setCreateTime(DateUtils.getNowDate());
return mesBoxDetailMapper.insertMesBoxDetail(mesBoxDetail);
}
/**
*
*
* @param mesBoxDetail
* @return
*/
@Override
@DS("#header.poolName")
public int updateMesBoxDetail(MesBoxDetail mesBoxDetail) {
mesBoxDetail.setUpdateBy(SecurityUtils.getUsername());
mesBoxDetail.setUpdateTime(DateUtils.getNowDate());
return mesBoxDetailMapper.updateMesBoxDetail(mesBoxDetail);
}
/**
*
*
* @param boxCodes
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesBoxDetailByBoxCodes(Long[] boxCodes) {
return mesBoxDetailMapper.deleteMesBoxDetailByBoxCodes(boxCodes);
}
/**
*
*
* @param boxCode
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesBoxDetailByBoxCode(Long boxCode) {
return mesBoxDetailMapper.deleteMesBoxDetailByBoxCode(boxCode);
}
@Override
public List<SysDictData> selectBoxDataByType(String boxType) {
return null;
}
}

@ -0,0 +1,106 @@
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 com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesBoxMapper;
import com.op.mes.domain.MesBox;
import com.op.mes.service.IMesBoxService;
/**
* Service
*
* @author Open Platform
* @date 2024-08-20
*/
@Service
public class MesBoxServiceImpl implements IMesBoxService {
@Autowired
private MesBoxMapper mesBoxMapper;
/**
*
*
* @param boxId
* @return
*/
@Override
@DS("#header.poolName")
public MesBox selectMesBoxByBoxId(Long boxId) {
return mesBoxMapper.selectMesBoxByBoxId(boxId);
}
/**
*
*
* @param mesBox
* @return
*/
@Override
@DS("#header.poolName")
public List<MesBox> selectMesBoxList(MesBox mesBox) {
return mesBoxMapper.selectMesBoxList(mesBox);
}
/**
*
*
* @param mesBox
* @return
*/
@Override
@DS("#header.poolName")
public int insertMesBox(MesBox mesBox) {
mesBox.setUpdateBy(SecurityUtils.getUsername());
mesBox.setCreateTime(DateUtils.getNowDate());
return mesBoxMapper.insertMesBox(mesBox);
}
/**
*
*
* @param mesBox
* @return
*/
@Override
@DS("#header.poolName")
public int updateMesBox(MesBox mesBox) {
mesBox.setUpdateBy(SecurityUtils.getUsername());
mesBox.setUpdateTime(DateUtils.getNowDate());
return mesBoxMapper.updateMesBox(mesBox);
}
/**
*
*
* @param boxIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesBoxByBoxIds(Long[] boxIds) {
return mesBoxMapper.deleteMesBoxByBoxIds(boxIds);
}
/**
*
*
* @param boxId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesBoxByBoxId(Long boxId) {
return mesBoxMapper.deleteMesBoxByBoxId(boxId);
}
@Override
@DS("#header.poolName")
public List<MesBox> selectDictTypeAll() {
return mesBoxMapper.selectDictTypeAll();
}
}

@ -33,14 +33,14 @@
MAX(A.quantity_s_total) AS quantity_s_total,
bpa.man_standar,
MAX(A.use_man) AS use_man,
SUM(A.work_time) AS work_time,
FORMAT(ROUND((MAX(A.work_time)), 1), '0.#') AS work_time,
mrw.parent_order ,
bpa.iei,
FORMAT(ROUND((bpa.iei / bp.umrez / bpa.man_standar), 1), '0.#') AS standardEfficiency,
FORMAT(ROUND(
CASE
WHEN MAX(A.use_man) = 0 OR SUM(A.work_time) = 0 THEN NULL
ELSE SUM(mrw.quantity_feedback) / MAX(A.use_man) / SUM(A.work_time)
ELSE (SUM(mrw.quantity_feedback)) / MAX(A.use_man) / (MAX(A.work_time))
END,
1
), '0.#') AS actualEfficiency,
@ -52,7 +52,7 @@
ROUND(
CASE
WHEN MAX(A.use_man) = 0 OR SUM(A.work_time) = 0 THEN NULL
ELSE SUM(mrw.quantity_feedback) / MAX(A.use_man) / SUM(A.work_time)
ELSE (SUM(mrw.quantity_feedback)) / MAX(A.use_man) / (MAX(A.work_time))
END,
1
) AS DECIMAL(10,1))

@ -0,0 +1,196 @@
<?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.MesBoxDetailMapper">
<resultMap type="MesBoxDetail" id="MesBoxDetailResult">
<result property="boxCode" column="box_code"/>
<result property="boxSort" column="box_sort"/>
<result property="boxLabel" column="box_label"/>
<result property="boxKey" column="box_key"/>
<result property="boxValue" column="box_value"/>
<result property="boxType" column="box_type"/>
<result property="cssClass" column="css_class"/>
<result property="listClass" column="list_class"/>
<result property="isDefault" column="is_default"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectMesBoxDetailVo">
select box_code, box_sort, box_label, box_key, box_value, box_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark from mes_box_detail
</sql>
<select id="selectMesBoxDetailList" parameterType="MesBoxDetail" resultMap="MesBoxDetailResult">
<include refid="selectMesBoxDetailVo"/>
<where>
<if test="boxSort != null ">
and box_sort = #{boxSort}
</if>
<if test="boxLabel != null and boxLabel != ''">
and box_label = #{boxLabel}
</if>
<if test="boxKey != null and boxKey != ''">
and box_key = #{boxKey}
</if>
<if test="boxValue != null and boxValue != ''">
and box_value = #{boxValue}
</if>
<if test="boxType != null and boxType != ''">
and box_type = #{boxType}
</if>
<if test="cssClass != null and cssClass != ''">
and css_class = #{cssClass}
</if>
<if test="listClass != null and listClass != ''">
and list_class = #{listClass}
</if>
<if test="isDefault != null and isDefault != ''">
and is_default = #{isDefault}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
order by box_sort
</select>
<select id="selectMesBoxDetailByBoxCode" parameterType="Long"
resultMap="MesBoxDetailResult">
<include refid="selectMesBoxDetailVo"/>
where box_code = #{boxCode}
</select>
<insert id="insertMesBoxDetail" parameterType="MesBoxDetail">
insert into mes_box_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="boxCode != null">box_code,
</if>
<if test="boxSort != null">box_sort,
</if>
<if test="boxLabel != null">box_label,
</if>
<if test="boxKey != null">box_key,
</if>
<if test="boxValue != null">box_value,
</if>
<if test="boxType != null">box_type,
</if>
<if test="cssClass != null">css_class,
</if>
<if test="listClass != null">list_class,
</if>
<if test="isDefault != null">is_default,
</if>
<if test="status != null">status,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="boxCode != null">#{boxCode},
</if>
<if test="boxSort != null">#{boxSort},
</if>
<if test="boxLabel != null">#{boxLabel},
</if>
<if test="boxKey != null">#{boxKey},
</if>
<if test="boxValue != null">#{boxValue},
</if>
<if test="boxType != null">#{boxType},
</if>
<if test="cssClass != null">#{cssClass},
</if>
<if test="listClass != null">#{listClass},
</if>
<if test="isDefault != null">#{isDefault},
</if>
<if test="status != null">#{status},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateMesBoxDetail" parameterType="MesBoxDetail">
update mes_box_detail
<trim prefix="SET" suffixOverrides=",">
<if test="boxSort != null">box_sort =
#{boxSort},
</if>
<if test="boxLabel != null">box_label =
#{boxLabel},
</if>
<if test="boxKey != null">box_key =
#{boxKey},
</if>
<if test="boxValue != null">box_value =
#{boxValue},
</if>
<if test="boxType != null">box_type =
#{boxType},
</if>
<if test="cssClass != null">css_class =
#{cssClass},
</if>
<if test="listClass != null">list_class =
#{listClass},
</if>
<if test="isDefault != null">is_default =
#{isDefault},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where box_code = #{boxCode}
</update>
<delete id="deleteMesBoxDetailByBoxCode" parameterType="Long">
delete from mes_box_detail where box_code = #{boxCode}
</delete>
<delete id="deleteMesBoxDetailByBoxCodes" parameterType="String">
delete from mes_box_detail where box_code in
<foreach item="boxCode" collection="array" open="(" separator="," close=")">
#{boxCode}
</foreach>
</delete>
</mapper>

@ -0,0 +1,133 @@
<?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.MesBoxMapper">
<resultMap type="MesBox" id="MesBoxResult">
<result property="boxId" column="box_id"/>
<result property="boxName" column="box_name"/>
<result property="boxType" column="box_type"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectMesBoxVo">
select box_id, box_name, box_type, status, create_by, create_time, update_by, update_time, remark from mes_box
</sql>
<select id="selectMesBoxList" parameterType="MesBox" resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
<where>
<if test="boxName != null and boxName != ''">
and box_name like concat('%', #{boxName}, '%')
</if>
<if test="boxType != null and boxType != ''">
and box_type = #{boxType}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<select id="selectMesBoxByBoxId" parameterType="Long"
resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
where box_id = #{boxId}
</select>
<insert id="insertMesBox" parameterType="MesBox">
insert into mes_box
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="boxId != null">box_id,
</if>
<if test="boxName != null">box_name,
</if>
<if test="boxType != null">box_type,
</if>
<if test="status != null">status,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="boxId != null">#{boxId},
</if>
<if test="boxName != null">#{boxName},
</if>
<if test="boxType != null">#{boxType},
</if>
<if test="status != null">#{status},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateMesBox" parameterType="MesBox">
update mes_box
<trim prefix="SET" suffixOverrides=",">
<if test="boxName != null">box_name =
#{boxName},
</if>
<if test="boxType != null">box_type =
#{boxType},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where box_id = #{boxId}
</update>
<select id="selectDictTypeAll" resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
</select>
<delete id="deleteMesBoxByBoxId" parameterType="Long">
delete from mes_box where box_id = #{boxId}
</delete>
<delete id="deleteMesBoxByBoxIds" parameterType="String">
delete from mes_box where box_id in
<foreach item="boxId" collection="array" open="(" separator="," close=")">
#{boxId}
</foreach>
</delete>
</mapper>

@ -314,4 +314,10 @@ public class ProOrderWorkorderController extends BaseController {
public List<ProOrderWorkorder> getIdCardList(@RequestBody ProOrderWorkorder proOrderWorkorder) {
return proOrderWorkorderService.getIdCardList(proOrderWorkorder);
}
//获取批次号
@GetMapping("/getBatchCode/{workorderId}")
public List<ProOrderWorkorder> getBatchCode(@PathVariable("workorderId") String workorderId) {
return proOrderWorkorderService.getBatchCode(workorderId);
}
}

@ -339,6 +339,8 @@ public class ProOrderWorkorder extends TreeEntity {
private String palletCode;
private String recordId;
private String addFlag;
public String getRecordId() {
return recordId;
}
@ -787,6 +789,13 @@ public class ProOrderWorkorder extends TreeEntity {
this.sortNo = sortNo;
}
public void setAddFlag(String addFlag) {
this.addFlag = addFlag;
}
public String getAddFlag() {
return addFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -237,5 +237,12 @@ public interface ProOrderWorkorderMapper {
List<ProOrderWorkorder> getPreIdCardList(ProOrderWorkorder proOrderWorkorder);
int addBatchPallet(@Param("list")List<ProOrderWorkorder> dtos);
Integer selectPalletByUniqueBarCode(ProOrderWorkorder pw);
//void addOnePallet(ProOrderWorkorder pw);//新增一个标识卡
void updateOnePallet(ProOrderWorkorder pw);//更新一个标识卡
List<ProOrderWorkorder> getBatchCode(String workorderId);//获取批次号下拉框
}

@ -151,4 +151,6 @@ public interface IProOrderWorkorderService {
List<ProLine> getProdLineList();
List<ProOrderWorkorder> getIdCardList(ProOrderWorkorder proOrderWorkorder);
List<ProOrderWorkorder> getBatchCode(String workorderId);//获取批次号
}

@ -1259,13 +1259,18 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return proOrderWorkorderBatchMapper.getProdLineList();
}
@Override
@DS("#header.poolName")
public List<ProOrderWorkorder> getBatchCode(String workorderId) {
return proOrderWorkorderMapper.getBatchCode(workorderId);
}
@Override
@DS("#header.poolName")
public List<ProOrderWorkorder> getIdCardList(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> dtos = new ArrayList<>();
List<ProOrderWorkorder> dtos0 = proOrderWorkorderMapper.getPreIdCardList(proOrderWorkorder);
if(!CollectionUtils.isEmpty(dtos0) && dtos0.get(0).getPalletNo() == null){//说明没生成过标识卡
if(!CollectionUtils.isEmpty(dtos0) && dtos0.get(0).getPalletNo() == null && proOrderWorkorder.getAddFlag().equals("0")){//说明没生成过标识卡 增打标志0
ProOrderWorkorder pw = null;
int i = 1;
Date nowDate = DateUtils.getNowDate();
@ -1275,42 +1280,72 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
BigDecimal pall = pow.getBatchQuantity();
BigDecimal pn = pow.getPalletNum();
while(pall.subtract(pn).compareTo(BigDecimal.ZERO)>0){
while(pall.compareTo(BigDecimal.ZERO)>0){
pw = new ProOrderWorkorder();
pw.setProductName(pow.getProductName());
pw.setWorkorderCode(pow.getWorkorderCode());
pw.setBatchCode(pow.getBatchCode());
pw.setProductDateStr(pow.getProductDateStr());
pw.setRecordId(IdUtils.fastSimpleUUID());
pw.setBatchQuantity(pn);
if(pall.compareTo(pn)<0) {//最后一托盘
pw.setBatchQuantity(pall);
}else{
pw.setBatchQuantity(pn);
}
pw.setPalletNo(i++);
pw.setPalletCode(pow.getPalletCode()+"-"+pw.getPalletNo());
pw.setPalletCode(pow.getWorkorderCode() + "-" + pow.getBatchCode() + "-" + pw.getPalletNo());//workorderCode 实际上是订单号
pw.setCreateTime(nowDate);
pw.setCreateBy(SecurityUtils.getUsername());
pw.setAddFlag("0");//增打标志
dtos.add(pw);
pall = pall.subtract(pn);
}
if(pall.compareTo(pn)<0){//最后一托盘
pw = new ProOrderWorkorder();
pw.setProductName(pow.getProductName());
pw.setWorkorderCode(pow.getWorkorderCode());
pw.setBatchCode(pow.getBatchCode());
pw.setProductDateStr(pow.getProductDateStr());
pw.setRecordId(IdUtils.fastSimpleUUID());
pw.setBatchQuantity(pall);
pw.setPalletNo(i++);
pw.setPalletCode(pow.getPalletCode()+"-"+pw.getPalletNo());
pw.setCreateTime(nowDate);
dtos.add(pw);
}
}
}
if(!CollectionUtils.isEmpty(dtos)){
proOrderWorkorderMapper.addBatchPallet(dtos);
}
}else{
}else if(proOrderWorkorder.getAddFlag().equals("1")){
//增打 增打过来的会有批次号、批次数量、板次 增打标志1 根据唯一二维码去判断是不是生成过标识卡 有增打标志
Integer palletNo = proOrderWorkorder.getPalletNo();//板次
proOrderWorkorder.setPalletNo(null);//板次置空 去查询 获取产品等信息
List<ProOrderWorkorder> dtos1 = proOrderWorkorderMapper.getPreIdCardList(proOrderWorkorder);
ProOrderWorkorder pow = dtos1.get(0);
proOrderWorkorder.setPalletNo(palletNo);
String uniqueBarCode = pow.getWorkorderCode() + "-" + proOrderWorkorder.getBatchCode() + "-" + palletNo;//订单号+批次+板次 唯一二维码标识
ProOrderWorkorder pw = new ProOrderWorkorder();
pw.setProductName(pow.getProductName());//产品名
pw.setWorkorderCode(pow.getWorkorderCode());//工单号 实际是订单号
pw.setBatchCode(proOrderWorkorder.getBatchCode());//批次号
pw.setProductDateStr(pow.getProductDateStr());//生产日期
pw.setRecordId(IdUtils.fastSimpleUUID());//记录
pw.setBatchQuantity(proOrderWorkorder.getBatchQuantity());//批次数量
pw.setPalletNo(palletNo);//板次
pw.setPalletCode(uniqueBarCode);//唯一二维码
pw.setUpdateTime(DateUtils.getNowDate());
pw.setUpdateBy(SecurityUtils.getUsername());
pw.setCreateTime(DateUtils.getNowDate());
pw.setCreateBy(SecurityUtils.getUsername());
pw.setAddFlag("0");
Integer supplementMsg = proOrderWorkorderMapper.selectPalletByUniqueBarCode(pw);//补打标志
pw.setAddFlag("1");
Integer addMsg = proOrderWorkorderMapper.selectPalletByUniqueBarCode(pw);//增打标志
List<ProOrderWorkorder> dto = new ArrayList<>();
if(supplementMsg == 0 && addMsg == 0){//没有正常生成、补打过 没有增打过
dto.add(pw);
proOrderWorkorderMapper.addBatchPallet(dto);
}else if(supplementMsg == 0 && addMsg >= 1){//没有正常生成过、补打过 增打过
proOrderWorkorderMapper.updateOnePallet(pw);
}else if(supplementMsg >= 1){//补打过、正常打过 没有增打过
return dto;
}
dtos.add(pw);
}else if(!CollectionUtils.isEmpty(dtos0) && dtos0.get(0).getPalletNo() != null && proOrderWorkorder.getAddFlag().equals("0")){
dtos.addAll(dtos0);
}
return dtos;
}

@ -688,7 +688,7 @@
case when powbp.quantity is not null then powbp.quantity
else powb.batch_quantity end batchQuantity,
bpa.pallet_num palletNum,
concat(pow.workorder_code_sap,'-', powb.batch_code) palletCode,
concat(pow.workorder_code_sap,'-', powb.batch_code,'-',powbp.pallet_num) palletCode,
powbp.pallet_num palletNo
from pro_order_workorder pow
left join pro_order_workorder_batch powb on pow.workorder_id = powb.workorder_id
@ -697,7 +697,7 @@
and powbp.batch_code = powb.batch_code
where pow.workorder_code = #{workorderCode} and pow.del_flag = '0' and powb.del_flag = '0'
<if test="palletNo != null">and powbp.pallet_num = #{palletNo}</if>
order by CAST(powbp.pallet_num AS INT)
order by CAST(powbp.pallet_num AS INT),powb.batch_code
</select>
<insert id="createPrepareDetails">
@ -819,16 +819,41 @@
)
</foreach>
</insert>
<update id="updateOnePallet" parameterType="ProOrderWorkorder">
update pro_order_workorder_batch_pallet
<trim prefix="SET" suffixOverrides=",">
<if test="batchQuantity != null and batchQuantity != ''">quantity = #{batchQuantity},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
</trim>
where pallet_code = #{palletCode}
</update>
<select id="selectPalletByUniqueBarCode" resultType="java.lang.Integer" parameterType="ProOrderWorkorder">
select count(pallet_code)
FROM pro_order_workorder_batch_pallet
WHERE pallet_code = #{palletCode}
and add_flag = #{addFlag}
and del_flag = '0'
</select>
<select id="getBatchCode" resultType="ProOrderWorkorder" parameterType="java.lang.String">
select powb.batch_code batchCode
from pro_order_workorder pow
left join pro_order_workorder_batch powb on pow.workorder_id = powb.workorder_id
where powb.del_flag = '0'
and pow.del_flag = '0'
and pow.workorder_id = #{workorderId}
</select>
<insert id="addBatchPallet">
INSERT INTO pro_order_workorder_batch_pallet (
id,workorder_code,batch_code,quantity,pallet_num,
create_time,pallet_code
id,workorder_code,batch_code,quantity,pallet_num,create_by,
create_time,pallet_code,add_flag
)VALUES
<foreach collection="list" item="d" index="index" separator=",">
(
(
#{d.recordId},#{d.workorderCode},#{d.batchCode},#{d.batchQuantity},#{d.palletNo},
#{d.createTime},#{d.palletCode}
)
#{d.createBy},#{d.createTime},#{d.palletCode},#{d.addFlag}
)
</foreach>
</insert>

@ -150,10 +150,34 @@ public class QcCheckTaskInventoryController extends BaseController {
public AjaxResult createCCTaskFromOA(@RequestBody OACheckTaskDTO dto) {
logger.info("oa发起库存检验参数"+ JSONObject.toJSONString(dto));
if(StringUtils.isBlank(dto.getFactoryCode())){
error("[factoryCode is null]");
return AjaxResult.error("[factoryCode is null]");
}
if(CollectionUtils.isEmpty(dto.getDetail())){
error("[detail is null]");
return AjaxResult.error("[detail is null]");
}
if(StringUtils.isBlank(dto.getApplyNo())){
return AjaxResult.error("[applyNo is null]");
}
for(QcCheckTaskInventory qcCheckTaskInventory : dto.getDetail()){
if(StringUtils.isBlank(qcCheckTaskInventory.getSerialNumber())){
return AjaxResult.error("[serialNumber is null]");
}
if(StringUtils.isBlank(qcCheckTaskInventory.getMaterialCode())){
return AjaxResult.error("[materialCode is null]");
}
if(StringUtils.isBlank(qcCheckTaskInventory.getMaterialName())){
return AjaxResult.error("[materialName is null]");
}
if(StringUtils.isBlank(qcCheckTaskInventory.getIncomeBatchNo())){
return AjaxResult.error("[incomeBatchNo is null]");
}
if(StringUtils.isBlank(qcCheckTaskInventory.getUnit())){
return AjaxResult.error("[unit is null]");
}
if(qcCheckTaskInventory.getQuality() == null){
return AjaxResult.error("[quality is null]");
}
}
return qcCheckTaskInventoryService.createCCTaskFromOA(dto);
}

@ -488,11 +488,22 @@ public class QcStaticTableController extends BaseController {
}
}
/**
* ----
* ----
**/
@GetMapping("/getTableHzTitle")
@Log(title = "检验分类汇总", businessType = BusinessType.QUERY)
public QcStaticTable getTableHzTitle(QcStaticTable qcStaticTable) {
@PostMapping("/getTableHzTitle")
@Log(title = "检验分析报表", businessType = BusinessType.QUERY)
public QcStaticTable getTableHzTitle(@RequestBody QcStaticTable qcStaticTable) {
return qcStaticTableService.getTableHzTitle(qcStaticTable);
}
/**
* --
**/
@PostMapping("/getTableHzData")
public List<HashMap> getTableHzLineData(@RequestBody QcStaticTable qcStaticTable) {
return qcStaticTableService.getTableHzData(qcStaticTable);
}
@PostMapping("/getTableHzNoOkData")
public List<QcStaticTable> getTableHzNoOkData(@RequestBody QcStaticTable qcStaticTable) {
return qcStaticTableService.getTableHzNoOkData(qcStaticTable);
}
}

@ -2,6 +2,7 @@ package com.op.quality.domain;
import com.op.common.core.web.domain.BaseEntity;
import java.sql.Date;
import java.util.List;
/**
@ -12,60 +13,81 @@ import java.util.List;
*/
public class OACheckTaskDTO extends BaseEntity {
private static final long serialVersionUID = 1L;
//申请单号
private String applNo;
/**
*
*/
private String checkManCode;
/**
*
*/
private String checkManName;
/**
* QC
**/
private String qcMgr;
/**
*
**/
private String zlMgr;
private String factoryCode;
private int taskNum;
public int getTaskNum() {
return taskNum;
}
public void setTaskNum(int taskNum) {
this.taskNum = taskNum;
}
private String recordId;
private String applyNo;//申请单号
private String applicant;//申请人
private String applyDepartment;//申请部门
private Date applyDate;//申请日期
private String storeAddress;//物品存放地点
private String type;//复检物品种类
private String checkManCode;//检验人员工号
private String checkManName;//检验人员姓名
private String qcManager;//QC主管工号
private String zlManager;//质量主管工号
private String treatmentMan;//处理方案人员工号
private int taskNum;//子任务数
private String status;//检验状态 0未完成 1检验完成
private String factoryCode;//工厂编码
private String delFlag;//删除标志
//任务明细
private List<QcCheckTaskInventory> detail;
public String getFactoryCode() {
return factoryCode;
//流程表单中有 数据库表没有
//其他仓库
//方案处理执行人员
//附件
public String getRecordId() {
return recordId;
}
public void setRecordId(String recordId) {
this.recordId = recordId;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
public String getApplyNo() {
return applyNo;
}
public void setApplyNo(String applyNo) {
this.applyNo = applyNo;
}
public String getApplNo() {
return applNo;
public String getApplicant() {
return applicant;
}
public void setApplicant(String applicant) {
this.applicant = applicant;
}
public void setApplNo(String applNo) {
this.applNo = applNo;
public String getApplyDepartment() {
return applyDepartment;
}
public void setApplyDepartment(String applyDepartment) {
this.applyDepartment = applyDepartment;
}
public Date getApplyDate() {
return applyDate;
}
public void setApplyDate(Date applyDate) {
this.applyDate = applyDate;
}
public String getStoreAddress() { return storeAddress; }
public void setStoreAddress(String storeAddress) {
this.storeAddress = storeAddress;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getCheckManCode() {
return checkManCode;
}
public void setCheckManCode(String checkManCode) {
this.checkManCode = checkManCode;
}
@ -73,31 +95,62 @@ public class OACheckTaskDTO extends BaseEntity {
public String getCheckManName() {
return checkManName;
}
public void setCheckManName(String checkManName) {
this.checkManName = checkManName;
}
public String getQcMgr() {
return qcMgr;
public String getQcManager() {
return qcManager;
}
public void setQcManager(String qcManager) {
this.qcManager = qcManager;
}
public void setQcMgr(String qcMgr) {
this.qcMgr = qcMgr;
public String getZlManager() {
return zlManager;
}
public void setZlManager(String zlManager) {
this.zlManager = zlManager;
}
public String getZlMgr() {
return zlMgr;
public String getTreatmentMan() {
return treatmentMan;
}
public void setTreatmentMan(String treatmentMan) {
this.treatmentMan = treatmentMan;
}
public void setZlMgr(String zlMgr) {
this.zlMgr = zlMgr;
public int getTaskNum() {
return taskNum;
}
public void setTaskNum(int taskNum) {
this.taskNum = taskNum;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public List<QcCheckTaskInventory> getDetail() {
return detail;
}
public void setDetail(List<QcCheckTaskInventory> detail) {
this.detail = detail;
}

@ -190,6 +190,7 @@ public class QcCheckTaskIncome extends BaseEntity {
private String fileList;
private List<BaseFile> files;
private String remark;
private String remarkCode;
private String belongTo;
private String oldBelongTo;
private String noOkQualityNames;
@ -852,6 +853,14 @@ public class QcCheckTaskIncome extends BaseEntity {
return delFlag;
}
public String getRemarkCode() {
return remarkCode;
}
public void setRemarkCode(String remarkCode) {
this.remarkCode = remarkCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -216,6 +216,9 @@ public class QcCheckTaskInventory extends BaseEntity {
private String checkTimeStart;
private String checkTimeEnd;
//序号 复检流程单用
private String serialNumber;
private List<QcCheckTaskDefect> defects;
public void setRecordId(String recordId) {
@ -514,6 +517,14 @@ public class QcCheckTaskInventory extends BaseEntity {
this.defects = defects;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -88,6 +88,7 @@ public class QcStaticTable extends BaseEntity {
private String projectNo;
private String status;
private String ymdms;
private String ymdUntype;
private String column080090;
private String column090100;
private String column100110;
@ -113,6 +114,14 @@ public class QcStaticTable extends BaseEntity {
private List<String> columns1;
private List<String> columns2;
public String getYmdUntype() {
return ymdUntype;
}
public void setYmdUntype(String ymdUntype) {
this.ymdUntype = ymdUntype;
}
public List<String> getColumns1() {
return columns1;
}

@ -2,6 +2,7 @@ package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.OACheckTaskDTO;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckTaskInventory;
import com.op.quality.domain.QcCheckTaskProduce;
@ -69,4 +70,7 @@ public interface QcCheckTaskInventoryMapper {
List<QcCheckTaskIncome> getPutInOrder(QcCheckTaskInventory qcCheckTaskInventory);
List<QcCheckTaskInventory> getPutInOrderList(QcCheckTaskInventory qoPutIn);
//创建 qc_check_oa_task 复检申请记录
void insertQcCheckOaTask(OACheckTaskDTO dto);
}

@ -85,4 +85,10 @@ public interface QcStaticTableMapper {
List<String> getTableHzTitle(QcStaticTable qcStaticTable);
List<String> getTableHzTitle2(QcStaticTable qcStaticTable);
@MapKey("ymdms")
Map<String, QcStaticTable> getSamplesNum(QcStaticTable qcStaticTable);
@MapKey("ymdUntype")
Map<String, QcStaticTable> getNoOkNum(QcStaticTable qcStaticTable);
List<QcStaticTable> getTableHzNoOkData(QcStaticTable qcStaticTable);
}

@ -1,5 +1,6 @@
package com.op.quality.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -51,4 +52,8 @@ public interface IQcStaticTableService {
List<QcStaticTable> getProjectList(String checkType);
QcStaticTable getTableHzTitle(QcStaticTable qcStaticTable);
List<HashMap> getTableHzData(QcStaticTable qcStaticTable);
List<QcStaticTable> getTableHzNoOkData(QcStaticTable qcStaticTable);
}

@ -678,6 +678,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
qcCheckTask.setUpdateTime(nowTime);
qcCheckTask.setCheckTime(nowTime);
qcCheckTask.setRemark(qcCheckTaskIncome.getRemark());
qcCheckTask.setRemarkCode(qcCheckTaskIncome.getRemarkCode());
qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格
qcCheckTask.setIncomeBatchNo(qcCheckTaskIncome.getIncomeBatchNo());
BigDecimal noOkQquality = new BigDecimal("0");
@ -688,7 +689,11 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
qcCheckTask.setNoOkQuality(noOkQquality);//累计不合格数
qcCheckTask.setCheckManCode(qcCheckTaskIncome.getUpdateBy());
qcCheckTask.setCheckManName(qcCheckTaskIncome.getUpdateByName());
qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality());
qcCheckTask.setReason(qcCheckTaskIncome.getReason());
qcCheckTask.setBz(qcCheckTaskIncome.getAttr3());//备注
@ -720,34 +725,10 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
qcCheckTask.setSccj(qcCheckTaskIncome.getSccj());// 所属车间
qcCheckTask.setSqr(qcCheckTaskIncome.getSqr());// 申请人Id
/**qc_check_task_cg**/
List<QcCheckTaskIncome> valiData = qcCheckTaskIncomeMapper.selectQcCheckTaskCgByRecordId(belongId);
// 判断表中是否存在此条数据
if (valiData != null && valiData.size() > 0) {
n = qcCheckTaskIncomeMapper.updateQcCheckTaskCg(qcCheckTask);//updateQcCheckTaskCG
}else {
qcCheckTask.setCheckNo(qcCheckTaskIncome.getCheckNo());
qcCheckTask.setOrderNo(qcCheckTaskIncome.getOrderNo());
qcCheckTask.setMaterialCode(qcCheckTaskIncome.getMaterialCode());
qcCheckTask.setMaterialName(qcCheckTaskIncome.getMaterialName());
qcCheckTask.setOrderType(qcCheckTaskIncome.getOrderType());
qcCheckTask.setOrderTypeDesc(qcCheckTaskIncome.getOrderTypeDesc());
qcCheckTask.setCreateBy(qcCheckTaskIncome.getCreateBy());
qcCheckTask.setCreateTime(DateUtils.getNowDate());
qcCheckTask.setIncomeTime(qcCheckTaskIncome.getIncomeTime());
qcCheckTask.setFactoryCode(qcCheckTaskIncome.getFactoryCode());
qcCheckTask.setCheckType(qcCheckTaskIncome.getCheckType());
qcCheckTask.setaNoOkquality(qcCheckTaskIncome.getaNoOkquality());
qcCheckTask.setbNoOkquality(qcCheckTaskIncome.getbNoOkquality());
qcCheckTask.setcNoOkquality(qcCheckTaskIncome.getcNoOkquality());
n = qcCheckTaskIncomeMapper.insertQcCheckTaskIncomeCg(qcCheckTask);
}
logger.info("qc_check_task:"+n);
/**更新qc_check_task_detail**/
BigDecimal sampleQuality = new BigDecimal("0");
for(QcCheckTaskDetail detail:details){
detail.setUpdateTime(nowTime);
sampleQuality = sampleQuality.add(new BigDecimal(detail.getSampleQuality()==null?"0":detail.getSampleQuality()));
//上传附件
if (StringUtils.isNotEmpty(detail.getFileListStr())) {
String[] ids = detail.getFileListStr().split(",");
@ -769,6 +750,41 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
}
}
/**qc_check_task_cg**/
List<QcCheckTaskIncome> valiData = qcCheckTaskIncomeMapper.selectQcCheckTaskCgByRecordId(belongId);
// 判断表中是否存在此条数据
if (valiData != null && valiData.size() > 0) {
n = qcCheckTaskIncomeMapper.updateQcCheckTaskCg(qcCheckTask);//updateQcCheckTaskCG
}else {
if(qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){
qcCheckTask.setSampleQuality(sampleQuality);
}else{
qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality());
}
qcCheckTask.setCheckNo(qcCheckTaskIncome.getCheckNo());
qcCheckTask.setOrderNo(qcCheckTaskIncome.getOrderNo());
qcCheckTask.setMaterialCode(qcCheckTaskIncome.getMaterialCode());
qcCheckTask.setMaterialName(qcCheckTaskIncome.getMaterialName());
qcCheckTask.setOrderType(qcCheckTaskIncome.getOrderType());
qcCheckTask.setOrderTypeDesc(qcCheckTaskIncome.getOrderTypeDesc());
qcCheckTask.setCreateBy(qcCheckTaskIncome.getCreateBy());
qcCheckTask.setCreateTime(DateUtils.getNowDate());
qcCheckTask.setIncomeTime(qcCheckTaskIncome.getIncomeTime());
qcCheckTask.setFactoryCode(qcCheckTaskIncome.getFactoryCode());
qcCheckTask.setCheckType(qcCheckTaskIncome.getCheckType());
qcCheckTask.setaNoOkquality(qcCheckTaskIncome.getaNoOkquality());
qcCheckTask.setbNoOkquality(qcCheckTaskIncome.getbNoOkquality());
qcCheckTask.setcNoOkquality(qcCheckTaskIncome.getcNoOkquality());
n = qcCheckTaskIncomeMapper.insertQcCheckTaskIncomeCg(qcCheckTask);
}
logger.info("qc_check_task:"+n);
/**更新qc_check_task_detail**/
n= qcCheckTaskIncomeMapper.updateQcCheckTaskDetails(details);
logger.info("更新qc_check_task_detail:"+n);
@ -841,6 +857,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
qcCheckTask.setUpdateTime(nowTime);
qcCheckTask.setCheckTime(nowTime);
qcCheckTask.setRemark(qcCheckTaskIncome.getRemark());
qcCheckTask.setRemarkCode(qcCheckTaskIncome.getRemarkCode());
qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格
qcCheckTask.setIncomeBatchNo(qcCheckTaskIncome.getIncomeBatchNo());
BigDecimal noOkQquality = new BigDecimal("0");
@ -860,7 +877,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
BigDecimal sampleQuality = new BigDecimal("0");
for(QcCheckTaskDetail detail:details){
detail.setUpdateTime(nowTime);
sampleQuality = noOkQquality.add(new BigDecimal(detail.getSampleQuality()==null?"0":detail.getSampleQuality()));
sampleQuality = sampleQuality.add(new BigDecimal(detail.getSampleQuality()==null?"0":detail.getSampleQuality()));
//上传附件
if (StringUtils.isNotEmpty(detail.getFileListStr())) {
String[] ids = detail.getFileListStr().split(",");
@ -882,7 +899,12 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
}
}
qcCheckTask.setSampleQuality(sampleQuality);
if(qcCheckTaskIncome.getSampleQuality().equals(BigDecimal.ZERO)){
qcCheckTask.setSampleQuality(sampleQuality);
}else{
qcCheckTask.setSampleQuality(qcCheckTaskIncome.getSampleQuality());
}
/**qc_check_task**/
n = qcCheckTaskIncomeMapper.updateQcCheckTask(qcCheckTask);
logger.info("qc_check_task:"+n);

@ -387,15 +387,24 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
@Override
public AjaxResult createCCTaskFromOA(OACheckTaskDTO dto) {
List<QcCheckTaskInventory> dtos = dto.getDetail();
int m=0;
for(QcCheckTaskInventory ccTask:dtos){
ccTask.setAttr1(dto.getApplNo());//申请编码
int m = 0;
for(QcCheckTaskInventory ccTask : dtos){
ccTask.setOrderNo(dto.getApplyNo() + ":" + ccTask.getSerialNumber() );//订单号 = 申请单号 ++序号
ccTask.setAttr1(dto.getApplyNo());//申请编码
ccTask.setCheckType("checkTypeCC");//库存检验
ccTask.setFactoryCode(dto.getFactoryCode());
m += insertQcCheckTaskInventory(ccTask);
if(ccTask.getIncomeTime() == null){
ccTask.setIncomeTime(DateUtils.getNowDate());//如果生产日期和入库时间
}
insertQcCheckTaskInventory(ccTask);
m++;
}
//TODO;
/**qc_check_oa_task**/
/**qc_check_oa_task表新增**/
dto.setRecordId(IdUtils.fastSimpleUUID());
dto.setTaskNum(dtos.size());
dto.setCreateTime(DateUtils.getNowDate());//创建时间
dto.setCreateBy(dto.getApplicant());//创建人
qcCheckTaskInventoryMapper.insertQcCheckOaTask(dto);
logger.info("++++++++++++oa发起仓库检验任务生成" + m + "++++++++++++++");
return success();

@ -151,6 +151,11 @@ public class QcProCheckServiceImpl implements QcProCheckService {
Map<String,QcCheckTaskDefect> defectMap = qcCheckTaskDefectMapper.getDefectMap(qcCheckTaskDetail);
for (QcCheckTaskDetail qcd : qcCheckTaskDetails) {
if(StringUtils.isNotBlank(qcd.getSampleQuality())){
qcd.setSampleQuality(qcd.getSampleQuality().replaceAll("\\..*", ""));//去掉小数
}
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(qcd.getRecordId());
if (CollectionUtils.isNotEmpty(files)) {
qcd.setFiles(files);
@ -185,7 +190,10 @@ public class QcProCheckServiceImpl implements QcProCheckService {
Map<String,QcCheckTaskDefect> defectMap = qcCheckTaskDefectMapper.getDefectMap(qcCheckTaskDetail);
for (QcCheckTaskDetail qcd : qcCheckTaskDetails) {
qcd.setSampleQuality(qcd.getSampleQuality().replaceAll("\\..*", ""));//去掉小数
if(StringUtils.isNotBlank(qcd.getSampleQuality())){
qcd.setSampleQuality(qcd.getSampleQuality().replaceAll("\\..*", ""));//去掉小数
}
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(qcd.getRecordId());
if (CollectionUtils.isNotEmpty(files)) {

@ -4,6 +4,11 @@ import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Month;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.util.*;
import java.util.stream.Collectors;
@ -788,15 +793,17 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
public QcStaticTable getTableHzTitle(QcStaticTable qcStaticTable) {
QcStaticTable dto = new QcStaticTable();
qcStaticTable.setDataType("unqualified_remark");
qcStaticTable.setRemark("checkTypeCP");
qcStaticTable.setRemark(qcStaticTable.getCheckType());
List<String> cols1 = qcStaticTableMapper.getTableHzTitle(qcStaticTable);
if(CollectionUtils.isEmpty(cols1)){
return dto;
}
dto.setColumns1(cols1);
List<String> cols2 = qcStaticTableMapper.getTableHzTitle2(qcStaticTable);
dto.setColumns2(cols2);
dto.setColumns1(cols1);
// List<String> cols2 = qcStaticTableMapper.getTableHzTitle2(qcStaticTable);
//
// dto.setColumns2(cols2);
return dto;
}
@ -876,8 +883,152 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return days;
}
@Override
@DS("#header.poolName")
public List<HashMap> getTableHzData(QcStaticTable qcStaticTable) {
List<HashMap> dtos = new ArrayList<>();
qcStaticTable.setDataType("unqualified_remark");
qcStaticTable.setRemark(qcStaticTable.getCheckType());
List<String> noOkTyps = qcStaticTableMapper.getTableHzTitle(qcStaticTable);
//第一列日期
List<String> days = this.getHzDays(qcStaticTable.getIncomeTimeStr(),qcStaticTable.getYmdms());
//抽样数、不良数、不良率
Map<String,QcStaticTable> samples = qcStaticTableMapper.getSamplesNum(qcStaticTable);
if(samples.isEmpty()){
return dtos;
}
//不良数
Map<String,QcStaticTable> noOks = qcStaticTableMapper.getNoOkNum(qcStaticTable);
HashMap colMap = null;
for(String col:days){
colMap = new HashMap();
colMap.put("timeCol",col);
String samKey = col;
QcStaticTable sampl = samples.get(samKey);
if(sampl!=null&&!sampl.getSampleQuality().equals("0.00")){
colMap.put("sampleQuality",sampl.getSampleQuality().replaceAll("\\..*", ""));
BigDecimal noOkRate = new BigDecimal(sampl.getNoOkQuality()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(sampl.getSampleQuality()),2, BigDecimal.ROUND_HALF_UP);
colMap.put("noOkRate",noOkRate);
}else{
colMap.put("sampleQuality","0");
colMap.put("noOkRate","0");
}
//缺陷不良
for(int i=0;i< noOkTyps.size();i++){
String noOkTyp = noOkTyps.get(i);
String noOkTypeKey = col+noOkTyp;
QcStaticTable noOk = noOks.get(noOkTypeKey);
if(noOk!=null&&noOk.getNoOkQuality()!=null) {
colMap.put("col"+i, noOk.getNoOkQuality().replaceAll("\\..*", ""));
}else{
colMap.put("col"+i, "0");
}
}
dtos.add(colMap);
}
return dtos;
}
@Override
@DS("#header.poolName")
public List<QcStaticTable> getTableHzNoOkData(QcStaticTable qcStaticTable) {
//不良数
List<QcStaticTable> dtos = qcStaticTableMapper.getTableHzNoOkData(qcStaticTable);
BigDecimal totalNoOkQuality = BigDecimal.ZERO;
//求不良数和
for (QcStaticTable dto : dtos) {
totalNoOkQuality = totalNoOkQuality.add(new BigDecimal(dto.getNoOkQuality()));
}
//求占比
for (QcStaticTable dto : dtos) {
BigDecimal noOkratio = new BigDecimal(dto.getNoOkQuality())
.divide(totalNoOkQuality,2, BigDecimal.ROUND_HALF_UP);
dto.setNoOkNumRate(noOkratio.toString());
dto.setNoOkQuality(dto.getNoOkQuality().replaceAll("\\..*", ""));
}
return dtos;
}
/****/
public List<String> getHzDays(String timeStr,String ymd) {
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = null;
try {
Calendar tempStart = null;
Calendar tempEnd = null;
if ("dd".equals(ymd)) {//天内各小时
for (int i = 0; i < 24; i++) {
// 使用String.format()格式化小时,保证每个小时都是两位数
String hourS = String.format("%02d", i);//String.format("%02d:00", i);
days.add(hourS);
}
} else if ("mm".equals(ymd)){//月内各日
int year = Integer.parseInt(timeStr.split("-")[0]);
int month = Integer.parseInt(timeStr.split("-")[1]);
YearMonth yearMonth = YearMonth.of(year, month);
// 获取该月份的第一天
LocalDate firstDayOfMonth = yearMonth.atDay(1);
// 循环直到下一个月的第一天
LocalDate currentDate = firstDayOfMonth;
while (currentDate.getMonthValue() == month) {
// 使用DateTimeFormatter格式化日期为字符串
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
days.add(formattedDate);
// 移动到下一天
currentDate = currentDate.plusDays(1);
}
} else if ("yyyy".equals(ymd)){//
for (Month month : Month.values()) {
// 使用String.format来构造"yyyy-MM"格式的字符串
// %d用于整数年份和月份但月份需要前面补0使用%02d
String formattedMonth = String.format("%d-%02d", Integer.parseInt(timeStr), month.getValue());
days.add(formattedMonth);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return days;
}
public static List<String> getDaysOfMonth(int year, int month) {
List<String> days = new ArrayList<>();
YearMonth yearMonth = YearMonth.of(year, month);
// 获取该月份的第一天
LocalDate firstDayOfMonth = yearMonth.atDay(1);
// 循环直到下一个月的第一天
LocalDate currentDate = firstDayOfMonth;
while (currentDate.getMonthValue() == month) {
// 使用DateTimeFormatter格式化日期为字符串
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
days.add(formattedDate);
// 移动到下一天
currentDate = currentDate.plusDays(1);
}
return days;
}
public static void main(String args[]){
double a = 0.01;
System.out.println(new BigDecimal(a).compareTo(BigDecimal.ZERO));
List<String> months = new ArrayList<>();
for (Month month : Month.values()) {
// 使用String.format来构造"yyyy-MM"格式的字符串
// %d用于整数年份和月份但月份需要前面补0使用%02d
String formattedMonth = String.format("%d-%02d",2024, month.getValue());
months.add(formattedMonth);
}
System.out.println(months);
}
}

@ -39,6 +39,7 @@
<result property="sampleCode" column="sample_code"/>
<result property="orderType" column="order_type"/>
<result property="orderTypeDesc" column="order_type_desc"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectQcCheckTaskIncomeVo">
@ -46,7 +47,7 @@
supplier_code, supplier_name, income_time, check_loc, check_status, check_man_code,
check_man_name, check_time, check_result, status, attr1, attr2, attr3, attr4, create_by,
create_time, update_by, update_time, factory_code, del_flag , check_type,sample_quality, noOk_quality,
order_type,order_type_desc
order_type,order_type_desc,remark
from qc_check_task
</sql>
@ -313,6 +314,7 @@
<if test="cNoOkquality != null">cNoOkquality = #{cNoOkquality},</if>
<if test="incomeBatchNo != null">income_batch_no = #{incomeBatchNo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="remarkCode != null">remark_code = #{remarkCode},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="bz != null">bz = #{bz},</if>
<if test="cxzz != null">cxzz = #{cxzz},</if>
@ -362,6 +364,7 @@
<if test="orderType != null">order_type,</if>
<if test="orderTypeDesc != null">order_type_desc,</if>
<if test="remark != null">remark,</if>
<if test="remarkCode != null">remark_code,</if>
<if test="reason != null">reason,</if>
<if test="bz != null">bz,</if>
<if test="startOA != null">start_oA,</if>
@ -420,6 +423,7 @@
<if test="orderType != null">#{orderType},</if>
<if test="orderTypeDesc != null">#{orderTypeDesc},</if>
<if test="remark != null">#{remark},</if>
<if test="remarkCode != null">#{remarkCode},</if>
<if test="reason != null">#{reason},</if>
<if test="bz != null">#{bz},</if>
<if test="startOA != null">#{startOA},</if>
@ -458,6 +462,7 @@
<if test="cNoOkquality != null">cNoOkquality = #{cNoOkquality},</if>
<if test="incomeBatchNo != null">income_batch_no = #{incomeBatchNo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="remarkCode != null">remark_code = #{remarkCode},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="bz != null">bz = #{bz},</if>
<if test="startOA != null">start_oA = #{startOA},</if>
@ -592,6 +597,7 @@
qct.income_time incomeTime,
qct.check_loc checkLoc,
qct.remark,
qct.remark_code remarkCode,
qct.cxzz,
qct.jgy,
qct.pgy
@ -621,6 +627,7 @@
qct.income_time incomeTime,
qct.check_loc checkLoc,
qct.remark,
qct.remark_code remarkCode,
qct.czbjr,
qct.zcf,
qct.zcoemcm,

@ -362,4 +362,52 @@
)t0
where t0.days >= t0.warehouse_cycle
</select>
<insert id="insertQcCheckOaTask" parameterType="OACheckTaskDTO">
insert into qc_check_oa_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
<if test="applyNo != null">apply_no,</if>
<if test="applicant != null">applicant,</if>
<if test="applyDepartment != null">apply_department,</if>
<if test="applyDate != null">apply_date,</if>
<if test="storeAddress != null">store_address,</if>
<if test="type != null">type,</if>
<if test="checkManCode != null">check_man_code,</if>
<if test="checkManName != null">check_man_name,</if>
<if test="qcManager != null">qc_manager,</if>
<if test="zlManager != null">zl_manager,</if>
<if test="treatmentMan != null">treatment_man,</if>
<if test="taskNum != null">task_num,</if>
status,
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
<if test="applyNo != null">#{applyNo},</if>
<if test="applicant != null">#{applicant},</if>
<if test="applyDepartment != null">#{applyDepartment},</if>
<if test="applyDate != null">#{applyDate},</if>
<if test="storeAddress != null">#{storeAddress},</if>
<if test="type != null">#{type},</if>
<if test="checkManCode != null">#{checkManCode},</if>
<if test="checkManName != null">#{checkManName},</if>
<if test="qcManager != null">#{qcManager},</if>
<if test="zlManager != null">#{zlManager},</if>
<if test="treatmentMan != null">#{treatmentMan},</if>
<if test="taskNum != null">#{taskNum},</if>
'0',
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
</mapper>

@ -498,4 +498,116 @@
<select id="getTableHzTitle2" resultType="java.lang.String">
select defect_subclass from qc_defect_type where defect_type = #{typeCode} and del_flag = '0'
</select>
<select id="getSamplesNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality,
ymdms
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS ymdms, qct.sample_quality, qct.noOk_quality
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
<if test="ymdms == 'mm'">
select sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality,
ymdms
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS ymdms, qct.sample_quality, qct.noOk_quality
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
<if test="ymdms == 'dd'">
select sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality,
RIGHT('00' + CAST(ymdms AS VARCHAR(2)), 2) ymdms
FROM(
select DATEPART(HOUR, qct.create_time) AS ymdms, qct.sample_quality, qct.noOk_quality
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
</select>
<select id="getNoOkNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(noOk_quality) noOkQuality,
concat(hourName,dict_label) ymdUntype
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS hourName,
qct.noOk_quality,
bdd.dict_label
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0' and bdd.dict_label is not null
) t
group by hourName,dict_label
</if>
<if test="ymdms == 'mm'">
select sum(noOk_quality) noOkQuality,
concat(hourName,dict_label) ymdUntype
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS hourName,
qct.noOk_quality,
bdd.dict_label
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0' and bdd.dict_label is not null
) t
group by hourName,dict_label
</if>
<if test="ymdms == 'dd'">
select sum(noOk_quality) noOkQuality,
concat(hourName,dict_label) ymdUntype
FROM(
select RIGHT('00' + CAST(DATEPART(HOUR, qct.create_time) AS VARCHAR(2)), 2) AS hourName,
qct.noOk_quality,
bdd.dict_label
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0' and bdd.dict_label is not null
) t
group by hourName,dict_label
</if>
</select>
<select id="getTableHzNoOkData" resultType="com.op.quality.domain.QcStaticTable">
select * from (
select sum(t.noOk_quality) noOkQuality,
t.dict_label dataType
FROM(
select
qct.noOk_quality,qct.sample_quality,
bdd.dict_label
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
where qct.check_type = #{checkType} and qct.check_status = '2'
<if test="ymdms == 'yyyy'">and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
</if>
<if test="
ymdms == 'mm'">and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
</if>
<if test="ymdms == 'dd'">
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
</if>
and del_flag = '0' and qct.remark_code is not null
) t
group by t.dict_label
) t0 order by noOkQuality desc
</select>
</mapper>

@ -323,6 +323,14 @@ public class WmsToWCSmissionController {
public AjaxResult WmsProductPutByWorkOrderConfirm(@RequestBody WmsProductPut wmsProductPut) {
return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderConfirm(wmsProductPut));
}
/**
*
*
*/
@PostMapping("/WmsProductPutByWorkOrderConfirmT")
public AjaxResult WmsProductPutByWorkOrderConfirmT(@RequestBody WmsProductPut wmsProductPut) {
return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderConfirmT(wmsProductPut));
}
/**

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

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

@ -142,4 +142,6 @@ public interface IWmsProductPutService {
WmsProductPut WmsProductPutByWorkOrderqueryBS(WmsProductPut wmsProductPut);
ProOrderWorkorder finishedProductProductionRecordscar(ProOrderWorkorder proOrderWorkorder);
String WmsProductPutByWorkOrderConfirmT(WmsProductPut wmsProductPutList);
}

@ -810,6 +810,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
wmsOdsEmStorageNews.setWlCode(wmsRawOrderInSn.getWlCode());//库位编码
wmsOdsEmStorageNews.setWaCode(wmsRawOrderInSn.getWaCode());//库位编码
wmsOdsEmStorageNews.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
wmsOdsEmStorageNews.setUserDefined2(formattedDate);//批次
wmsOdsEmStorageNews.setAmount(wmsRawOrderInSn.getAmount());
//添加库存--这个要有个判断有没有这个库存如果没有的话,就插入
WmsOdsMateStorageNews wmsOdsMateStorageNews = wmsOdsMateStorageNewsMapper.selectByWhCodeAndMate(wmsOdsEmStorageNews);
@ -838,8 +839,6 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
}
}else {////失败|
result="暂收失败";
order.setSapTempInfor(result2.getMsg());
@ -1070,6 +1069,11 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
}
}
@Override
public List<ProOrderWorkorder> getIdCardList(OdsProcureOrder odsProcureOrder) {
List<OdsProcureOrder> orderList= odsProcureOrderMapper.getIdCardList(odsProcureOrder);

@ -1058,9 +1058,33 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
if (wmsProductProductionRecords.size()>0){
WmsProductProductionRecords wmsProductProductionRecords1= wmsProductProductionRecords.get(0);
wmsProductPut1.setSn(wmsProductProductionRecords1.getSn());
WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords();
wmsProductPutRecords.setUserDefined1(wmsProductPut.getPallet());
List<WmsProductPutRecords> wmsProductPutRecords1= wmsProductPutRecordsMapper.selectWmsProductPutRecordsList(wmsProductPutRecords);
if(wmsProductPutRecords1.size()>0){
wmsProductPut1.setRemark("1");//已经入库
wmsProductPut1.setNumber(wmsProductPutRecords1.get(0).getNumber());
}else {
wmsProductPut1.setRemark("0");//未入库
}
}else {
return null;
//他们又不想在成品下线的时候绑托盘,--让标识卡代替托盘码,如果没有绑的话,就标识卡代替托盘码
wmsProductPut1.setSn(wmsProductPut.getPallet());
WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords();
wmsProductPutRecords.setUserDefined1(wmsProductPut.getPallet());
List<WmsProductPutRecords> wmsProductPutRecords1= wmsProductPutRecordsMapper.selectWmsProductPutRecordsList(wmsProductPutRecords);
if(wmsProductPutRecords1.size()>0){
wmsProductPut1.setRemark("1");//已经入库
wmsProductPut1.setNumber(wmsProductPutRecords1.get(0).getNumber());
}else {
wmsProductPut1.setRemark("0");//未入库
}
// return null;
}
if (wmsProductPut1.getAttr3()==null){
wmsProductPut1.setAttr3(wmsProductPut1.getPlanQuantity().toString());
}
wmsProductPut1.setPallet(wmsProductPut.getPallet());
return wmsProductPut1;
}
@ -1087,6 +1111,124 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
return proOrderWorkorder;
}
@Override
public String WmsProductPutByWorkOrderConfirmT(WmsProductPut wmsProductPut) {
// whCode
// waCode
// factoryCode
DynamicDataSourceContextHolder.push("ds_" + wmsProductPut.getFactoryCode());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String formattedDate = dateFormat.format(date);//批次
List<WmsProductPut> wmsProductPutList = wmsProductPut.getWmsProductPut();//前端下栏保存的数据
String SUCCESS = "操作成功";
for (WmsProductPut wmsProductPut1 :
wmsProductPutList) {
//根据下面的记录--先查询对应订单,如果有原来的订单的话,就在原来的订单上进行修改,如果没有就先插入,如果有就修改数量
WmsProductPut wmsProductPutk = new WmsProductPut();
//wms_product_put
wmsProductPutk.setWorkOrder(wmsProductPut1.getWorkOrder());
wmsProductPutk.setProductOrder(wmsProductPut1.getProductOrder());
wmsProductPutk.setFactoryCode(wmsProductPut.getFactoryCode());
wmsProductPutk.setWhCode(wmsProductPut1.getWhCode());//仓库编码
wmsProductPutk.setWaCode(wmsProductPut1.getWaCode());//仓库编码
wmsProductPutk.setProductName(wmsProductPut1.getProductName());
wmsProductPutk.setProductCode(wmsProductPut1.getProductCode());
wmsProductPutk.setPlanQuantity(wmsProductPut1.getPlanQuantity());
wmsProductPutk.setUnitOfMeasure(wmsProductPut1.getUnitOfMeasure());
wmsProductPutk.setBatchNumber(wmsProductPut1.getBatchNumber());//
List<WmsProductPut> wmsProductPutLists= wmsProductPutMapper.selectWmsProductPutList(wmsProductPutk);
if (wmsProductPutLists.size()>0){//有
WmsProductPut wmsProductPut2= wmsProductPutLists.get(0);
BigDecimal planQuantity= wmsProductPut2.getPlanQuantity();
BigDecimal putQuantity= wmsProductPut2.getPutQuantity();
if (planQuantity.equals(putQuantity.add(new BigDecimal(wmsProductPut1.getNumber())))){
wmsProductPutk.setStatus("1");
}else {
wmsProductPutk.setStatus("2");
}
BigDecimal putQuantityT=putQuantity.add(new BigDecimal(wmsProductPut1.getNumber()));//入库数量
wmsProductPut2.setPutQuantity(putQuantityT);
wmsProductPut2.setUpdateTime(new Date());
wmsProductPut2.setUpdateBy(wmsProductPut.getCreateBy());
wmsProductPutMapper.updateWmsProductPut(wmsProductPut2);
}else {
wmsProductPutk.setStatus("2");
wmsProductPutk.setSapStatus("0");
wmsProductPutk.setAttr3(formattedDate);//
wmsProductPutk.setCreateBy(wmsProductPut.getCreateBy());
wmsProductPutk.setCreateTime(new Date());
wmsProductPutk.setPutQuantity(new BigDecimal(wmsProductPut1.getNumber()));
wmsProductPutk.setId(IdUtils.fastSimpleUUID());
wmsProductPutMapper.insertWmsProductPut(wmsProductPutk);
}
WmsProductPutRecords wmsProductPutRecords = new WmsProductPutRecords();
wmsProductPutRecords.setWorkOrder(wmsProductPut1.getWorkOrder());
wmsProductPutRecords.setProductOrder(wmsProductPut1.getProductOrder());
wmsProductPutRecords.setProductName(wmsProductPut1.getProductName());
wmsProductPutRecords.setProductCode(wmsProductPut1.getProductCode());
wmsProductPutRecords.setWhCode(wmsProductPut1.getWhCode());//仓库编码
wmsProductPutRecords.setWaCode(wmsProductPut1.getWaCode());//库区编码
wmsProductPutRecords.setId(IdUtils.fastSimpleUUID());
wmsProductPutRecords.setWlCode(wmsProductPut1.getWlCode());
wmsProductPutRecords.setSn(wmsProductPut1.getSn());
wmsProductPutRecords.setNumber(wmsProductPut1.getNumber());
wmsProductPutRecords.setCreateBy(wmsProductPut.getCreateBy());
wmsProductPutRecords.setCreateTime(new Date());
wmsProductPutRecords.setUserDefined1(wmsProductPut1.getPallet());
wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords);
//wms_fp_storage_news_sn
WmsFpStorageNewsSn wmsFpStorageNewsSn = new WmsFpStorageNewsSn();
wmsFpStorageNewsSn.setStorageId(IdUtils.fastSimpleUUID());
wmsFpStorageNewsSn.setFactoryCode(wmsProductPut.getFactoryCode());
wmsFpStorageNewsSn.setWhCode(wmsProductPut1.getWhCode());//仓库编码
wmsFpStorageNewsSn.setWaCode(wmsProductPut1.getWaCode());
wmsFpStorageNewsSn.setWlCode(wmsProductPut1.getWlCode());
wmsFpStorageNewsSn.setOrderNo(wmsProductPutk.getId());
wmsFpStorageNewsSn.setProductCode(wmsProductPut1.getProductCode());
wmsFpStorageNewsSn.setProductName(wmsProductPut1.getProductName());
wmsFpStorageNewsSn.setSn(wmsProductPut1.getSn());
wmsFpStorageNewsSn.setAmount(new BigDecimal(wmsProductPut1.getNumber()));
wmsFpStorageNewsSn.setBatchNumber(wmsProductPut1.getBatchNumber());
//wmsFpStorageNewsSn.setUserDefined2(formattedDate);
wmsFpStorageNewsSn.setCreateBy(wmsProductPut.getCreateBy());
wmsFpStorageNewsSn.setCreateTime(new Date());
wmsFpStorageNewsSn.setActiveFlag("1");
wmsFpStorageNewsSn.setUserDefined3(wmsProductPut1.getUnitOfMeasure());
wmsFpStorageNewsSnMapper.insertWmsFpStorageNewsSn(wmsFpStorageNewsSn);
// wms_fp_storage_news
WmsFpStorageNews wmsFpStorageNews = new WmsFpStorageNews();
wmsFpStorageNews.setWhCode(wmsProductPut1.getWhCode());//仓库编码
wmsFpStorageNews.setWaCode(wmsProductPut1.getWaCode());
wmsFpStorageNews.setWlCode(wmsProductPut1.getWlCode());
wmsFpStorageNews.setStorageType("成品");
wmsFpStorageNews.setProductCode(wmsProductPut1.getProductCode());
wmsFpStorageNews.setProductName(wmsProductPut1.getProductName());
wmsFpStorageNews.setFactoryCode(wmsProductPut.getFactoryCode());
wmsFpStorageNews.setActiveFlag("1");
wmsFpStorageNews.setProductBatch(wmsProductPut1.getBatchNumber());
wmsFpStorageNews.setUserDefined1(wmsProductPut1.getUnitOfMeasure());
List<WmsFpStorageNews> wmsFpStorageNewsList = wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews);
wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID());
wmsFpStorageNews.setAmount(new BigDecimal(wmsProductPut1.getNumber()));
wmsFpStorageNews.setCreateBy(wmsProductPut.getCreateBy());
wmsFpStorageNews.setGmtCreate(new Date());
if (wmsFpStorageNewsList.size() > 0) {
WmsFpStorageNews wmsFpStorageNews1 = wmsFpStorageNewsList.get(0);
BigDecimal amount = wmsFpStorageNews1.getAmount();
BigDecimal amountAdd = amount.add(wmsFpStorageNews.getAmount());
wmsFpStorageNews1.setAmount(amountAdd);
wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews1);
} else {
wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews);
}
}
return SUCCESS;
}
@Override
public List<WmsRuturnPutEmbryo> FinishedProductSalesReturn(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode());

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

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

@ -214,6 +214,7 @@
<select id="selectByWhCodeAndMate" resultMap="WmsOdsMateStorageNewsResult">
select storage_id, wh_code, region_code, wa_code, storage_type, wl_code, material_code, material_desc, amount, storage_amount, occupy_amount, lpn, product_batch, receive_date, product_date, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, user_defined7, user_defined8, user_defined9, user_defined10, create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code, sap_factory_code, wl_name from wms_ods_mate_storage_news
where wh_code=#{whCode} and wl_code=#{wlCode} and wa_code=#{waCode} and material_code=#{materialCode}
<if test="userDefined2 != null">and user_defined2 = #{userDefined2}</if>
</select>
<select id="selectBaseProductByCode" resultMap="WmsOdsMateStorageNewsResult">
select DISTINCT material_desc,user_defined1

@ -386,33 +386,35 @@
</update>
<select id="WmsProductPutByWorkOrderqueryBS" resultMap="WmsProductPutResult">
SELECT
mes_report_work.report_code work_order,
pro_order_workorder.workorder_code work_order,
pro_order_workorder.workorder_code_sap product_order,
mes_report_work.product_code,
mes_report_work.product_name,
mes_report_work.unit unit_of_measure,
mes_report_work.batch batch_number,
mes_report_work.quantity plan_quantity,
( mes_report_work.quantity- put.put_quantity ) attr3
pro_order_workorder.product_code,
pro_order_workorder.product_name,
pro_order_workorder.unit unit_of_measure,
pro_order_workorder_batch.batch_code batch_number,
pro_order_workorder_batch.batch_quantity plan_quantity,
( pro_order_workorder_batch.batch_quantity- put.put_quantity ) attr3
FROM
pro_order_workorder
LEFT JOIN mes_report_work ON pro_order_workorder.workorder_code = mes_report_work.workorder_code
LEFT JOIN pro_order_workorder_batch ON pro_order_workorder.workorder_id = pro_order_workorder_batch.workorder_id
LEFT JOIN (
SELECT SUM
( wms_product_put.put_quantity ) AS put_quantity,
wms_product_put.work_order AS work_order,
wms_product_put.batch_number AS batch_number,
wms_product_put.product_code AS product_code
FROM
wms_product_put
GROUP BY
wms_product_put.work_order,
wms_product_put.batch_number,
wms_product_put.product_code
) put ON put.work_order= mes_report_work.report_code
) put ON put.batch_number= pro_order_workorder_batch.batch_code
AND put.product_code= pro_order_workorder.workorder_code_sap
WHERE
pro_order_workorder.workorder_code_sap=#{attribute1}
AND mes_report_work.batch=#{attribute2}
AND mes_report_work.parent_order = '0'
pro_order_workorder.workorder_code_sap= #{attribute1}
AND pro_order_workorder_batch.batch_code= #{attribute2}
AND pro_order_workorder_batch.del_flag = '0'
</select>
<select id="selectProOrderWorkorderBatchPallet" resultMap="WmsProductPutResult">
SELECT

Loading…
Cancel
Save