# Conflicts:
#	op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java
#	op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java
#	op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java
master
杨万里 1 month ago
commit 5d87f49468

@ -156,6 +156,9 @@ public interface RemoteSapService {
@PostMapping("/sap/handMadeInStorage")
public R handMadeInStorage(@RequestBody List<SapHandMadeInStorage> list);
@PostMapping("/sap/updateMaterialEntry")
R updateMaterialEntry(@RequestBody List<SapMaterialEntry> list, @RequestParam("optionType") String optionType // 关键指定value
);
}

@ -0,0 +1,71 @@
package com.op.system.api.domain.sap;
/**
* remark
*
* @author 019117
* @date
*/
public class SapMaterialEntry {
private String materialCode;
private String batchCode;
private String factoryCode;
private String areaCode;
private String status;
private String userCode;
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getBatchCode() {
return batchCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
}

@ -193,6 +193,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
return R.fail("手持成品物料收货入库失败" + throwable.getMessage());
}
@Override
public R updateMaterialEntry(List<SapMaterialEntry> list, String optionType) {
return R.fail("更新物料库位失败" + throwable.getMessage());
}
};
}
}

@ -297,7 +297,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
String address = array.getJSONObject(i).getString("Address");
if (address.equals(item.getMonitorId())) {
item.setGlys(getSafeBigDecimal(array.getJSONObject(i), "GLYS"));
item.setZxyg(getSafeBigDecimal(array.getJSONObject(i), "YGGL"));
item.setActivePower(getSafeBigDecimal(array.getJSONObject(i), "YGGL"));
item.setReactivePower(getSafeBigDecimal(array.getJSONObject(i), "WGGL"));
}
@ -316,6 +315,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
for (RecordDnbInstant item : list) {
String address = array.getJSONObject(i).getString("Address");
if (address.equals(item.getMonitorId())) {
item.setZxyg(getSafeBigDecimal(array.getJSONObject(i), "ZYGDNSZ"));
item.setReactivePower(getSafeBigDecimal(array.getJSONObject(i), "ZYGDN"));
}
}
@ -329,8 +329,8 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
for (RecordDnbInstant item : list) {
BaseMonitorInfo temp = new BaseMonitorInfo();
temp.setConnCode(item.getMonitorId());
List<BaseMonitorInfo> BaseList = baseMonitorInfoMapper.selectBaseMonitorInfoList(temp);
for (BaseMonitorInfo base : BaseList) {
List<BaseMonitorInfo> baseList = baseMonitorInfoMapper.selectBaseMonitorInfoList(temp);
for (BaseMonitorInfo base : baseList) {
item.setMonitorId(base.getMonitorId());
recordDnbInstantMapper.insertRecordDnbInstant(item);
}

@ -179,21 +179,21 @@
order by ert.monitor_id, ert.monitor_name, ert.pointTime
</select>
<select id="datePointDnbList" resultType="java.util.Map">
select ert.monitor_id,
ert.monitor_name,
<select id="datePointDnbList" resultType="com.op.energy.report.domain.ReportPointDnbDTO">
select ert.monitor_id monitorId,
ert.monitor_name monitorName,
CAST( CASE
WHEN #{params.timeSub} = 10 THEN ert.pointTime
WHEN #{params.timeSub} = 7 THEN concat(ert.pointTime, '-01')
WHEN #{params.timeSub} = 4 THEN concat(ert.pointTime, '-01-01')
END AS datetime) AS begin_time,
END AS datetime) AS beginTime,
CAST( CASE
WHEN #{params.timeSub} = 10 THEN ert.pointTime
WHEN #{params.timeSub} = 7 THEN EOMONTH(CONVERT(DATE, CONCAT(ert.pointTime, '-01')))
WHEN #{params.timeSub} = 4 THEN EOMONTH(CONVERT(DATE, CONCAT(ert.pointTime, '-12-01')))
END AS datetime) AS end_time,
END AS datetime) AS endTime,
sum(isnull(ert.expend,0)) expend,
max(ert.meter_value) meter_value,
max(ert.meter_value) meterValue,
max(ert.monitor_addr) address
from (
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(19), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,

@ -17,6 +17,7 @@ import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.bean.BeanUtils;
import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.common.core.utils.poi.ExcelReportMapUtil;
import com.op.common.core.web.domain.AjaxResult;
import com.op.quality.domain.*;
import com.op.system.api.domain.mes.ProLineDTO;
import com.op.system.api.domain.quality.ChartDTO;
@ -960,8 +961,8 @@ public class QcStaticTableController extends BaseController {
@Log(title = "白坯缺陷排列报表--数表", businessType = BusinessType.QUERY)
@GetMapping("/getMonthOfDataDefect")
public List<Map<String, String>> getMonthOfDataDefect(QcStaticTable qcStaticTable) {
return qcStaticTableService.getMonthOfDataDefect(qcStaticTable);
public AjaxResult getMonthOfDataDefect(QcStaticTable qcStaticTable) {
return AjaxResult.success(qcStaticTableService.getMonthOfDataDefectV2(qcStaticTable));
}
@Log(title = "白坯缺陷排列报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/getMonthOfDataDefectExport")
@ -1005,12 +1006,12 @@ public class QcStaticTableController extends BaseController {
@Log(title = "白坯不良项目报表--数表", businessType = BusinessType.QUERY)
@GetMapping("/getDefectItemData")
public List<Map<String, String>> getDefectItemData(QcStaticTable qcStaticTable) {
return qcStaticTableService.getDefectItemData(qcStaticTable);
return qcStaticTableService.getDefectItemDataV2(qcStaticTable);
}
@Log(title = "白坯不良项目报表--图表", businessType = BusinessType.QUERY)
@GetMapping("/getDefectItemLine")
public QcStaticTable getDefectItemLine(QcStaticTable qcStaticTable) {
return qcStaticTableService.getDefectItemLine(qcStaticTable);
public AjaxResult getDefectItemLine(QcStaticTable qcStaticTable) {
return AjaxResult.success(qcStaticTableService.getDefectItemLineV2(qcStaticTable));
}
@Log(title = "白坯不良项目报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/getDefectItemDataExport")
@ -1048,12 +1049,12 @@ public class QcStaticTableController extends BaseController {
@Log(title = "白坯性能--数表", businessType = BusinessType.QUERY)
@GetMapping("/getDefectItemDataPC")
public List<Map<String, String>> getDefectItemDataPC(QcStaticTable qcStaticTable) {
return qcStaticTableService.getDefectItemDataPC(qcStaticTable);
return qcStaticTableService.getDefectItemDataPCV2(qcStaticTable);
}
@Log(title = "白坯性能--图表", businessType = BusinessType.QUERY)
@GetMapping("/getDefectItemLinePC")
public QcStaticTable getDefectItemLinePC(QcStaticTable qcStaticTable) {
return qcStaticTableService.getDefectItemLinePC(qcStaticTable);
public Map<String,Object> getDefectItemLinePC(QcStaticTable qcStaticTable) {
return qcStaticTableService.getDefectItemLinePCV2(qcStaticTable);
}
@Log(title = "白坯性能报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/getDefectItemDataPCExport")

@ -2,6 +2,8 @@ package com.op.quality.domain;
import com.op.common.core.web.domain.BaseEntity;
import java.util.List;
/**
* remark
*
@ -28,12 +30,12 @@ public class QcCheckBp extends BaseEntity {
/**
*
* **/
private Integer checkNum;
private Integer checkNum = 0;
/**
*
* **/
private Integer badNum;
private Integer badNum = 0;
/**
*
@ -61,6 +63,15 @@ public class QcCheckBp extends BaseEntity {
* **/
private String createUserName;
/**
*
* **/
private String incomeBatchNo;
/**
*
* **/
private List<QcCheckBpDefect> defectList;
public String getMaterialCode() {
@ -142,4 +153,20 @@ public class QcCheckBp extends BaseEntity {
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
public String getIncomeBatchNo() {
return incomeBatchNo;
}
public void setIncomeBatchNo(String incomeBatchNo) {
this.incomeBatchNo = incomeBatchNo;
}
public List<QcCheckBpDefect> getDefectList() {
return defectList;
}
public void setDefectList(List<QcCheckBpDefect> defectList) {
this.defectList = defectList;
}
}

@ -0,0 +1,50 @@
package com.op.quality.domain;
/**
* remark
*
* @author 019117
* @date
*/
public class QcCheckBpDefect {
private Integer badNum = 0;
private String badItem;
private String defectCode;
private String defectSubclass;
public Integer getBadNum() {
return badNum;
}
public void setBadNum(Integer badNum) {
this.badNum = badNum;
}
public String getBadItem() {
return badItem;
}
public void setBadItem(String badItem) {
this.badItem = badItem;
}
public String getDefectCode() {
return defectCode;
}
public void setDefectCode(String defectCode) {
this.defectCode = defectCode;
}
public String getDefectSubclass() {
return defectSubclass;
}
public void setDefectSubclass(String defectSubclass) {
this.defectSubclass = defectSubclass;
}
}

@ -1,6 +1,7 @@
package com.op.quality.mapper;
import com.op.quality.domain.QcCheckBp;
import com.op.quality.domain.QcCheckTaskDefect;
import com.op.quality.domain.QcCheckTaskIncome;
import org.apache.ibatis.annotations.Mapper;
@ -20,6 +21,8 @@ public interface QcCheckBpMapper {
void insertCheckBpResult( QcCheckTaskIncome task );
void batchInsertCheckBpDefects( List<QcCheckTaskDefect> list );
}

@ -159,4 +159,10 @@ public interface QcStaticTableMapper {
List<String> getCpDefectTypes(QcStaticTable qcStaticTable);
String getGroupIdByOrderNo(String orderNo);
List<QcCheckTaskDefect> getBPDefectList(QcStaticTable qcStaticTable);
List<QcCheckTaskDefect> getBPDefectMothMapV2(QcStaticTable qcStaticTable);
List<QcCheckTaskDefect> getBPDefectMothPCMapV2(QcStaticTable qcStaticTable);
}

@ -97,4 +97,17 @@ public interface IQcStaticTableService {
List<String> getCpDateTitle(QcStaticTable qcStaticTable);
List<Map<String, String>> getCpDefectDate(QcStaticTable qcStaticTable);
List<Map<String,String>> getMonthOfDataDefectV2(QcStaticTable qcStaticTable);
Map<String,Object> getDefectItemLineV2(QcStaticTable qcStaticTable);
Map<String,Object> getDefectItemLinePCV2(QcStaticTable qcStaticTable);
List<Map<String, String>> getDefectItemDataPCV2(QcStaticTable qcStaticTable);
List<Map<String, String>> getDefectItemDataV2(QcStaticTable qcStaticTable);
}

@ -3,19 +3,17 @@ package com.op.quality.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.quality.domain.QcCheckBp;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckTaskProduce;
import com.op.quality.domain.*;
import com.op.quality.mapper.QcCheckBpMapper;
import com.op.quality.mapper.QcCheckTaskIncomeMapper;
import com.op.quality.mapper.QcCheckTaskProduceMapper;
import com.op.quality.service.IQcCheckBpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -67,7 +65,29 @@ public class QcCheckBpServiceImpl implements IQcCheckBpService {
task.setOrderType("bp");
task.setRemark(params.getRemark());
task.setRemarkCode(params.getBadItem());
task.setIncomeBatchNo(params.getIncomeBatchNo());
qcCheckBpMapper.insertCheckBpResult(task);
List<QcCheckTaskDefect> defectList = new ArrayList<>();
for (QcCheckBpDefect item : params.getDefectList()) {
QcCheckTaskDefect defect = new QcCheckTaskDefect();
defect.setRecordId(IdUtils.fastSimpleUUID());
defect.setDefectCode(item.getDefectCode());
defect.setDefectSubclass(item.getDefectSubclass());
defect.setCreateBy(params.getCreateBy());
defect.setFactoryCode("ds_"+params.getFactoryCode());
defect.setBelongTo(task.getRecordId());
defect.setOkQuality(new BigDecimal(params.getCheckNum()));
defect.setNoOkQuality(new BigDecimal(item.getBadNum()));
defect.setClassId(item.getBadItem());
defectList.add(defect);
}
if (!CollectionUtils.isEmpty(defectList)) {
qcCheckBpMapper.batchInsertCheckBpDefects(defectList);
}
}

@ -1769,6 +1769,70 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return dtos;
}
@Override
@DS("#header.poolName")
public List<Map<String,String>> getMonthOfDataDefectV2(QcStaticTable qcStaticTable) {
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
List<QcCheckTaskDefect> list = qcStaticTableMapper.getBPDefectList(qcStaticTable);
List<Map<String,String>> result = new ArrayList<>();
for (String defect : bpDefects){
Map<String,String> map = new HashMap<>();
map.put("defect",defect);
int count = 0;
for (QcCheckTaskDefect data : list){
if (defect.equals(data.getDefectSubclass())){
map.put(data.getAttr1(),data.getAttr2());
if (StringUtils.isNotBlank(data.getAttr2())){
count = count + Integer.parseInt(data.getAttr2());
}
}
}
map.put("count", Integer.toString(count));
result.add(map);
}
int count1 = 0;
int count2 = 0;
Map<String,String> map1 = new HashMap<>();
map1.put("defect","合计");
Map<String,String> map2 = new HashMap<>();
map2.put("defect","抽样数");
for (QcCheckTaskDefect data : list){
if ("合计".equals(data.getDefectSubclass())){
map1.put(data.getAttr1(),data.getAttr2());
map2.put(data.getAttr1(),data.getAttr3());
if (StringUtils.isNotBlank(data.getAttr2())){
count1 = count1 + Integer.parseInt(data.getAttr2());
}
if (StringUtils.isNotBlank(data.getAttr3())){
count2 = count2 + Integer.parseInt(data.getAttr3().replace(".00",""));
}
}
}
map1.put("count", Integer.toString(count1));
map2.put("count", Integer.toString(count2));
result.add(map1);
result.add(map2);
return result;
}
@Override
@DS("#header.poolName")
public List<Map<String, String>> getDefectItemDataV2(QcStaticTable qcStaticTable) {
List<Map<String, String>> dtos = new ArrayList<>();
//获取不良种类
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
qcStaticTable.setYearMonth(null);
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
dtos.add(computerBpDefectsRate(monthList,"num","不良数", bpDefects));
dtos.add(computerBpDefectsRate(monthList,"rate","不良比例", bpDefects));
dtos.add(computerBpDefectsRate(totalList,"rate","累计不良比例", bpDefects));
return dtos;
}
@Override
@DS("#header.poolName")
public List<String> getDefectItemTitle(QcStaticTable qcStaticTable) {
@ -1888,6 +1952,80 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return dto;
}
@Override
@DS("#header.poolName")
public Map<String,Object> getDefectItemLineV2(QcStaticTable qcStaticTable) {
Map<String,Object> result = new HashMap<>();
//获取不良种类
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
result.put("xData",bpDefects);
//当前查询月份的不良率
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
//计算总不良率
//不良数
BigDecimal noOkQty = new BigDecimal(0);
//样品数
BigDecimal sampleQty = new BigDecimal(0);
for (QcCheckTaskDefect item : monthList){
if (StringUtils.isNotBlank(item.getAttr2())){
noOkQty = noOkQty.add(new BigDecimal(item.getAttr2()));
}
if (StringUtils.isNotBlank(item.getAttr3())){
sampleQty = sampleQty.add(new BigDecimal(item.getAttr3()));
}
}
//不良率
BigDecimal noOkRate = new BigDecimal(0);
if (sampleQty.compareTo(BigDecimal.ZERO) > 0){
noOkRate = noOkQty.divide(sampleQty,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
}
//合格率
BigDecimal okRate = new BigDecimal(100).subtract(noOkRate);
result.put("noOkQty",noOkQty);
result.put("sampleQty",sampleQty);
result.put("noOkRate",noOkRate);
result.put("okRate",okRate);
List<String> yDataLeft = new ArrayList<>();
for (String defect : bpDefects) {
boolean flag = true;
for (QcCheckTaskDefect item : monthList){
if (defect.equals(item.getDefectSubclass())){
yDataLeft.add(item.getAttr1());
flag = false;
break;
}
}
if (flag){
yDataLeft.add("0");
}
}
result.put("yDataLeft",yDataLeft);
//累计不良率
qcStaticTable.setYearMonth(null);
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
List<String> yDataRight = new ArrayList<>();
for (String defect : bpDefects) {
boolean flag = true;
for (QcCheckTaskDefect item : totalList){
if (defect.equals(item.getDefectSubclass())){
yDataRight.add(item.getAttr1());
flag = false;
break;
}
}
if (flag){
yDataRight.add("0");
}
}
result.put("yDataRight",yDataRight);
return result;
}
@Override
@DS("#header.poolName")
public List<Map<String, String>> getDefectItemDataPC(QcStaticTable qcStaticTable) {
@ -1933,6 +2071,55 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return dtos;
}
@Override
@DS("#header.poolName")
public List<Map<String, String>> getDefectItemDataPCV2(QcStaticTable qcStaticTable) {
List<Map<String, String>> dtos = new ArrayList<>();
//获取不良种类
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
qcStaticTable.setYearMonth(null);
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
dtos.add(computerBpDefectsRate(monthList,"num","不良数", bpDefects));
dtos.add(computerBpDefectsRate(monthList,"rate","不良比例", bpDefects));
dtos.add(computerBpDefectsRate(totalList,"rate","累计不良比例", bpDefects));
return dtos;
}
//计算
private Map<String,String> computerBpDefectsRate(List<QcCheckTaskDefect> list, String type, String title, List<String> bpDefects ){
Map<String,String> result= new HashMap<>();
result.put("dataType",title);
int i = 0;
for (String defect : bpDefects) {
for (QcCheckTaskDefect item : list){
if (defect.equals(item.getDefectSubclass())){
if (StringUtils.isNotBlank(item.getAttr1())){
if ("rate".equals(type)){
result.put("item"+i, item.getAttr1());
}else {
if (StringUtils.isNotBlank(item.getAttr2())){
result.put("item"+i,new BigDecimal(item.getAttr1()).divide(new BigDecimal(item.getAttr2()),2,RoundingMode.HALF_UP).toString());
}else {
result.put("item"+i,"100");
}
}
}else {
result.put("item"+i,"0");
}
break;
}
}
i++;
}
return result;
}
@Override
@DS("#header.poolName")
public QcStaticTable getDefectItemLinePC(QcStaticTable qcStaticTable) {
@ -2001,6 +2188,81 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return dto;
}
@Override
@DS("#header.poolName")
public Map<String,Object> getDefectItemLinePCV2(QcStaticTable qcStaticTable) {
Map<String,Object> result = new HashMap<>();
//获取不良种类
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
result.put("xData",bpDefects);
//当前查询月份的不良率
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
//计算总不良率
//不良数
BigDecimal noOkQty = new BigDecimal(0);
//样品数
BigDecimal sampleQty = new BigDecimal(0);
for (QcCheckTaskDefect item : monthList){
if (StringUtils.isNotBlank(item.getAttr2())){
noOkQty = noOkQty.add(new BigDecimal(item.getAttr2()));
}
if (StringUtils.isNotBlank(item.getAttr3())){
sampleQty = sampleQty.add(new BigDecimal(item.getAttr3()));
}
}
//不良率
BigDecimal noOkRate = new BigDecimal(0);
if (sampleQty.compareTo(BigDecimal.ZERO) > 0){
noOkRate = noOkQty.divide(sampleQty,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
}
//合格率
BigDecimal okRate = new BigDecimal(100).subtract(noOkRate);
result.put("noOkQty",noOkQty);
result.put("sampleQty",sampleQty);
result.put("noOkRate",noOkRate);
result.put("okRate",okRate);
List<String> yDataLeft = new ArrayList<>();
for (String defect : bpDefects) {
boolean flag = true;
for (QcCheckTaskDefect item : monthList){
if (defect.equals(item.getDefectSubclass())){
yDataLeft.add(item.getAttr1());
flag = false;
break;
}
}
if (flag){
yDataLeft.add("0");
}
}
result.put("yDataLeft",yDataLeft);
//累计不良率
qcStaticTable.setYearMonth(null);
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
List<String> yDataRight = new ArrayList<>();
for (String defect : bpDefects) {
boolean flag = true;
for (QcCheckTaskDefect item : totalList){
if (defect.equals(item.getDefectSubclass())){
yDataRight.add(item.getAttr1());
flag = false;
break;
}
}
if (flag){
yDataRight.add("0");
}
}
result.put("yDataRight",yDataRight);
return result;
}
@Override
@DS("#header.poolName")
public List<String> getCpDateTitle(QcStaticTable qcStaticTable) {

@ -99,4 +99,17 @@
</trim>
</insert>
<insert id="batchInsertCheckBpDefects">
insert into qc_check_task_defect(
record_id, defect_code, defect_subclass, create_by, create_time,
factory_code, belong_to, ok_quality, noOk_quality, class_id
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.recordId}, #{item.defectCode}, #{item.defectSubclass}, #{item.createBy}, GETDATE(),
#{item.factoryCode}, #{item.belongTo}, #{item.okQuality}, #{item.noOkQuality},#{item.classId}
)
</foreach>
</insert>
</mapper>

@ -359,7 +359,12 @@
select qct.record_id, qct.check_no, qct.income_batch_no,
qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status,
qct.check_time, qct.check_result, qct.check_type,'首件检验' check_name,
qct.check_time, qct.check_result, qct.check_type,
CASE
WHEN 'checkTypeSC' = #{checkType} THEN '首件检验'
WHEN 'checkTypeCPPC' = #{checkType} THEN '批次成品检验'
ELSE ''
END check_name,
CONVERT(varchar(10),qct.create_time, 120) createTimeStr,
qct.confirm,qct.confirm_man_name,qct.check_man_code ,qct.check_man_name
from qc_check_task qct
@ -386,44 +391,8 @@
<if test="incomeTimeEnd != null ">and #{incomeTimeEnd} > CONVERT(varchar(30),qct.income_time, 120)</if>
<if test="checkTimeStart != null ">and CONVERT(varchar(30),qct.create_time, 120) >= #{checkTimeStart}</if>
<if test="checkTimeEnd != null ">and #{checkTimeEnd} > CONVERT(varchar(30),qct.create_time, 120)</if>
and qct.check_type = 'checkTypeSC' and qct.del_flag = '0'
and qct.check_type in ('checkTypeSC','checkTypeCPPC') and qct.del_flag = '0'
</where>
union ALL
select
'','','',
qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name,CONVERT(varchar(10), qct.income_time, 120) income_time,'','',
null,'', qct.check_type,'巡检检验' check_name,CONVERT(varchar(10),qct.create_time, 120) createTimeStr,
qct.confirm,qct.confirm_man_name,'',''
from qc_check_task qct
<where>
<if test="checkNo != null and checkNo != ''">and qct.check_no = #{checkNo}</if>
<if test="incomeBatchNo != null and incomeBatchNo != ''">and qct.income_batch_no = #{incomeBatchNo}</if>
<if test="orderNo != null and orderNo != ''">and qct.order_no = #{orderNo}</if>
<if test="materialCode != null and materialCode != ''">and qct.material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and qct.material_name like concat('%',
#{materialName}, '%')
</if>
<if test="supplierCode != null and supplierCode != ''">and qct.supplier_code = #{supplierCode}</if>
<if test="supplierName != null and supplierName != ''">and qct.supplier_name like concat('%',
#{supplierName}, '%')
</if>
<if test="checkLoc != null and checkLoc != ''">and qct.check_loc = #{checkLoc}</if>
<if test="checkStatus != null and checkStatus != ''">and qct.check_status = #{checkStatus}</if>
<if test="checkManCode != null and checkManCode != ''">and qct.check_man_code = #{checkManCode}</if>
<if test="checkManName != null and checkManName != ''">and qct.check_man_name like concat('%',
#{checkManName}, '%')
</if>
<if test="checkResult != null and checkResult != ''">and qct.check_result = #{checkResult}</if>
<if test="incomeTimeStart != null ">and CONVERT(varchar(30),qct.income_time, 120) >= #{incomeTimeStart}</if>
<if test="incomeTimeEnd != null ">and #{incomeTimeEnd} > CONVERT(varchar(30),qct.income_time, 120)</if>
<if test="checkTimeStart != null ">and CONVERT(varchar(30),qct.create_time, 120) >= #{checkTimeStart}</if>
<if test="checkTimeEnd != null ">and #{checkTimeEnd} > CONVERT(varchar(30),qct.create_time, 120)</if>
and qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
</where>
GROUP BY qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name,CONVERT(varchar(10), qct.income_time, 120), qct.check_type,CONVERT(varchar(10),qct.create_time, 120),
qct.confirm,qct.confirm_man_name
) t
left join pro_order_workorder pow on pow.workorder_code = t.order_no
where pow.del_flag = '0'

@ -1412,4 +1412,79 @@
where pow.workorder_code = #{orderNo}
</select>
<select id="getBPDefectList" resultType="com.op.quality.domain.QcCheckTaskDefect">
SELECT
tc.class_name defectSubclass,
FORMAT ( qct.create_time, 'yyyy-MM-dd' ) attr1,
SUM(td.noOk_quality) attr2,
SUM(qct.sample_quality) attr3
FROM qc_check_task qct
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
AND qct.order_type = 'bp'
GROUP BY tc.class_name, FORMAT ( qct.create_time, 'yyyy-MM-dd' )
UNION ALL
SELECT
'合计' defectSubclass,
FORMAT ( qct.create_time, 'yyyy-MM-dd' ) attr1,
SUM ( td.noOk_quality ) attr2,
SUM ( qct.sample_quality ) attr3
FROM qc_check_task qct
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
AND qct.order_type = 'bp'
GROUP BY FORMAT ( qct.create_time, 'yyyy-MM-dd' )
</select>
<select id="getBPDefectMothMapV2" resultType="com.op.quality.domain.QcCheckTaskDefect">
SELECT
tc.class_name defectSubclass,
SUM ( td.noOk_quality ) / SUM ( qct.sample_quality ) * 100 attr1,
SUM ( td.noOk_quality ) attr2,
SUM ( qct.sample_quality ) attr3
FROM qc_check_task qct
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND qct.order_type = 'bp'
<if test="yearMonth !=null and yearMonth != ''">
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
</if>
GROUP BY tc.class_name
</select>
<select id="getBPDefectMothPCMapV2" resultType="com.op.quality.domain.QcCheckTaskDefect">
SELECT
t.defectSubclass,
SUM ( t.attr2 ) attr2,
SUM ( t.attr3 ) attr3
FROM
(
SELECT
tc.class_name defectSubclass,
SUM (CASE WHEN qct.check_status = 'N' THEN 1 ELSE 0 END) attr2,
COUNT ( 0 ) attr3,
qct.income_batch_no
FROM qc_check_task qct
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND qct.order_type = 'bp'
<if test="yearMonth !=null and yearMonth != ''">
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
</if>
GROUP BY tc.class_name, qct.income_batch_no
) t
GROUP BY
t.defectSubclass
</select>
</mapper>

@ -652,4 +652,13 @@ public class SapController extends BaseController {
public R handMadeInStorage(@RequestBody List<SapHandMadeInStorage> list) {
return sapOrderService.handMadeInStorage(list);
}
/**
*
* **/
@PostMapping("/updateMaterialEntry")
@Log(title = "物料库区填报", businessType = BusinessType.SAP)
public R updateMaterialEntry(@RequestBody List<SapMaterialEntry> list, @RequestParam("optionType") String optionType) {
return sapWmsService.updateMaterialEntry(list, optionType);
}
}

@ -1,6 +1,10 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.system.api.domain.sap.SapHandMadeInStorage;
import com.op.system.api.domain.sap.SapMaterialEntry;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@ -14,4 +18,6 @@ public interface SapWmsService {
R sapProductOutboundCostCenter(List<Map<String, Object>> mapList);
R sapProductOutboundCostTW(List<Map<String, Object>> mapList);
R updateMaterialEntry(List<SapMaterialEntry> list, String optionType) ;
}

@ -3,17 +3,17 @@ package com.op.sap.service.impl;
import com.op.common.core.domain.R;
import com.op.common.core.utils.StringUtils;
import com.op.sap.service.SapWmsService;
import com.op.system.api.domain.sap.SapHandMadeInStorage;
import com.op.system.api.domain.sap.SapMaterialEntry;
import com.sap.conn.jco.*;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
@Service
@ -318,4 +318,61 @@ public class SapWmsServicelmpl implements SapWmsService {
return R.fail(e.getMessage());
}
}
@Override
public R updateMaterialEntry(List<SapMaterialEntry> list, String optionType) {
if (CollectionUtils.isEmpty(list)) {
throw new RuntimeException("参数list不存在或长度为0");
}
if (StringUtils.isBlank(optionType)) {
throw new RuntimeException("没有指定读写操作");
}
try {
JCoRepository repository = dest.getRepository();
JCoFunction sapFunction = repository.getFunction("ZMB_MODIFY_ZMMKW");
if ("1".equals(optionType)){
sapFunction.getImportParameterList().setValue("P_WRITE", "X");
}
if ("2".equals(optionType)){
sapFunction.getImportParameterList().setValue("P_DELETE", "X");
}
Date now = new Date();
JCoTable table = sapFunction.getTableParameterList().getTable("IN_ZMMKW");
for (SapMaterialEntry item : list) {
table.appendRow();
//物料编码
table.setValue("MATNR", "0000000" + item.getMaterialCode());
//批次
table.setValue("CHARG", item.getBatchCode());
//工厂
table.setValue("WERKS", item.getFactoryCode());
//区位
table.setValue("ABLAD", item.getAreaCode());
//状态
table.setValue("ZTYPE", item.getStatus());
//修改人
table.setValue("ZNAME", item.getUserCode());
//修改日期
table.setValue("ZMDDAT", now);
}
sapFunction.execute(dest);
String code = sapFunction.getExportParameterList().getString("RETCODE");
String msg = sapFunction.getExportParameterList().getString("RETMSG");
if (!"0".equals(code)) {
throw new Exception("提交物料库区填报失败:"+msg);
}
return R.ok();
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage());
return R.fail(e.getMessage());
}
}
}

@ -0,0 +1,159 @@
package com.op.wms.domain;
import com.op.common.core.web.domain.BaseEntity;
/**
* remark
*
* @author 019117
* @date
*/
public class WmsStockAreaEntry extends BaseEntity {
private Long id;
/**
*
* **/
private String productionDate;
/**
*
* **/
private String workOrderCode;
/**
*
* **/
private String status;
/**
*
* **/
private String materialCode;
/**
*
* **/
private String materialName;
/**
*
* **/
private String batchCode;
/**
*
* **/
private String factoryCode;
/**
*
* **/
private String location;
/**
*
* **/
private String areaCode;
/**
* -
* **/
private String beginDate;
/**
* -
* **/
private String endDate;
public String getProductionDate() {
return productionDate;
}
public void setProductionDate(String productionDate) {
this.productionDate = productionDate;
}
public String getWorkOrderCode() {
return workOrderCode;
}
public void setWorkOrderCode(String workOrderCode) {
this.workOrderCode = workOrderCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
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 String getBatchCode() {
return batchCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getBeginDate() {
return beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}

@ -3,10 +3,7 @@ package com.op.wms.mapper;
import java.util.List;
import com.op.system.api.domain.sap.SapMaterialPosting;
import com.op.wms.domain.OdsProcureOrder;
import com.op.wms.domain.OdsProcureOutOrder;
import com.op.wms.domain.WmsOdsEmStorageNews;
import com.op.wms.domain.WmsOdsMateStorageNews;
import com.op.wms.domain.*;
import org.apache.ibatis.annotations.Param;
/**
@ -185,4 +182,10 @@ public interface OdsProcureOutOrderMapper {
int removeReturn(String[] IDs);
List<OdsProcureOutOrder> selectWmsOdsProcureReturnOrderByProduceCode(String order);
List<WmsStockAreaEntry> getStockAreaEntryList(WmsStockAreaEntry params);
List<WmsStockAreaEntry> batchCheckDuplication(List<WmsStockAreaEntry> list );
void batchInsertMaterialEntry(List<WmsStockAreaEntry> list);
}

@ -2141,4 +2141,66 @@
and wms_ods_procure_return_order.User_Defined10!='2'
and Order_Status='3'
</select>
<select id="getStockAreaEntryList" resultType="com.op.wms.domain.WmsStockAreaEntry" parameterType="com.op.wms.domain.WmsStockAreaEntry">
SELECT
CONVERT(VARCHAR, pow.product_date, 23) productionDate,
SUBSTRING(pow.workorder_code_sap, 4, 10) workOrderCode,
SUBSTRING(pow.product_code, 8,11) materialCode,
pow.product_name materialName,
CASE
WHEN LEN(powb.batch_code) = 24 THEN SUBSTRING(powb.batch_code, 13, 10)
WHEN LEN(powb.batch_code) <![CDATA[ < ]]> 24 THEN powb.batch_code
WHEN LEN(powb.batch_code) > 24 THEN CONVERT(VARCHAR(8), pow.create_time, 112)
ELSE ''
END 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.product_code like '00000001%' and pow.parent_order = '0'
<if test="beginDate != null ">and CONVERT(varchar(10),pow.product_date, 120) >= '${beginDate}'</if>
<if test="endDate != null ">and '${endDate}' >= CONVERT(varchar(10),pow.product_date, 120)</if>
<if test="workOrderCode != null and workOrderCode != ''">and pow.workorder_code like concat('%', #{workOrderCode}, '%')</if>
<if test="status != null and status != ''">and pow.status = #{status}</if>
<if test="materialCode != null and materialCode != ''">and pow.product_code like concat('%', #{materialCode},'%')</if>
ORDER BY pow.workorder_code_sap, powb.batch_code
</select>
<select id="batchCheckDuplication" resultType="com.op.wms.domain.WmsStockAreaEntry" parameterType="list">
SELECT material_code materialCode, batch_code batchCode, factory_code factoryCode, area_code areaCode
FROM wms_material_entry
WHERE CONCAT(material_code, batch_code, factory_code, area_code) IN
<foreach collection="list" item="item" open="(" separator="," close=")">
CONCAT(#{item.materialCode}, #{item.batchCode}, #{item.factoryCode}, #{item.areaCode})
</foreach>
</select>
<insert id="batchInsertMaterialEntry" parameterType="list">
INSERT INTO wms_material_entry (
work_order_code,
material_code,
batch_code,
factory_code,
location,
area_code,
status,
create_time,
create_by
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.workOrderCode},
#{item.materialCode},
#{item.batchCode},
#{item.factoryCode},
#{item.location},
#{item.areaCode},
#{item.status},
GETDATE(),
#{item.createBy}
)
</foreach>
</insert>
</mapper>

Loading…
Cancel
Save