Merge remote-tracking branch 'origin/master'

master
Yangwl 11 months ago
commit 3cdac663ca

@ -44,4 +44,7 @@ public interface RemoteQualityService {
@PostMapping("/qcDetail/resendWXTask")
public R resendWXTask();
@PostMapping("/qcInventory/createCCTask")
public R createCCTask();
}

@ -233,6 +233,46 @@ public class BaseProductDTO extends BaseEntity {
/** 其它 */
@Excel(name = "其它")
private String other;
/**标准模板**/
private String mvgr5;
/**单位**/
private String meins;
//转换分子
private String umrez;
//转换分母
private String umren;
public String getUmren() {
return umren;
}
public void setUmren(String umren) {
this.umren = umren;
}
public String getUmrez() {
return umrez;
}
public void setUmrez(String umrez) {
this.umrez = umrez;
}
public String getMeins() {
return meins;
}
public void setMeins(String meins) {
this.meins = meins;
}
public String getMvgr5() {
return mvgr5;
}
public void setMvgr5(String mvgr5) {
this.mvgr5 = mvgr5;
}
public void setCategory(String category) {
this.category = category;

@ -62,6 +62,11 @@ public class RemoteQualityFallbackFactory implements FallbackFactory<RemoteQuali
public R resendWXTask() {
return R.fail("微信二次提醒失败:" + throwable.getMessage());
}
@Override
public R createCCTask() {
return R.fail("仓库检验任务失败:" + throwable.getMessage());
}
};
}
}

@ -280,6 +280,15 @@ public class EquOrder extends BaseEntity {
//工具
private String itemTools;
// 创建日期范围list
private List<Date> createTimeArray;
// 创建日期开始
private String createTimeStart;
// 创建日期结束
private String createTimeEnd;
public String getPicturePath() {
return picturePath;
}
@ -790,6 +799,32 @@ public class EquOrder extends BaseEntity {
this.itemTools = itemTools;
}
public List<Date> getCreateTimeArray() {
return createTimeArray;
}
public void setCreateTimeArray(List<Date> createTimeArray) {
this.createTimeArray = createTimeArray;
}
//创建时间
public String getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(String createTimeStart) {
this.createTimeStart = createTimeStart;
}
public String getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(String createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -154,6 +154,16 @@ public class EquOrderServiceImpl implements IEquOrderService {
@DS("#header.poolName")
public List<EquOrder> selectEquOrderList(EquOrder equOrder) {
// 创建时间列表不为空
if (equOrder.getCreateTimeArray() != null) {
// 设置创建日期开始和结束值
if (equOrder.getCreateTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
equOrder.setCreateTimeStart(formatter.format(equOrder.getCreateTimeArray().get(0)));
equOrder.setCreateTimeEnd(formatter.format(equOrder.getCreateTimeArray().get(1)));
}
}
// 循环开始时间列表不为空
if (equOrder.getLoopStartArray() != null) {
equOrder.setLoopStart(equOrder.getLoopStartArray().get(0));
@ -202,6 +212,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
@DS("#header.poolName")
public AjaxResult insertEquOrder(EquOrder equOrder) {
equOrder.setCreateTime(DateUtils.getNowDate());
equOrder.setCreateBy(SecurityUtils.getUsername());
return success();
}

@ -130,7 +130,8 @@
<if test="attr3 != null and attr3 != ''">and eo.attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''">and eo.del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != ''">and eo.create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null ">and CONVERT(date,eo.create_time) = #{createTime}</if>
<if test="createTimeStart != null ">and CONVERT(date,eo.create_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null ">and #{createTimeEnd} >= CONVERT(date,eo.create_time)</if>
<if test="updateBy != null and updateBy != ''">and eo.update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null ">and CONVERT(date,eo.update_time) = #{updateTime}</if>
<if test="upkeep != null ">and eo.upkeep = #{upkeep}</if>

@ -75,16 +75,16 @@
<if test="price != null ">and price = #{price}</if>
<if test="monitorSubset != null and monitorSubset != ''">
and (report_point_water.monitor_id = #{monitorSubset} OR report_point_water.monitor_id IN
(SELECT t.monitor_id FROM base_monitor_info t WHERE FIND_IN_SET(#{monitorSubset}, ancestors)))
(SELECT t.monitor_id FROM base_monitor_info t WHERE dbo.FIND_IN_SET(#{monitorSubset}, ancestors) > 0))
</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and begin_time between #{params.beginBeginTime} and #{params.endBeginTime}
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime}
</if>
<if test="params.startTime != null and params.startTime != '' and params.endTime != null and params.endTime != ''">
and begin_time between #{params.startTime} and #{params.endTime}
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.startTime} and #{params.endTime}
</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and begin_time between #{params.beginCollectTime} and #{params.endCollectTime}
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="beginTime != null ">and begin_time = #{beginTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
@ -116,9 +116,9 @@
where report_point_water.objid = #{objid}
</select>
<select id="energyConsumptionReportByTime" resultType="java.util.Map">
select ert.pointTime, sum(if(ert.expend is null, 0, ert.expend)) expend
select ert.pointTime, sum(isnull(ert.expend,0)) expend
from (
select left(rpd.begin_time, #{timeSub}) pointTime, rpd.expend
select left(left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10), #{timeSub}) pointTime, rpd.expend
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -134,7 +134,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(rpd.begin_time, 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -144,7 +144,7 @@
<select id="energyConsumptionAnalysisDetails" resultType="java.util.Map">
select ert.monitor_id, ert.monitor_name, ert.pointTime, sum(if(ert.expend is null, 0, ert.expend)) expend
from (
select rpd.monitor_id, m.monitor_name, left(rpd.begin_time, 10) pointTime, rpd.expend
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) pointTime, rpd.expend
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -158,7 +158,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(rpd.begin_time, 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -168,21 +168,21 @@
<select id="datePointWaterList" parameterType="ReportPointWaterDTO" resultMap="ReportPointWaterDTOResult">
select ert.monitor_id,
ert.monitor_name,
CASE
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 begin_time,
CASE
END AS datetime) AS begin_time,
CAST( CASE
WHEN #{params.timeSub} = 10 THEN ert.pointTime
WHEN #{params.timeSub} = 7 THEN LAST_DAY(concat(ert.pointTime, '-01'))
WHEN #{params.timeSub} = 4 THEN LAST_DAY(concat(ert.pointTime, '-12-01'))
END AS end_time,
sum(if(ert.expend is null, 0, ert.expend)) expend,
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,
sum(isnull(ert.expend,0)) expend,
max(ert.meter_value) meter_value,
max(ert.monitor_addr) address
from (
select rpd.monitor_id, m.monitor_name, left(rpd.begin_time, #{params.timeSub}) pointTime, rpd.expend,
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,
rpd.meter_value,m.monitor_addr
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
@ -209,9 +209,8 @@
rpd.monitor_id monitorId,
m.monitor_name monitorName,
m.monitor_addr address,
sum(if(rpd.expend is null, 0, rpd.expend)) expend,
sum(isnull(rpd.expend,0)) expend,
max(rpd.meter_value) meterValue,
GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser,
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
m.monitor_hierarchy monitorHierarchy,
m.grade
@ -232,7 +231,7 @@
left join base_public_user bpu on bmp.public_share_id = bpu.id
<where>
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="monitorIdList != null and monitorIdList.size > 0">
and rpd.monitor_id IN

@ -184,6 +184,12 @@ public class RyTask {
logger.info("++质量管理系统+检验任务一小时后重新发送微信提醒+开始++resendWXTask+++++");
remoteQualityService.resendWXTask();
}
//库存检验任务创建,每天分钟执行一次
public void createCCTask(){
logger.info("++质量管理系统+仓库检验任务创建+开始++createCheckTypeCCTask+++++");
remoteQualityService.createCCTask();
}
/************质量管理系统定时任务结束*****************/
/************hr 人力基础数据定时任务开始*****************/

@ -56,8 +56,6 @@ import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.core.utils.poi.ExcelUtilDailyReport;
import static com.op.common.core.utils.poi.ExcelUtil.exportToExcel;
/**
* Controller
*

@ -113,6 +113,10 @@ public class MesBoradServiceImpl implements IMesBoradService {
//当前工单信息
BoardDTO workOrder = mesMapper.getWorkOrder(boardDTO);
if(workOrder == null || StringUtils.isEmpty(workOrder.getWorkorderCode())){
return dtoMap;
}
boardDTO.setWorkorderCode(workOrder.getWorkorderCode());
boardDTO.setProductCode(workOrder.getProductCode());
MesLine meslineInfo = mesMapper.getMesLineInfo(boardDTO);

@ -337,9 +337,12 @@
pow.unit
from pro_order_workorder pow
left join base_equipment be on pow.workorder_name = be.equipment_code and be.equipment_type_code = 'equ_type_bzx'
where pow.workorder_name = #{equCode} and pow.status = 'w2'
where pow.workorder_name = #{equCode} <!--and pow.status = 'w2'-->
and CONVERT ( DATE, pow.product_date ) = CONVERT ( DATE, GETDATE( ) )
and pow.parent_order = '0' and pow.del_flag='0'
<if test="workorderCodeSap != null and workorderCodeSap != ''">
and pow.workorder_code_sap = #{workorderCodeSap}
</if>
</select>
<select id="getTaskInfo" resultType="com.op.system.api.domain.quality.QcCheckTaskDTO">
select count(0) quality,
@ -362,22 +365,25 @@
group by check_result
</select>
<select id="getPorOrderList" resultType="com.op.mes.domain.ProOrderWorkorder">
select pow.workorder_code_sap workorderCodeSap,
pow.product_name productName,
powb.batch_code batchCode,
powb.batch_quantity quantitySplit,
t.quantityFeedback quantityProduced
from pro_order_workorder pow
left join pro_order_workorder_batch powb on powb.workorder_id = pow.workorder_id
left join (
select workorder_code,batch,sum(quantity_feedback) quantityFeedback from mes_report_work
where CONVERT(varchar(10),feedback_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
and del_flag = '0'
group by workorder_code,batch
)t on pow.workorder_code = t.workorder_code and powb.batch_code = t.batch
where pow.del_flag = '0' and CONVERT(varchar(10),pow.product_date, 120) = CONVERT(varchar(10),GETDATE(), 120)
and pow.workorder_name = #{equCode} and pow.parent_order ='0' and powb.del_flag = '0'
order by powb.batch_code
select t0.*,t.quantityProduced from
(
select pow.workorder_code_sap workorderCodeSap,
pow.workorder_code workorderCode,
pow.product_name productName,
powb.batch_code batchCode,
powb.batch_quantity quantitySplit
from pro_order_workorder pow
left join pro_order_workorder_batch powb on powb.workorder_id = pow.workorder_id
where pow.del_flag = '0' and CONVERT(varchar(10),pow.product_date, 120) = CONVERT(varchar(10),GETDATE(), 120)
and pow.workorder_name = #{equCode} and pow.parent_order ='0' and powb.del_flag = '0'
) t0
left join (
select workorder_code,batch,sum(quantity_feedback) quantityProduced from mes_report_work
where CONVERT(varchar(10),feedback_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
and del_flag = '0'
group by workorder_code,batch
)t on t0.workorderCode = t.workorder_code and t0.batchCode = t.batch
order by t0.batchCode
</select>
<select id="getHFProInfo" resultType="com.op.system.api.domain.dto.BoardDTO">
select t.*,isnull(be.unit_working_hours,0) unitPro from

@ -12,6 +12,7 @@ import com.op.system.api.domain.DataSourcePropertyDTO;
import com.op.system.api.domain.device.EquRepairOrderDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.quality.QcCheckTaskProduceDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -113,7 +114,13 @@ public class OpenController extends BaseController {
return error("[factoryCode]不能为空");
}
//添加检测任务
return toAjax(openService.insertQcCheckTaskProduce(qcCheckTaskProduce));
int flag = openService.insertQcCheckTaskProduce(qcCheckTaskProduce);
if(flag != -100){
return toAjax(flag);
}else{
return AjaxResult.error("该工单批次上次首检尚未结束,不允许重复发起");
}
}
/**
@ -244,4 +251,9 @@ public class OpenController extends BaseController {
public AjaxResult getDeliveryNoteDetail(@RequestBody Map paramMap) {
return openService.getDeliveryNoteDetail(paramMap);
}
//给oa提供的物料建议标准更新
@PostMapping("/sendProductCheckNo")
public AjaxResult sendProductCheckNo(@RequestBody List<BaseProductDTO> dots) {
return openService.sendProductCheckNo(dots);
}
}

@ -5,10 +5,7 @@ import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.device.DeviceRepairOrder;
import com.op.system.api.domain.device.EquEquipmentDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.mes.MesReportWorkConsumeDTO;
import com.op.system.api.domain.mes.MesReportWorkDTO;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import com.op.system.api.domain.mes.*;
import com.op.system.api.domain.quality.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -86,7 +83,7 @@ public interface OpenMapper {
String getSampNum(QcCheckTaskProduceDTO sampQua);
Date getLastTask(QcCheckTaskProduceDTO qcCheckTaskProduce);
String getLastTask(QcCheckTaskProduceDTO qcCheckTaskProduce);
List<SysNoticeGroup> getNoticesGroup(SysNoticeGroup noticeQo);
@ -94,5 +91,10 @@ public interface OpenMapper {
List<SysNoticeGroup> getNotices(SysNoticeGroup noticeQo);
List<String> getExsitCodes(List<String> codes);
int updateProductNoBatchs(@Param("list") List<BaseProductDTO> updates);
int addProductNoBatchs(@Param("list")List<BaseProductDTO> everyList);
}

@ -5,6 +5,7 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.system.api.domain.device.EquRepairOrderDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.mes.MesReportWorkDTO;
import com.op.system.api.domain.quality.QcCheckTaskDTO;
import com.op.system.api.domain.quality.QcCheckTaskProduceDTO;
@ -43,4 +44,6 @@ public interface OpenService {
AjaxResult sendWeChartMessage(List<WechartDTO> wechartDTO);
AjaxResult getDeliveryNoteDetail(Map paramMap);
AjaxResult sendProductCheckNo(List<BaseProductDTO> dots);
}

@ -21,8 +21,11 @@ import com.op.system.api.domain.device.EquRepairOrderDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.BaseProductDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import com.op.system.api.domain.quality.*;
import com.op.system.api.domain.sap.SapCustom;
import com.op.system.api.domain.sap.SapSupplier;
import org.apache.commons.lang.StringUtils;
import java.text.SimpleDateFormat;
@ -391,11 +394,12 @@ public class OpenServiceImpl implements OpenService {
public int insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce) {
DynamicDataSourceContextHolder.push("ds_" + qcCheckTaskProduce.getFactoryCode());
logger.info("创建检验任务"+qcCheckTaskProduce.getCheckType()+":"+JSONObject.toJSONString(qcCheckTaskProduce));
// 1分钟不允许存在两条
Date lastData = openMapper.getLastTask(qcCheckTaskProduce);
if(this.oneMinHas(lastData)){
logger.info("【重复创建任务】orderNo:"+qcCheckTaskProduce.getOrderNo()+";"+"incomeBatchNo:"+qcCheckTaskProduce.getIncomeBatchNo());
return 0;
// 同一个工单同一个批次,上个检验没完成,下一个不允许执行
String lastStatus = openMapper.getLastTask(qcCheckTaskProduce);
if(StringUtils.isNotBlank(lastStatus) && !"2".equals(lastStatus)){
//logger.info("【重复创建任务】orderNo:"+qcCheckTaskProduce.getOrderNo()+";"+"incomeBatchNo:"+qcCheckTaskProduce.getIncomeBatchNo());
logger.info("【重复创建任务】"+JSONObject.toJSONString(qcCheckTaskProduce));
return -100;
}
qcCheckTaskProduce.setCreateTime(DateUtils.getNowDate());
@ -465,7 +469,12 @@ public class OpenServiceImpl implements OpenService {
qcCheckTaskProduce.setRecordId(beLongId);
qcCheckTaskProduce.setFactoryCode(factoryCode);
qcCheckTaskProduce.setCreateTime(nowDate);
qcCheckTaskProduce.setTypeCode("produce");//大检验节点
if(StringUtils.isNotBlank(qcCheckTaskProduce.getTypeCode())){
qcCheckTaskProduce.setTypeCode(qcCheckTaskProduce.getTypeCode());//大检验节点
}else{
qcCheckTaskProduce.setTypeCode("produce");//大检验节点
}
qcCheckTaskProduce.setIncomeTime(DateUtils.getNowDate());
qcCheckTaskProduce.setSupplierCode(qcCheckTaskProduce.getCarCode());
qcCheckTaskProduce.setSupplierName(qcCheckTaskProduce.getCarName());
@ -614,7 +623,7 @@ public class OpenServiceImpl implements OpenService {
@Override
public AjaxResult sendWeChartMessage(List<WechartDTO> dtos) {
try {
logger.info(JSONObject.toJSONString("open企业微信发送参数"+dtos));
logger.info("open企业微信发送参数"+JSONObject.toJSONString(dtos));
String result = HttpUtils.sendPostWechart(weChartUrl, JSON.toJSONString(dtos));
return success(result);
} catch (Exception e) {
@ -623,7 +632,75 @@ public class OpenServiceImpl implements OpenService {
}
}
/**
* factoryCode 1000
* +productCode
* +productDescZh
* +productGroup
* +productGroupName
* +meins
* +productModel
* +umrez
* UMREZ+umren
* + mvgr5
* \0+ grossWeight
* volume
* **/
@Override
public AjaxResult sendProductCheckNo(List<BaseProductDTO> dtos) {
try {
logger.info("oa更新检验标准发送参数"+JSONObject.toJSONString(dtos));
if(CollectionUtils.isEmpty(dtos)){
return error("oa更新检验标准发送参数为空");
}
DynamicDataSourceContextHolder.push("ds_"+dtos.get(0).getFactoryCode());
//sap返回的产品编码
List<String> codes = dtos.stream().map(BaseProductDTO::getProductCode).collect(Collectors.toList());
//sap返回的客户编码-本地已存在
List<String> exsitCodes = openMapper.getExsitCodes(codes);
//sap返回的产品编码-本地不存在// 差集 (list2 - list1)
List<String> noExsitCodes = codes.stream().filter(item -> !exsitCodes.contains(item)).collect(Collectors.toList());
List<BaseProductDTO> updates = new ArrayList<>();
for (String exsitCode : exsitCodes) {
List<BaseProductDTO> updates0 = dtos.stream().filter(dto -> dto.getProductCode().equals(exsitCode)).collect(Collectors.toList());
updates.addAll(updates0);
}
if (!CollectionUtils.isEmpty(updates)) {
int m = openMapper.updateProductNoBatchs(updates);
System.out.println("oa产品更新成功条数" + m);
}
List<BaseProductDTO> adds = new ArrayList<>();
for (String noExsitCode : noExsitCodes) {
List<BaseProductDTO> adds0 = dtos.stream().filter(dto -> dto.getProductCode().equals(noExsitCode)).collect(Collectors.toList());
adds.addAll(adds0);
}
if (!CollectionUtils.isEmpty(adds)) {
int allsize = adds.size();
int inserttimes = allsize / 100 + 1;
for (int m = 0; m < inserttimes; m++) {
List<BaseProductDTO> everyList;
if (m < (inserttimes - 1)) {
everyList = adds.subList(m * 100, (m + 1) * 100);
} else {
everyList = adds.subList(m * 100, allsize);
}
if (everyList.size() > 0) {
openMapper.addProductNoBatchs(everyList);
}
}
System.out.println("oa产品新增成功条数" + allsize);
}
return success();
} catch (Exception e) {
e.printStackTrace();
return error(e.getMessage());
}
}
protected Boolean oneMinHas(Date lastData){
if(lastData != null){
@ -646,13 +723,20 @@ public class OpenServiceImpl implements OpenService {
}
public static void main(String args[]){
// 创建两个日期时间对象
LocalDateTime dateTime1 = LocalDateTime.of(2024, 4, 18, 9, 33); // 2023年1月1日 10:30
LocalDateTime dateTime2 = LocalDateTime.now(); // 2023年1月2日 11:45
// 计算分钟差
long minutesBetween = Duration.between(dateTime1, dateTime2).toMinutes();
if(minutesBetween<=1){
System.out.println("++++++++++++检验任务1分钟内生成过不再重复创建++++++++++++++");
// // 创建两个日期时间对象
// LocalDateTime dateTime1 = LocalDateTime.of(2024, 4, 18, 9, 33); // 2023年1月1日 10:30
// LocalDateTime dateTime2 = LocalDateTime.now(); // 2023年1月2日 11:45
// // 计算分钟差
// long minutesBetween = Duration.between(dateTime1, dateTime2).toMinutes();
// if(minutesBetween<=1){
// System.out.println("++++++++++++检验任务1分钟内生成过不再重复创建++++++++++++++");
// }
int f = -100;
if(f != -100){
System.out.println("-100");
}else{
System.out.println("0");
}
}

@ -27,6 +27,27 @@
<update id="updateWorkOrderStatus">
update pro_order_workorder set status = #{status} where belong_work_order = #{workorderCode}
</update>
<update id="updateProductNoBatchs">
<foreach collection="list" item="item" separator=";">
update base_product
set
product_code = #{item.productCode},
product_desc_zh = #{item.productDescZh},
product_group = #{item.productGroup},
product_group_name = #{item.productGroupName},
meins = #{item.meins},
product_model = #{item.productModel},
umrez = #{item.umrez},
umren = #{item.umren},
mvgr5 = #{item.mvgr5},
gross_weight = #{item.grossWeight},
volume = #{item.volume},
update_by = 'oa',
update_time = GETDATE()
where
product_code = #{item.productCode}
</foreach>
</update>
<!--获取在邦rfid 工单的信息-->
<select id="getRfidInfo" resultType="com.op.system.api.domain.mes.ProRfidProcessDetail">
@ -207,8 +228,8 @@
where end_value>= #{quality} and #{quality}>=start_value and del_flag = '0'
and check_type = #{checkType}
</select>
<select id="getLastTask" resultType="java.util.Date">
select max(create_time) from qc_check_task
<select id="getLastTask" resultType="java.lang.String">
select check_status from qc_check_task
where check_type = #{checkType}
and order_no= #{orderNo}
and income_batch_no = #{incomeBatchNo}
@ -385,6 +406,22 @@
)
</foreach>
</insert>
<insert id="addProductNoBatchs">
insert into base_product(
product_code,product_desc_zh,product_group,product_group_name,
meins,product_model,umrez,umren,mvgr5,
gross_weight,volume
,create_by,create_time
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.productCode},#{item.productDescZh},#{item.productGroup},#{item.productGroupName},
#{item.meins},#{item.productModel},#{item.umrez},#{item.umren},#{item.mvgr5},
#{item.grossWeight},#{item.volume},
'oa',GETDATE()
)
</foreach>
</insert>
<select id="getNoticesGroup" resultType="com.op.system.api.domain.SysNoticeGroup">
select sng.notice_id noticeId,
@ -412,5 +449,11 @@
from sys_notice sn
where sn.notice_id = #{noticeId}
</select>
<select id="getExsitCodes" resultType="java.lang.String">
select product_code from base_product where product_code in
<foreach collection="list" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</select>
</mapper>

@ -9,6 +9,15 @@ public class ProLine {
private Long efficiency;
private String dh;
private String factoryDh;
private String umrez;
public String getUmrez() {
return umrez;
}
public void setUmrez(String umrez) {
this.umrez = umrez;
}
public String getFactoryDh() {
return factoryDh;

@ -252,4 +252,6 @@ public interface ProOrderMapper {
int updateAutoSplitWork(String orderCode);
int updateAutoSplitOrder(String orderCode);
void updateAutoSplitOrderO2(String orderCode);
}

@ -460,6 +460,7 @@ public class ProOrderServiceImpl implements IProOrderService {
/**pro_order**/
int s = proOrderMapper.updateAutoSplitOrder(proOrder.getOrderCode());
proOrderMapper.updateAutoSplitOrderO2(proOrder.getOrderCode());
logger.info("s:"+s);
return R.ok();
}
@ -1411,13 +1412,11 @@ public class ProOrderServiceImpl implements IProOrderService {
for(int wm=0;wm<workorders.size();wm++){
BigDecimal wquaRatio = null;
if(wm != 0){//子单需要折算数量
wquaRatio = new BigDecimal(workorders.get(wm).getQuantitySplit())
.divide(new BigDecimal(workorders.get(0).getQuantitySplit()),2,BigDecimal.ROUND_UP);//proOrderWorkorderMapper.getQuaRatio(workorders.get(m-1).getProductCode());
wquaRatio = new BigDecimal(plineInfo.getUmrez());//proOrderWorkorderMapper.getQuaRatio(workorders.get(m-1).getProductCode());
workorders.get(wm).setQuantitySplit(wquaRatio.multiply(new BigDecimal(workorders.get(0).getQuantitySplit()))
.longValue());
}
}
int pm = proOrderWorkorderMapper.insertWorkorders(workorders);
System.out.println("pm:"+pm);
}

@ -1191,7 +1191,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return count;
}
@Override
@Transactional(rollbackFor = Exception.class)
//@Transactional(rollbackFor = Exception.class)
@DS("#header.poolName")
public int updateWorkOrderBatch(ProOrderWorkorderBatch proOrderWorkorderBatch) {
String workOrderCode = proOrderWorkorderBatch.getWorkorderCode();
@ -1218,10 +1218,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
if(proOrderWorkorderBatch.getNewBatchQuantity() != null){
Long newBatchQuantity = proOrderWorkorderBatch.getNewBatchQuantity();
if(m==0 || m== workOrders.size()-1){
// 设置子工单数量
if(m==0){
batch.setNewBatchQuantity(newBatchQuantity);
}else{
// 设置子工单数量
batch.setNewBatchQuantity(workOrders.get(m-1).getUmrez()
.multiply(new BigDecimal(newBatchQuantity)).longValue());
}

@ -427,6 +427,7 @@
where del_flag= '2' and belong_work_order like concat(#{orderCode},'-%')
</update>
<update id="updateAutoSplitOrder">
<!--
update pro_order
set status = 'o2',
quantity_split = quantity
@ -434,6 +435,25 @@
select order_code from pro_order_workorder
where del_flag= '0' and belong_work_order like concat(#{orderCode},'-%')
)
-->
update po
set po.quantity_split = pow.quantity_split
from (
select order_code,sum(quantity_split) quantity_split from pro_order_workorder
where del_flag= '0' and belong_work_order like concat(#{orderCode},'-%')
group by order_code
) pow
left join pro_order po on po.order_code = pow.order_code
where po.del_flag= '0'
</update>
<update id="updateAutoSplitOrderO2">
update pro_order
set status = (case when quantity = quantity_split then 'o2' else 'o1' end)
where del_flag= '0' and order_code in(
select order_code from pro_order_workorder
where del_flag= '0' and belong_work_order like concat(#{orderCode},'-%')
)
</update>
<delete id="deleteProOrderById" parameterType="String">

@ -132,8 +132,9 @@
<if test="prodType != null and prodType != ''">and pow.prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''">and pow.factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''">and pow.end_flag = #{endFlag}</if>
<if test="productDateStart != null ">and CONVERT(varchar(10),pow.product_date, 120) >=
'${productDateStart}'
<if test="productDateStart != null ">and CONVERT(varchar(10),pow.product_date, 120) >= '${productDateStart}'</if>
<if test="prodLineCode != null and prodLineCode != ''">
and pow.prod_line_code like concat('%', #{prodLineCode},'%')
</if>
<if test="productDateEnd != null ">and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120)</if>
and pow.parent_order = #{parentOrder}
@ -651,11 +652,13 @@
</select>
<select id="getLineProductInfo" resultType="com.op.plan.domain.ProLine">
select mlp.efficiency efficiency,
bp.dh,sf.ancestors factoryDh
be.dh,sf.ancestors factoryDh,
bp.umrez
from mes_line_product mlp
left join base_equipment bp on mlp.line_code = bp.equipment_code
left join base_equipment be on mlp.line_code = be.equipment_code
left join sys_factory sf on sf.factory_code = mlp.factory_code and sf.del_flag = '0'
where mlp.del_flag = '0' and product_code = #{prodCode}
left join base_product bp on bp.product_code = mlp.product_code
where mlp.del_flag = '0' and mlp.product_code = #{prodCode}
and mlp.line_code = #{lineCode} and bp.del_flag = '0'
</select>
<select id="getProcessCode" resultType="java.lang.String">
@ -785,7 +788,7 @@
product_name,unit,quantity_split,route_code,prod_line_code,
product_date,parent_order, status,create_by,create_time,
prod_type,factory_code,end_flag,del_flag,sort_no,
belong_work_order,shift_id
belong_work_order,shift_id,product_id
)VALUES
<foreach collection="list" item="d" index="index" separator=",">
(
@ -793,7 +796,7 @@
#{d.productName},#{d.unit},#{d.quantitySplit},#{d.routeCode},#{d.prodLineCode},
#{d.productDate},#{d.parentOrder},#{d.status},#{d.createBy},#{d.createTime},
#{d.prodType}, #{d.factoryCode},#{d.endFlag},'2',#{d.sortNo},
#{d.belongWorkOrder},#{d.shiftId}
#{d.belongWorkOrder},#{d.shiftId},'autoSplit'
)
</foreach>
</insert>

@ -242,6 +242,8 @@ public class QcCheckTaskIncomeController extends BaseController {
@PostMapping("/createIncomeTask")
public AjaxResult createIncomeTask(@RequestBody QcCheckTaskIncomeDTO qcCheckTaskIncome) {
logger.info("创建检验任务接收参数:"+JSONObject.toJSONString(qcCheckTaskIncome));
if (StringUtils.isBlank(qcCheckTaskIncome.getOrderNo())) {
return error("[orderNo]不能为空");
}

@ -5,7 +5,9 @@ import java.time.format.DateTimeFormatter;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.quality.domain.QcCheckTaskIncome;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -123,4 +125,20 @@ public class QcCheckTaskInventoryController extends BaseController {
public AjaxResult remove(@PathVariable String recordId) {
return toAjax(qcCheckTaskInventoryService.deleteQcCheckTaskInventoryByRecordId(recordId));
}
@GetMapping("/getPutInOrder")
public TableDataInfo getPutInOrder(QcCheckTaskInventory qcCheckTaskInventory) {
startPage();
List<QcCheckTaskIncome> list = qcCheckTaskInventoryService.getPutInOrder(qcCheckTaskInventory);
return getDataTable(list);
}
/**
*
**/
@PostMapping("/createCCTask")
public R createCCTask() {
qcCheckTaskInventoryService.createCCTask();
return R.ok();
}
}

@ -124,11 +124,6 @@ public class QcStaticTableController extends BaseController {
}
List<QcStaticTable> serieDTOs = qcStaticTableService.getProduceNames(qcStaticTable);
//legendData
List<String> pnames = serieDTOs.stream().map(u -> u.getMaterialName()).collect(Collectors.toList());
resultdto.setLegendData(pnames);
Map<String, QcStaticTable> seriesdtos = null;
if ("ymd".equals(qcStaticTable.getDataType())) {//ymd
//code->materialCode+yyyy-mm-dd
@ -139,46 +134,131 @@ public class QcStaticTableController extends BaseController {
}
List<ChartDTO> seriesChart = new ArrayList<>();
for (QcStaticTable serieDTO : serieDTOs) {
ChartDTO chartDTO = new ChartDTO();
chartDTO.setName(serieDTO.getMaterialName());
chartDTO.setType("line");
String keyPre = serieDTO.getMaterialCode();
List<Double> datas = new ArrayList<>();
for (String ymd : resultdto.getxAxis()) {
String key = keyPre + ymd;
QcStaticTable mdata = seriesdtos.get(key);
if (mdata != null) {
if (mdata.getaNoOkquality() == null) {
mdata.setaNoOkquality(new BigDecimal("0"));
}
if (mdata.getbNoOkquality() == null) {
mdata.setbNoOkquality(new BigDecimal("0"));
}
if (mdata.getcNoOkquality() == null) {
mdata.setcNoOkquality(new BigDecimal("0"));
}
if (!"0.00".equals(mdata.getSampleQuality())) {
BigDecimal defectRate = (mdata.getaNoOkquality().add(mdata.getbNoOkquality()).multiply(new BigDecimal("0.65"))
.add(mdata.getcNoOkquality()).multiply(new BigDecimal(0.35)))
.divide(new BigDecimal(mdata.getSampleQuality()))
.setScale(2, BigDecimal.ROUND_HALF_UP);
datas.add(defectRate.doubleValue());
} else {
datas.add(0.00);
}
ChartDTO chartDTO = new ChartDTO();
List<Double> datas = new ArrayList<>();
for (String ymd : resultdto.getxAxis()) {
String key = ymd;
QcStaticTable mdata = seriesdtos.get(key);
if (mdata != null) {
if (mdata.getaNoOkquality() == null) {
mdata.setaNoOkquality(new BigDecimal("0"));
}
if (mdata.getbNoOkquality() == null) {
mdata.setbNoOkquality(new BigDecimal("0"));
}
if (mdata.getcNoOkquality() == null) {
mdata.setcNoOkquality(new BigDecimal("0"));
}
if (!"0.00".equals(mdata.getSampleQuality())) {
BigDecimal defectRate = (mdata.getaNoOkquality().add(mdata.getbNoOkquality()).add(mdata.getcNoOkquality()))
.divide(new BigDecimal(mdata.getSampleQuality()),2,BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal("100.00"));
datas.add(defectRate.doubleValue());
} else {
datas.add(0.00);
}
} else {
datas.add(0.00);
}
chartDTO.setData(datas);
seriesChart.add(chartDTO);
}
chartDTO.setData(datas);
seriesChart.add(chartDTO);
resultdto.setSeries(seriesChart);
return resultdto;
}
/**精确到每个产品**/
// public QcStaticTable getProduceChartData(QcStaticTable qcStaticTable) {
// QcStaticTable resultdto = new QcStaticTable();
// //默认时间范围T 00:00:00~T+1 00:00:00
// if (StringUtils.isEmpty(qcStaticTable.getYmArrayStart())) {
// LocalDate date = LocalDate.now();
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM");
// String ymStr = dtf.format(date);
// qcStaticTable.setYmArrayStart(ymStr);
// qcStaticTable.setYmArrayEnd(ymStr);
// }
// if (StringUtils.isNotBlank(qcStaticTable.getMaterialCode())) {
// qcStaticTable.setMaterialCode("'" + qcStaticTable.getMaterialCode().replace(",", "','") + "'");
// }
// //xAxis;
// if (qcStaticTable.getYmArrayStart().equals(qcStaticTable.getYmArrayEnd())) {
// /**月内每日**/
// List<String> days = this.getXNames(qcStaticTable.getYmArrayStart() + "-01",
// qcStaticTable.getYmArrayEnd() + "-01", "ymd");
// resultdto.setxAxis(days);
//
// qcStaticTable.setDataType("ymd");
// qcStaticTable.setYmArrayStart(days.get(0));
// qcStaticTable.setYmArrayEnd(days.get(days.size() - 1));
// } else {
// /**年内各月**/
// List<String> months = this.getXNames(qcStaticTable.getYmArrayStart(), qcStaticTable.getYmArrayEnd(), "ym");
// resultdto.setxAxis(months);
//
// qcStaticTable.setDataType("ym");
// qcStaticTable.setYmArrayStart(months.get(0));
// qcStaticTable.setYmArrayEnd(months.get(months.size() - 1));
// }
//
//
// List<QcStaticTable> serieDTOs = qcStaticTableService.getProduceNames(qcStaticTable);
// //legendData
// List<String> pnames = serieDTOs.stream().map(u -> u.getMaterialName()).collect(Collectors.toList());
// resultdto.setLegendData(pnames);
//
// Map<String, QcStaticTable> seriesdtos = null;
// if ("ymd".equals(qcStaticTable.getDataType())) {//ymd
// //code->materialCode+yyyy-mm-dd
// seriesdtos = qcStaticTableService.getProduceChartData(qcStaticTable);
// } else {//ym
// //code->materialCode+yyyy-mm-dd
// seriesdtos = qcStaticTableService.getProduceChartDataYM(qcStaticTable);
// }
//
// List<ChartDTO> seriesChart = new ArrayList<>();
// for (QcStaticTable serieDTO : serieDTOs) {
// ChartDTO chartDTO = new ChartDTO();
// chartDTO.setName(serieDTO.getMaterialName());
// chartDTO.setType("line");
// String keyPre = serieDTO.getMaterialCode();
// List<Double> datas = new ArrayList<>();
// for (String ymd : resultdto.getxAxis()) {
// String key = keyPre + ymd;
// QcStaticTable mdata = seriesdtos.get(key);
// if (mdata != null) {
// if (mdata.getaNoOkquality() == null) {
// mdata.setaNoOkquality(new BigDecimal("0"));
// }
// if (mdata.getbNoOkquality() == null) {
// mdata.setbNoOkquality(new BigDecimal("0"));
// }
// if (mdata.getcNoOkquality() == null) {
// mdata.setcNoOkquality(new BigDecimal("0"));
// }
// if (!"0.00".equals(mdata.getSampleQuality())) {
// BigDecimal defectRate = (mdata.getaNoOkquality().add(mdata.getbNoOkquality()).multiply(new BigDecimal("0.65"))
// .add(mdata.getcNoOkquality()).multiply(new BigDecimal(0.35)))
// .divide(new BigDecimal(mdata.getSampleQuality()))
// .setScale(2, BigDecimal.ROUND_HALF_UP);
// datas.add(defectRate.doubleValue());
// } else {
// datas.add(0.00);
// }
//
// } else {
// datas.add(0.00);
// }
// }
// chartDTO.setData(datas);
// seriesChart.add(chartDTO);
// }
// resultdto.setSeries(seriesChart);
//
// return resultdto;
// }
public List<String> getXNames(String startMonth, String endMonth, String type) {
// 返回的日期集合
@ -262,12 +342,12 @@ public class QcStaticTableController extends BaseController {
public TableDataInfo getXJCheckTableList(QcStaticTable qcStaticTable) {
//默认时间范围T 00:00:00~T+1 00:00:00
if (StringUtils.isEmpty(qcStaticTable.getYearMonth())) {
LocalDate date = LocalDate.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM");
String ymStr = dtf.format(date);
qcStaticTable.setYearMonth(ymStr);//end
}
// if (StringUtils.isEmpty(qcStaticTable.getYearMonth())) {
// LocalDate date = LocalDate.now();
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM");
// String ymStr = dtf.format(date);
// qcStaticTable.setYearMonth(ymStr);//end
// }
startPage();
List<QcStaticTable> list = qcStaticTableService.getXJCheckTableList(qcStaticTable);
return getDataTable(list);

@ -61,6 +61,7 @@ public class QcStaticTable extends BaseEntity {
private String unit;
@Excel(name = "抽样数量")
private String sampleQuality;
private String noOkQuality;
@Excel(name = "不良数量")
private int noOkNums;
@Excel(name = "不良比例")
@ -74,10 +75,12 @@ public class QcStaticTable extends BaseEntity {
private String workCenter;
private String recordId;
private String detailId;
private String checkNo;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date incomeTime;
private String incomeTimeStr;
private String checkManCode;
private String checkManName;
private String ruleName;
@ -108,6 +111,30 @@ public class QcStaticTable extends BaseEntity {
private BigDecimal upperDiff;
private BigDecimal downDiff;
public String getIncomeTimeStr() {
return incomeTimeStr;
}
public void setIncomeTimeStr(String incomeTimeStr) {
this.incomeTimeStr = incomeTimeStr;
}
public String getNoOkQuality() {
return noOkQuality;
}
public void setNoOkQuality(String noOkQuality) {
this.noOkQuality = noOkQuality;
}
public String getDetailId() {
return detailId;
}
public void setDetailId(String detailId) {
this.detailId = detailId;
}
public BigDecimal getUpperDiff() {
return upperDiff;
}

@ -2,6 +2,7 @@ package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckTaskInventory;
import com.op.quality.domain.QcCheckTaskProduce;
import org.apache.ibatis.annotations.Mapper;
@ -65,4 +66,7 @@ public interface QcCheckTaskInventoryMapper {
int getTodayMaxNum(QcCheckTaskInventory qcCheckTaskInventory);
List<QcCheckTaskIncome> getPutInOrder(QcCheckTaskInventory qcCheckTaskInventory);
List<QcCheckTaskInventory> getPutInOrderList(QcCheckTaskInventory qoPutIn);
}

@ -79,4 +79,6 @@ public interface QcStaticTableMapper {
List<QcStaticTable> getProjectList(String checkType);
QcStaticTable getUpAndDown(QcStaticTable qcStaticTable);
@MapKey("detailId")
Map<String, QcStaticTable> defectMap(QcStaticTable qcStaticTable);
}

@ -2,6 +2,8 @@ package com.op.quality.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckTaskInventory;
/**
@ -58,4 +60,8 @@ public interface IQcCheckTaskInventoryService {
* @return
*/
public int deleteQcCheckTaskInventoryByRecordId(String recordId);
List<QcCheckTaskIncome> getPutInOrder(QcCheckTaskInventory qcCheckTaskInventory);
AjaxResult createCCTask();
}

@ -2,6 +2,7 @@ package com.op.quality.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -146,7 +147,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
*/
@Override
public int insertQcCheckTaskIncome(QcCheckTaskIncome qcCheckTaskIncome) {
logger.info("创建检验任务接收参数:"+JSONObject.toJSONString(qcCheckTaskIncome));
logger.info("impl创建检验任务接收参数:"+JSONObject.toJSONString(qcCheckTaskIncome));
DynamicDataSourceContextHolder.push("ds_" + qcCheckTaskIncome.getFactoryCode());
String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
int liushuiNum = qcCheckTaskIncomeMapper.getTodayMaxNum(qcCheckTaskIncome);
@ -182,11 +183,11 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
qctp.setGroupId(group.getGroupId());
itemsGG = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
}
items.addAll(itemsGG);
/**qc_check_task_detail**/
if(CollectionUtils.isEmpty(items)){
logger.info("检验任务创建参数缺失:"+qcCheckTaskIncome.getMaterialCode());
return 0;//没有找到检测项目
}
@ -300,11 +301,11 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
}
logger.info("来料检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
new Thread(() -> {
CompletableFuture.runAsync(() -> {
System.out.println("异步执行企业微信发送");
AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("来料检验企业微信提醒结果:" + JSONObject.toJSONString(result));
}).start();
});
}
//发企业微信--------------------结束
}

@ -4,17 +4,31 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.bean.BeanUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.quality.mapper.*;
import com.op.quality.service.IQcCheckTaskDefectService;
import com.op.quality.service.IQcCheckTaskUserService;
import com.op.system.api.RemoteOpenService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysNoticeGroup;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
import com.op.system.api.domain.quality.QcUserMaterialDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -27,6 +41,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* Service
*
@ -57,11 +74,14 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
private IQcCheckTaskDefectService qcCheckTaskDefectService;
@Autowired
private QcSampleRuleMapper qcSampleRuleMapper;
private RemoteUserService remoteUserService;
@Autowired
private QcCheckTaskUserMapper qcCheckTaskUserMapper;
@Autowired
private RemoteOpenService remoteOpenService;
private static Pattern p2= Pattern.compile("<[^>]+>");
/**
*
*
@ -134,23 +154,32 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
qcCheckTaskInventory.setCheckNo(bpDD + liushuiStr);
/**取检测项**/
QcCheckTypeProject qctp = new QcCheckTypeProject();
QcCheckTypeProject qctp= new QcCheckTypeProject();
qctp.setTypeId(qcCheckTaskInventory.getCheckType());//生产过程检验
qctp.setMaterialCode(qcCheckTaskInventory.getMaterialCode());//特性
/**qc_check_type_project**/
/**qc_check_type_project**///个性
List<QcCheckTaskDetail> items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp);
if (CollectionUtils.isEmpty(items)) {
/**qc_material_group_detail**/
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckTaskInventory.getMaterialCode());
if (group == null) {
/**qc_material_group_detail**/
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckTaskInventory.getMaterialCode());
//共性
if(group == null){//默认
group = new QcMaterialGroupDetail();
QcProjectType initGroup = qcCheckTypeProjectMapper.getProductGroup(qcCheckTaskInventory.getMaterialCode());
if(initGroup != null){
group.setGroupId(initGroup.getGroupId());
}else{
return 0;//没有找到检测项目
}
qctp.setGroupId(group.getGroupId());//共性
items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
}
List<QcCheckTaskDetail> itemsGG = new ArrayList<>();
if(StringUtils.isNotBlank(group.getGroupId())){
qctp.setGroupId(group.getGroupId());
itemsGG = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
}
items.addAll(itemsGG);
/**qc_check_task_detail**/
if (CollectionUtils.isEmpty(items)) {
if(CollectionUtils.isEmpty(items)){
return 0;//没有找到检测项目
}
@ -191,17 +220,6 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
}
}
qcCheckTaskInventory.setNoOkQuality(noOkQuality);
// /**qc_sample_rule**/
// if(qcCheckTaskInventory.getNoOkQuality()==null) {
// QcCheckTaskIncome sampQua = new QcCheckTaskIncome();
// sampQua.setCheckType(qcCheckTaskInventory.getCheckType());
// sampQua.setQuality(qcCheckTaskInventory.getQuality());
// String sampNum = qcSampleRuleMapper.getSampNum(sampQua);
// if (StringUtils.isNotBlank(sampNum)) {
// qcCheckTaskInventory.setSampleQuality(new BigDecimal(sampNum));
// }
// }
/**qc_check_task**/
qcCheckTaskInventoryMapper.insertQcCheckTaskInventory(qcCheckTaskInventory);
@ -214,7 +232,37 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
item.setFactoryCode(factoryCode);
item.setStatus("N");
}
return qcCheckTaskDetailMapper.addBatch(items);
int batchs = qcCheckTaskDetailMapper.addBatch(items);
//发企业微信--------------------开始
SysNoticeGroup noticeQo = new SysNoticeGroup();
noticeQo.setNoticeId(21L);
List<SysNoticeGroup> notices = qcCheckTaskIncomeMapper.getNoticesGroup(noticeQo);
if(!CollectionUtils.isEmpty(notices)) {
List<WechartDTO> wecharts = new ArrayList<>();
for (SysNoticeGroup noticedto : notices) {
WechartDTO wechart0 = new WechartDTO();
wechart0.setUserId(noticedto.getWxId());
String contentInfo = notices.get(0).getNoticeContent();
contentInfo = contentInfo.replace("${checkNo}", qcCheckTaskInventory.getCheckNo() + "\n");
Matcher m = p2.matcher(contentInfo);
contentInfo = m.replaceAll("");
wechart0.setText(contentInfo);
wecharts.add(wechart0);
}
logger.info("库存检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
CompletableFuture.runAsync(() -> {
System.out.println("异步执行企业微信发送");
AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("库存检验企业微信提醒结果:" + JSONObject.toJSONString(result));
});
}
//发企业微信--------------------结束
}
return batchs;
}
/**
@ -291,4 +339,68 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
qcCheckTaskUserMapper.deleteQcCheckTaskUserByBelongTo(recordId);
return 1;
}
@Override
@DS("#header.poolName")
public List<QcCheckTaskIncome> getPutInOrder(QcCheckTaskInventory qcCheckTaskInventory) {
List<QcCheckTaskIncome> dtos = qcCheckTaskInventoryMapper.getPutInOrder(qcCheckTaskInventory);
// for(QcCheckTaskIncome dto:dtos){
// String statusName = "";
// if("w5".equals(dto.getStatus())){//设计有问题TODO
// statusName = "质检完成";
// }else{
// statusName = "质检未完成";
// }
// dto.setStatus(statusName);
// }
return dtos;
}
/**库存检验任务**/
@Override
public AjaxResult createCCTask() {
// 加载sf-cloud库的sys_datasource
SysUser sysUser = new SysUser();
sysUser.setUserId(1L);
R<List<Map<String, String>>> dateSources0 = remoteUserService.getPoolNameList(sysUser);
List<Map<String, String>> dateSources = dateSources0.getData();
ExecutorService executorService = new ThreadPoolExecutor(
dateSources.size(),
dateSources.size(),
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
try {
dateSources.forEach(dateSource -> {
if("ds_1000".equals(dateSource.get("poolName"))){
logger.info("++++++++++++" + dateSource.get("poolName") + "++++库存检验开始++++++++++");
Runnable run = () -> createCCFunc(dateSource.get("poolName"));
executorService.execute(run);
}
});
} catch (Exception e) {
logger.error("service == createCPBatchTask == exception", e);
return error("service == createCPBatchTask == exception");
} finally {
executorService.shutdown();
}
return success();
}
public void createCCFunc(String poolName){
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
QcCheckTaskInventory qoPutIn = new QcCheckTaskInventory();
//根据base_product的库检周期和入库时间获取当前需要检验的物料
List<QcCheckTaskInventory> qoPutInList = qcCheckTaskInventoryMapper.getPutInOrderList(qoPutIn);
for(QcCheckTaskInventory putIn:qoPutInList){
QcCheckTaskInventory ccTask = new QcCheckTaskInventory();
BeanUtils.copyProperties(putIn,ccTask);
ccTask.setCheckType("checkTypeCC");//库存检验
ccTask.setFactoryCode(poolName.replace("ds_",""));
int m = insertQcCheckTaskInventory(ccTask);
logger.info("++++++++++++仓库检验任务生成" + m + "++++++++++++++");
}
logger.info("++++++++++++" + poolName + "++++仓库检验任务结束++++++++++");
}
}

@ -7,10 +7,7 @@ import java.time.Duration;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -309,11 +306,11 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
}
logger.info("质检检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
if (!CollectionUtils.isEmpty(wecharts)) {
new Thread(() -> {
CompletableFuture.runAsync(() -> {
System.out.println("异步执行企业微信发送");
AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts);
logger.info("质检检验企业微信提醒结果:" + JSONObject.toJSONString(result));
}).start();
});
}
//发企业微信--------------------结束
}

@ -397,7 +397,7 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
try {
dateSources.forEach(dateSource -> {
if("ds_1000".equals(dateSource.get("poolName"))){
logger.info("++++++++++++" + dateSource.get("poolName") + "++++成品入库检验巡检开始++++++++++");
logger.info("++++++++++++" + dateSource.get("poolName") + "++++成品入库检验开始++++++++++");
Runnable run = () -> createCPFunc(dateSource.get("poolName"));
executorService.execute(run);
}

@ -126,15 +126,15 @@ public class QcDefectTypeServiceImpl implements IQcDefectTypeService {
public AjaxResult updateQcDefectType(QcDefectType qcDefectType) {
// 检验
QcDefectType checkQuery = new QcDefectType();
checkQuery.setDefectType(qcDefectType.getDefectType());
checkQuery.setDefectSubclass(qcDefectType.getDefectSubclass());
List<QcDefectType> check = qcDefectTypeMapper.selectQcDefectTypeList(checkQuery);
if (check.size() > 0) {
if (!check.get(0).equals(qcDefectType.getDefectCode())) {
return error(500, "不良子类已存在!修改失败!");
}
}
// QcDefectType checkQuery = new QcDefectType();
// checkQuery.setDefectType(qcDefectType.getDefectType());
// checkQuery.setDefectSubclass(qcDefectType.getDefectSubclass());
// List<QcDefectType> check = qcDefectTypeMapper.selectQcDefectTypeList(checkQuery);
// if (check.size() > 0) {
// if (!check.get(0).equals(qcDefectType.getDefectCode())) {
// return error(500, "不良子类已存在!修改失败!");
// }
// }
qcDefectType.setUpdateBy(SecurityContextHolder.getUserName());
qcDefectType.setUpdateTime(DateUtils.getNowDate());
// 插入数据库

@ -85,7 +85,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
//合格批次
int okBatchs = tabledto.getBatchs() - tabledto.getNoOkBatchs();
tabledto.setOkBatchs(okBatchs);
//批次合格
//批次不良
if (tabledto.getBatchs() != 0) {
BigDecimal noOkBatchRate = new BigDecimal(tabledto.getNoOkBatchs()).multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(tabledto.getBatchs()), BigDecimal.ROUND_CEILING)
@ -177,15 +177,21 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
}else if(qcStaticTable.getShiftId().equals("2")){
detailMap = qcStaticTableMapper.getProjectDetailNight(qcStaticTable);
}
Map<String, QcStaticTable> picsMap = qcStaticTableMapper.picsMap(qcStaticTable);
Map<String, QcStaticTable> defectMap = qcStaticTableMapper.defectMap(qcStaticTable);
if(defectMap.size()==0){
defectMap.put("0",null);
}
for (QcStaticTable project : projects) {
this.getDataFromMap(detailMap, project, picsMap);
this.getDataFromMap(detailMap, project, picsMap,defectMap);
}
return projects;
}
private void getDataFromMap(Map<String, QcStaticTable> detailMap, QcStaticTable project, Map<String, QcStaticTable> picsMap) {
private void getDataFromMap(Map<String, QcStaticTable> detailMap, QcStaticTable project, Map<String, QcStaticTable> picsMap,
Map<String, QcStaticTable> defectMap) {
String keystr = project.getProjectId() + "08";
QcStaticTable detail = detailMap.get(keystr);
if (detail != null) {
@ -194,6 +200,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn080090(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn080090(project.getColumn080090()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn080090(project.getColumn080090() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -210,6 +222,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn090100(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn090100(project.getColumn090100()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn090100(project.getColumn090100() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -226,6 +244,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn100110(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn100110(project.getColumn100110()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn100110(project.getColumn100110() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -242,6 +266,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn110120(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn110120(project.getColumn110120()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn110120(project.getColumn110120() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -258,6 +288,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn123133(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn123133(project.getColumn123133()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn123133(project.getColumn123133() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -274,6 +310,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn133143(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn133143(project.getColumn133143()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn133143(project.getColumn133143() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -290,6 +332,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn143153(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn143153(project.getColumn143153()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn143153(project.getColumn143153() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -306,6 +354,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn153163(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn153163(project.getColumn153163()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn153163(project.getColumn153163() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -322,6 +376,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn163173(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn163173(project.getColumn163173()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn163173(project.getColumn163173() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -338,6 +398,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn180190(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn180190(project.getColumn180190()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn180190(project.getColumn180190() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -354,6 +420,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn190200(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn190200(project.getColumn190200()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn190200(project.getColumn190200() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -370,6 +442,12 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
project.setColumn200210(detail.getStatus().equals("Y") ? "✓" : "✘");
}
QcStaticTable defect = defectMap.get(detail.getDetailId());
if(defect != null && StringUtils.isNotBlank(defect.getRemark())){
project.setColumn200210(project.getColumn200210()+" "+defect.getRemark());
}
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
if (urlDTO != null) {
project.setColumn200210(project.getColumn200210() + "," + urlDTO.getProjectId().replace("&amp;", "&"));//projectId存的照片路径
@ -386,15 +464,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
@DS("#header.poolName")
public ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable) {
ChartSeriesDTO seriesDTO = new ChartSeriesDTO();
//获取当天参与生产的车间
List<QcStaticTable> legends = qcStaticTableMapper.getLegendData(qcStaticTable);
List<String> legendData = new ArrayList<>();
if (!CollectionUtils.isEmpty(legends)) {
legendData = legends.stream().map(QcStaticTable::getSupplierName).collect(Collectors.toList());
} else {
return null;
}
seriesDTO.setLegendData(legendData);
//横轴时间
qcStaticTable.setStartDateStr(qcStaticTable.getYmdms() + " 08:00:00");
qcStaticTable.setEndDateStr(qcStaticTable.getYmdms() + " 08:00:00");
@ -404,31 +474,71 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
Map<String, QcStaticTable> dataMap = qcStaticTableMapper.getXJMapData(qcStaticTable);
List<ChartDTO> series = new ArrayList<>();
ChartDTO serie = null;
for (QcStaticTable legend : legends) {
serie = new ChartDTO();
serie.setName(legend.getSupplierName());
List<Double> data = new ArrayList<>();
for (String houreName : xAxisData) {
String key = legend.getSupplierCode() + houreName.replace("时", "");
QcStaticTable qt = dataMap.get(key);
if (qt != null && StringUtils.isNotBlank(qt.getSampleQuality())) {
BigDecimal noOkRate = new BigDecimal(qt.getNoOkNums())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(qt.getSampleQuality()), 2, BigDecimal.ROUND_HALF_UP);
data.add(noOkRate.doubleValue());
} else {
data.add(0.00);
}
serie.setData(data);
ChartDTO serie = new ChartDTO();
List<Double> data = new ArrayList<>();
for (String houreName : xAxisData) {
String key = houreName.replace("时", "");
QcStaticTable qt = dataMap.get(key);
if (qt != null && StringUtils.isNotBlank(qt.getSampleQuality())) {
BigDecimal noOkRate = new BigDecimal(qt.getNoOkNums())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(qt.getSampleQuality()), 2, BigDecimal.ROUND_HALF_UP);
data.add(noOkRate.doubleValue());
} else {
data.add(0.00);
}
serie.setData(data);
series.add(serie);
}
serie.setData(data);
series.add(serie);
seriesDTO.setSeries(series);
return seriesDTO;
}
// public ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable) {
// ChartSeriesDTO seriesDTO = new ChartSeriesDTO();
// //获取当天参与生产的车间
// List<QcStaticTable> legends = qcStaticTableMapper.getLegendData(qcStaticTable);
// List<String> legendData = new ArrayList<>();
// if (!CollectionUtils.isEmpty(legends)) {
// legendData = legends.stream().map(QcStaticTable::getSupplierName).collect(Collectors.toList());
// } else {
// return null;
// }
// seriesDTO.setLegendData(legendData);
// //横轴时间
// qcStaticTable.setStartDateStr(qcStaticTable.getYmdms() + " 08:00:00");
// qcStaticTable.setEndDateStr(qcStaticTable.getYmdms() + " 08:00:00");
// List<String> xAxisData = this.getHourProductionTitle(qcStaticTable);
// seriesDTO.setxAxisData(xAxisData);
// //数据
// Map<String, QcStaticTable> dataMap = qcStaticTableMapper.getXJMapData(qcStaticTable);
//
// List<ChartDTO> series = new ArrayList<>();
// ChartDTO serie = null;
// for (QcStaticTable legend : legends) {
// serie = new ChartDTO();
// serie.setName(legend.getSupplierName());
// List<Double> data = new ArrayList<>();
// for (String houreName : xAxisData) {
// String key = legend.getSupplierCode() + houreName.replace("时", "");
// QcStaticTable qt = dataMap.get(key);
// if (qt != null && StringUtils.isNotBlank(qt.getSampleQuality())) {
// BigDecimal noOkRate = new BigDecimal(qt.getNoOkNums())
// .multiply(new BigDecimal(100))
// .divide(new BigDecimal(qt.getSampleQuality()), 2, BigDecimal.ROUND_HALF_UP);
// data.add(noOkRate.doubleValue());
// } else {
// data.add(0.00);
// }
// serie.setData(data);
// }
// serie.setData(data);
// series.add(serie);
// }
// seriesDTO.setSeries(series);
//
// return seriesDTO;
// }
@Override
@DS("#header.poolName")

@ -87,11 +87,12 @@
<if test="factoryCode != null and factoryCode != ''">and qct.factory_code = #{factoryCode}</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.check_time, 120) >= #{checkTimeStart}</if>
<if test="checkTimeEnd != null ">and #{checkTimeEnd} > CONVERT(varchar(30),qct.check_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>
<if test="checkType != null ">and qct.check_type = #{checkType}</if>
<if test="typeCode != null ">and q.type_code = #{typeCode}</if>
</where>
order by qct.create_time desc
</select>
<select id="selectQcCheckTaskInventoryByRecordId" parameterType="String" resultMap="QcCheckTaskInventoryResult">
@ -239,4 +240,126 @@
from qc_check_task
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</select>
<select id="getPutInOrder" resultType="com.op.quality.domain.QcCheckTaskIncome">
select * from (
SELECT
wms_raw_order_in_sn.user_defined5 AS orderNo,
wms_raw_order_in_sn.material_code AS materialCode,
wms_raw_order_in_sn.material_desc AS materialName,
COUNT(wms_raw_order_in_sn.amount) AS quality,
wms_raw_order_in_sn.gmt_create incomeTime,
wms_raw_order_in_sn.wh_code supplierCode,
base_warehouse.warehouse_name supplierName,
wms_raw_order_in_sn.user_defined4 unit
FROM
wms_raw_order_in_sn
LEFT JOIN base_warehouse ON base_warehouse.warehouse_code=wms_raw_order_in_sn.wh_code
WHERE
wms_raw_order_in_sn.active_flag = '1'
GROUP BY
wms_raw_order_in_sn.wh_code,
wms_raw_order_in_sn.user_defined5,
wms_raw_order_in_sn.material_code,
wms_raw_order_in_sn.material_desc,
wms_raw_order_in_sn.user_defined4,
base_warehouse.warehouse_code,
base_warehouse.warehouse_name,
wms_raw_order_in_sn.gmt_create
union all
SELECT
wms_fp_storage_news_sn.order_no,
wms_fp_storage_news_sn.product_name,
wms_fp_storage_news_sn.product_code,
SUM ( wms_fp_storage_news_sn.amount ) AS total_amount,
wms_fp_storage_news_sn.gmt_create,
wms_fp_storage_news_sn.wh_code ,
base_warehouse.warehouse_name,
wms_fp_storage_news_sn.user_defined3
FROM
wms_fp_storage_news_sn
LEFT JOIN base_warehouse ON base_warehouse.warehouse_code=wms_fp_storage_news_sn.wh_code
WHERE
wms_fp_storage_news_sn.active_flag = '1'
GROUP BY
wms_fp_storage_news_sn.order_no,
wms_fp_storage_news_sn.product_name,
wms_fp_storage_news_sn.product_code,
wms_fp_storage_news_sn.gmt_create,
wms_fp_storage_news_sn.user_defined3,
base_warehouse.warehouse_code,
base_warehouse.warehouse_name,
wms_fp_storage_news_sn.wh_code
) t
</select>
<select id="getPutInOrderList" resultType="com.op.quality.domain.QcCheckTaskInventory">
select t0.orderNo,
t0.materialCode,
t0.materialName,
t0.quality,
t0.incomeTime,
t0.supplierCode,
t0.supplierName
from (
select t.*,bp.warehouse_cycle,
case when qct.create_time is not null then DATEDIFF(day, qct.create_time, GETDATE())
else DATEDIFF(day, t.incomeTime, GETDATE()) end days
from (
SELECT
wms_raw_order_in_sn.po_no AS orderNo,
wms_raw_order_in_sn.material_code AS materialCode,
wms_raw_order_in_sn.material_desc AS materialName,
COUNT(wms_raw_order_in_sn.amount) AS quality,
wms_raw_order_in_sn.gmt_create incomeTime,
wms_raw_order_in_sn.wh_code supplierCode,
base_warehouse.warehouse_name supplierName,
wms_raw_order_in_sn.user_defined4 unit
FROM
wms_raw_order_in_sn
LEFT JOIN base_warehouse ON base_warehouse.warehouse_code=wms_raw_order_in_sn.wh_code
WHERE
wms_raw_order_in_sn.active_flag = '1'
GROUP BY
wms_raw_order_in_sn.wh_code,
wms_raw_order_in_sn.po_no,
wms_raw_order_in_sn.material_code,
wms_raw_order_in_sn.material_desc,
wms_raw_order_in_sn.user_defined4,
base_warehouse.warehouse_code,
base_warehouse.warehouse_name,
wms_raw_order_in_sn.gmt_create
union all
SELECT
wms_fp_storage_news_sn.order_no,
wms_fp_storage_news_sn.product_name,
wms_fp_storage_news_sn.product_code,
SUM ( wms_fp_storage_news_sn.amount ) AS total_amount,
wms_fp_storage_news_sn.gmt_create,
wms_fp_storage_news_sn.wh_code ,
base_warehouse.warehouse_name,
wms_fp_storage_news_sn.user_defined3
FROM
wms_fp_storage_news_sn
LEFT JOIN base_warehouse ON base_warehouse.warehouse_code=wms_fp_storage_news_sn.wh_code
WHERE
wms_fp_storage_news_sn.active_flag = '1'
GROUP BY
wms_fp_storage_news_sn.order_no,
wms_fp_storage_news_sn.product_name,
wms_fp_storage_news_sn.product_code,
wms_fp_storage_news_sn.gmt_create,
wms_fp_storage_news_sn.user_defined3,
base_warehouse.warehouse_code,
base_warehouse.warehouse_name,
wms_fp_storage_news_sn.wh_code
) t
left join base_product_attached bp on t.materialCode = concat('0000000',bp.product_code)
left join (
select order_no,material_code,max(create_time) create_time
from qc_check_task where check_type='checkTypeCC' and del_flag = '0' GROUP BY order_no,material_code
) qct on qct.order_no = t.orderNo
and t.materialCode = qct.material_code
where bp.warehouse_cycle is not null
)t0
where t0.days >= t0.warehouse_cycle
</select>
</mapper>

@ -379,7 +379,7 @@
select
'','','',
qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name, qct.income_time,'','',
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
@ -409,7 +409,7 @@
and qct.check_type = 'checkTypeSCXJ'
</where>
GROUP BY qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_type,CONVERT(varchar(10),qct.create_time, 120),
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

@ -56,6 +56,7 @@
group by qct.supplier_code,qct.supplier_name
</select>
<select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable">
<!--
select concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
qct.material_code materialCode,
qct.material_name materialName,
@ -69,7 +70,25 @@
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>-->
select CONVERT(varchar(10),qct.income_time, 120) materailDate,
sum(qct.sample_quality) sampleQuality,
sum(qctd1.noOk_quality)*type1.ratio aNoOkquality,
sum(qctd2.noOk_quality)*type2.ratio bNoOkquality,
sum(qctd3.noOk_quality)*type3.ratio cNoOkquality
from qc_check_task qct
left join qc_check_task_defect qctd1 on qct.record_id = qctd1.belong_to and qctd1.defect_code = '20231212001'
left join qc_defect_type type1 on qctd1.defect_code = type1.defect_code
left join qc_check_task_defect qctd2 on qct.record_id = qctd2.belong_to and qctd2.defect_code = '20231212002'
left join qc_defect_type type2 on qctd2.defect_code = type2.defect_code
left join qc_check_task_defect qctd3 on qct.record_id = qctd3.belong_to and qctd3.defect_code = '20231212003'
left join qc_defect_type type3 on qctd3.defect_code = type3.defect_code
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.create_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.create_time, 120)</if>
group by CONVERT(varchar(10),qct.income_time, 120),type1.ratio,type2.ratio,type3.ratio
</select>
<select id="getProduceNames" resultType="com.op.quality.domain.QcStaticTable">
select distinct qct.material_code materialCode,
@ -82,6 +101,7 @@
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
</select>
<select id="getProduceChartDataYM" resultType="com.op.quality.domain.QcStaticTable">
<!--
select
<if test='dataType=="ymd" '>
concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
@ -119,6 +139,41 @@
<if test='dataType=="ym" '>
,CONVERT(varchar(7),qct.income_time, 120)
</if>
-->
select
<if test='dataType=="ymd" '>
CONVERT(varchar(10),qct.income_time, 120) materailDate,
</if>
<if test='dataType=="ym" '>
CONVERT(varchar(7),qct.income_time, 120) materailDate,
</if>
sum(qct.sample_quality) sampleQuality,
sum(qctd1.noOk_quality)*type1.ratio aNoOkquality,
sum(qctd2.noOk_quality)*type2.ratio bNoOkquality,
sum(qctd3.noOk_quality)*type3.ratio cNoOkquality
from qc_check_task qct
left join qc_check_task_defect qctd1 on qct.record_id = qctd1.belong_to and qctd1.defect_code = '20231212001'
left join qc_defect_type type1 on qctd1.defect_code = type1.defect_code
left join qc_check_task_defect qctd2 on qct.record_id = qctd2.belong_to and qctd2.defect_code = '20231212002'
left join qc_defect_type type2 on qctd2.defect_code = type2.defect_code
left join qc_check_task_defect qctd3 on qct.record_id = qctd3.belong_to and qctd3.defect_code = '20231212003'
left join qc_defect_type type3 on qctd3.defect_code = type3.defect_code
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test='ymArrayStart != null and dataType=="ym" '>and CONVERT(varchar(7),qct.income_time, 120) >=#{ymArrayStart}</if>
<if test='ymArrayEnd != null and dataType=="ym"'>and #{ymArrayEnd}>= CONVERT(varchar(7),qct.income_time, 120)</if>
<if test='ymArrayStart != null and dataType=="ymd" '>and CONVERT(varchar(10),qct.income_time, 120) >=#{ymArrayStart}</if>
<if test='ymArrayEnd != null and dataType=="ymd"'>and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time,120)</if>
group by type1.ratio,type2.ratio,type3.ratio
<if test='dataType=="ymd" '>
,CONVERT(varchar(10),qct.income_time, 120)
</if>
<if test='dataType=="ym" '>
,CONVERT(varchar(7),qct.income_time, 120)
</if>
</select>
<select id="getWorkcenterList" resultType="com.op.system.api.domain.quality.FactoryDto">
select factory_name factoryName,
@ -127,20 +182,21 @@
</select>
<select id="getXJCheckTableList" resultType="com.op.quality.domain.QcStaticTable">
select distinct
order_no orderNo,
material_code materialCode, material_name materialName,
quality,unit,
supplier_code supplierCode,supplier_name supplierName,
income_time incomeTime
from qc_check_task
where check_type = 'checkTypeSCXJ' and del_flag = '0'
<if test="orderNo != null ">and check_no like concat('%',#{orderNo},'%')</if>
<if test="materialCode != null ">and material_code like concat('%',#{materialCode},'%')</if>
<if test="incomeBatchNo != null ">and income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="incomeTime != null ">and CONVERT(varchar(10),income_time, 120) >= CONVERT(varchar(10),#{incomeTime},
120)
qct.order_no orderNo,
qct.material_code materialCode, qct.material_name materialName,
qct.quality,qct.unit,
qct.supplier_code supplierCode,qct.supplier_name supplierName,
pow.product_date incomeTimeStr,
pow.shift_id shiftId
from qc_check_task qct
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
<if test="orderNo != null ">and qct.check_no like concat('%',#{orderNo},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
<if test="incomeBatchNo != null ">and qct.income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="incomeTimeStr != null ">and CONVERT(varchar(10),pow.product_date, 120) = #{incomeTimeStr}
</if>
order by income_time desc
order by pow.product_date desc
</select>
<select id="getXJProjects" resultType="com.op.quality.domain.QcStaticTable">
select qct.rule_name ruleName,
@ -154,6 +210,7 @@
<select id="getProjectDetail" resultType="com.op.quality.domain.QcStaticTable">
select qctd.record_id recordId,
qctd.project_id projectId,
qctd.record_id detailId,
qctd.status,
qctd.remark,
CONVERT(VARCHAR(5),qctd.create_time, 108),
@ -176,12 +233,12 @@
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qct.order_no = #{orderNo} and qct.check_type = 'checkTypeSCXJ' and qct.check_status = '2'
order by qctd.create_time
</select>
<select id="getProjectDetailNight" resultType="com.op.quality.domain.QcStaticTable">
select qctd.record_id recordId,
qctd.project_id projectId,
qctd.record_id detailId,
qctd.status,
qctd.remark,
CONVERT(VARCHAR(5),qctd.create_time, 108),
@ -222,6 +279,7 @@
and CONVERT(varchar(10),income_time, 120) = #{ymdms}
</select>
<select id="getXJMapData" resultType="com.op.quality.domain.QcStaticTable">
<!--
select qct.supplier_code supplierCode,
qct.supplier_name supplierName,
sum(qct.sample_quality) sampleQuality,
@ -233,13 +291,22 @@
<if test="orderNo != null ">and qct.check_no like concat('%',#{orderNo},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
group by qct.supplier_code,qct.supplier_name,CONVERT(VARCHAR(2), qct.check_time, 108)
-->
select
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums,
CONVERT(VARCHAR(2), qct.check_time, 108) ymdms
from qc_check_task qct
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
and CONVERT(varchar(10),qct.income_time, 120) = #{ymdms}
group by CONVERT(VARCHAR(2), qct.check_time, 108)
</select>
<select id="getQmsRateTable" resultType="com.op.quality.domain.QcStaticTable">
select qct.supplier_code supplierCode,
qct.supplier_name supplierName,
<if test="orderNo != null ">qct.order_no orderNo, qct.unit,</if>
<if test="incomeBatchNo != null ">qct.income_batch_no,</if>
<if test="materialCode != null ">qct.material_code,qct.material_name,</if>
<if test="incomeBatchNo != null ">qct.income_batch_no incomeBatchNo,</if>
<if test="materialCode != null ">qct.material_code materialCode,qct.material_name materialName,</if>
sum(quality) quality,
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums
@ -400,4 +467,20 @@
from qc_check_type_project where project_id = #{projectNo}
and type_id = #{checkType}
</select>
<select id="defectMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qctd.belong_to,
qctd.belong_to_detail detailId,
STUFF(
(SELECT ';' + defect_subclass+':'+ CONVERT(NVARCHAR(15), noOk_quality)
FROM qc_check_task_defect
WHERE belong_to = qctd.belong_to and belong_to_detail = qctd.belong_to_detail
FOR xml path('')
),1,1,''
) remark
FROM qc_check_task_defect qctd
left join qc_check_task qct on qctd.belong_to = qct.record_id
where qctd.del_flag = '0' and qct.order_no = #{orderNo}
GROUP by qctd.belong_to,qctd.belong_to_detail
</select>
</mapper>

@ -155,8 +155,8 @@ public class SapItemSyncImpl implements SapItemSyncService {
String MVGR3_NM = maraTable.getString("MVGR3_NM");
String MVGR4 = maraTable.getString("MVGR4");
String MVGR4_NM = maraTable.getString("MVGR4_NM");
String MVGR5 = maraTable.getString("MVGR5");
String MVGR5_NM = maraTable.getString("MVGR5_NM");
// String MVGR5 = maraTable.getString("MVGR5");//标准占用
// String MVGR5_NM = maraTable.getString("MVGR5_NM");//批次最大数量占用
String LAEDA = maraTable.getString("LAEDA");
String ERSDA = maraTable.getString("LAEDA");
log.info(i+"物料基础数据同步数据输出----" +

@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.op.system.api.domain.wms.wmsReportWork;
import com.op.wms.domain.WmsProductProductionRecords;
import com.op.wms.domain.WmsProductPut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@ -136,6 +137,11 @@ public class WmsProductPutController extends BaseController {
String rlist = wmsProductPutService.addReportListSap(mesReportWork);
return AjaxResult.success(rlist);
}
//查询--成品生产记录
@GetMapping("/selectProductProductionRecords")
public TableDataInfo selectProductProductionRecords(WmsProductProductionRecords wmsProductProductionRecords) {
startPage();
List<WmsProductProductionRecords> result= wmsProductPutService.selectProductProductionRecords(wmsProductProductionRecords);
return getDataTable(result);
}
}

@ -631,9 +631,15 @@ public class WmsToWCSmissionController {
//保存--成品生产记录
@PostMapping("/finishedProductProductionRecords")
public AjaxResult finishedProductProductionRecords(@RequestBody ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> list = wmsProductPutService.listProOrderWorkorder(proOrderWorkorder);
return success(list);
Integer result= wmsProductPutService.finishedProductProductionRecords(proOrderWorkorder);
return success(result);
}
// //查询--成品生产记录
// @PostMapping("/selectProductProductionRecords")
// public AjaxResult selectProductProductionRecords(@RequestBody WmsProductProductionRecords wmsProductProductionRecords) {
// List<WmsProductProductionRecords> result= wmsProductPutService.selectProductProductionRecords(wmsProductProductionRecords);
// return success(result);
// }
/**
* RGV RFID WMS
* RFID

@ -352,6 +352,15 @@ public class BaseProduct extends BaseEntity {
@Excel(name = "报工汇率")
private BigDecimal reportRate;
private String mvgr5Nm;
private String warehouseCycle;
public String getWarehouseCycle() {
return warehouseCycle;
}
public void setWarehouseCycle(String warehouseCycle) {
this.warehouseCycle = warehouseCycle;
}
public String getMvgr5Nm() {
return mvgr5Nm;

@ -122,6 +122,15 @@ public class BaseProductAttached extends BaseEntity {
*/
@Excel(name = "其它")
private String other;
private String warehouseCycle;
public String getWarehouseCycle() {
return warehouseCycle;
}
public void setWarehouseCycle(String warehouseCycle) {
this.warehouseCycle = warehouseCycle;
}
public void setId(String id) {
this.id = id;

@ -113,7 +113,11 @@ public class ProOrderWorkorder extends TreeEntity {
*/
@Excel(name = "产线编码")
private String prodLineCode;
/**
* 线
*/
@Excel(name = "产线名称")
private String prodLineName;
/**
*
*/
@ -179,6 +183,24 @@ public class ProOrderWorkorder extends TreeEntity {
*/
@Excel(name = "产品类型")
private String prodType;
@Excel(name = "托盘")
private String sn;
public String getProdLineName() {
return prodLineName;
}
public void setProdLineName(String prodLineName) {
this.prodLineName = prodLineName;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
/**
* 1 0
@ -186,6 +208,16 @@ public class ProOrderWorkorder extends TreeEntity {
@Excel(name = "是否为底层节点")
private Integer endFlag;
private String quantity;
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public Integer getEndFlag() {
return endFlag;
}

@ -0,0 +1,258 @@
package com.op.wms.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.util.Date;
public class WmsProductProductionRecords extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
private String siteCode;
/**
*
*/
@Excel(name = "生产工单号")
private String productOrder;
/**
*
*/
@Excel(name = "产品名称")
private String productName;
/**
*
*/
@Excel(name = "产品编码")
private String productCode;
/**
*
*/
@Excel(name = "仓库编码")
private String whCode;
/**
*
*/
@Excel(name = "库区编码")
private String waCode;
/**
*
*/
@Excel(name = "库位编码")
private String wlCode;
/**
*
*/
@Excel(name = "托盘号")
private String sn;
/**
*
*/
@Excel(name = "数量")
private String quantity;
/**
* 1
*/
@Excel(name = "预留字段1")
private String userDefined1;
/**
* 2
*/
@Excel(name = "预留字段2")
private String userDefined2;
/**
* 3
*/
@Excel(name = "预留字段3")
private String userDefined3;
/**
* 4
*/
@Excel(name = "预留字段4")
private String userDefined4;
/**
* 5
*/
@Excel(name = "预留字段5")
private String userDefined5;
@Excel(name = "批次")
private String batchCode;
@Excel(name = "产线名称")
private String lineName;
@Excel(name = "产线编号")
private String lineCode;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日期")
private Date productDate;
public String getSiteCode() {
return siteCode;
}
public void setSiteCode(String siteCode) {
this.siteCode = siteCode;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getProductOrder() {
return productOrder;
}
public void setProductOrder(String productOrder) {
this.productOrder = productOrder;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getWhCode() {
return whCode;
}
public void setWhCode(String whCode) {
this.whCode = whCode;
}
public String getWaCode() {
return waCode;
}
public void setWaCode(String waCode) {
this.waCode = waCode;
}
public String getWlCode() {
return wlCode;
}
public void setWlCode(String wlCode) {
this.wlCode = wlCode;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getUserDefined1() {
return userDefined1;
}
public void setUserDefined1(String userDefined1) {
this.userDefined1 = userDefined1;
}
public String getUserDefined2() {
return userDefined2;
}
public void setUserDefined2(String userDefined2) {
this.userDefined2 = userDefined2;
}
public String getUserDefined3() {
return userDefined3;
}
public void setUserDefined3(String userDefined3) {
this.userDefined3 = userDefined3;
}
public String getUserDefined4() {
return userDefined4;
}
public void setUserDefined4(String userDefined4) {
this.userDefined4 = userDefined4;
}
public String getUserDefined5() {
return userDefined5;
}
public void setUserDefined5(String userDefined5) {
this.userDefined5 = userDefined5;
}
public String getBatchCode() {
return batchCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public Date getProductDate() {
return productDate;
}
public void setProductDate(Date productDate) {
this.productDate = productDate;
}
}

@ -2,6 +2,7 @@ package com.op.wms.mapper;
import java.util.List;
import com.op.wms.domain.WmsProductProductionRecords;
import com.op.wms.domain.WmsProductPutRecords;
/**
@ -58,4 +59,8 @@ public interface WmsProductPutRecordsMapper {
* @return
*/
public int deleteWmsProductPutRecordsByIds(String[] ids);
Integer insertProductProductionRecord(WmsProductProductionRecords wmsProductProductionRecords);
List<WmsProductProductionRecords> selectProductProductionRecords(WmsProductProductionRecords wmsProductProductionRecords);
}

@ -134,4 +134,8 @@ public interface IWmsProductPutService {
List<BaseEquipment> selectBaseEquipmentList(BaseEquipment baseEquipment);
List<ProOrderWorkorder> listProOrderWorkorder(ProOrderWorkorder proOrderWorkorder);
Integer finishedProductProductionRecords(ProOrderWorkorder proOrderWorkorder);
List<WmsProductProductionRecords> selectProductProductionRecords(WmsProductProductionRecords wmsProductProductionRecords);
}

@ -805,7 +805,11 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
order.setProcureCode(sapPurchaseOrderQuery1.get("orderNum"));
order.setSiteCode(sapPurchaseOrderQuery1.get("werks"));
//order.setUserDefined3(sapPurchaseOrderQuery1.get("ebelp"));//批次
order.setMaterialCode(sapPurchaseOrderQuery1.get("matnr"));
String materialCode = sapPurchaseOrderQuery1.get("matnr");
materialCode = "0000000" + materialCode;
order.setMaterialCode(materialCode);
// order.setMaterialCode(sapPurchaseOrderQuery1.get("matnr"));
// order.setMaterialCode("0000000"+order.getMaterialCode());
order.setMaterialDesc(sapPurchaseOrderQuery1.get("matnrName"));
order.setActive("1");
List<OdsProcureOrder> orderList = odsProcureOrderMapper.selectOdsProcureOrderList(order);

@ -997,6 +997,36 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
return workorderList;
}
@Override
public Integer finishedProductProductionRecords(ProOrderWorkorder proOrderWorkorder) {
DynamicDataSourceContextHolder.push("ds_" + proOrderWorkorder.getFactoryCode());
WmsProductProductionRecords wmsProductProductionRecords=new WmsProductProductionRecords();
wmsProductProductionRecords.setSiteCode(proOrderWorkorder.getFactoryCode());
wmsProductProductionRecords.setId(IdUtils.fastSimpleUUID());
wmsProductProductionRecords.setSn(proOrderWorkorder.getSn());
wmsProductProductionRecords.setQuantity(proOrderWorkorder.getQuantity());
wmsProductProductionRecords.setBatchCode(proOrderWorkorder.getBatchCode());
wmsProductProductionRecords.setProductOrder(proOrderWorkorder.getWorkorderCodeSap());
wmsProductProductionRecords.setProductCode(proOrderWorkorder.getProductCode());
wmsProductProductionRecords.setProductName(proOrderWorkorder.getProductName());
wmsProductProductionRecords.setProductDate(new Date());
wmsProductProductionRecords.setLineName(proOrderWorkorder.getProdLineName());
wmsProductProductionRecords.setLineCode(proOrderWorkorder.getProdLineCode());
wmsProductProductionRecords.setCreateBy(proOrderWorkorder.getCreateBy());
wmsProductProductionRecords.setCreateTime(new Date());
Integer result= wmsProductPutRecordsMapper.insertProductProductionRecord(wmsProductProductionRecords);
return result;
}
@Override
@DS("#header.poolName")
public List<WmsProductProductionRecords> selectProductProductionRecords(WmsProductProductionRecords wmsProductProductionRecords) {
// DynamicDataSourceContextHolder.push("ds_" + wmsProductProductionRecords.getSiteCode());
List<WmsProductProductionRecords> records= wmsProductPutRecordsMapper.selectProductProductionRecords(wmsProductProductionRecords);
return records;
}
@Override
public List<WmsRuturnPutEmbryo> FinishedProductSalesReturn(WmsRuturnPutEmbryo wmsRuturnPutEmbryo) {
DynamicDataSourceContextHolder.push("ds_" + wmsRuturnPutEmbryo.getFactoryCode());

@ -86,6 +86,7 @@
<if test="pc != null">pc,</if>
iei,
man_standar,
warehouse_cycle,
<if test="sprayWay != null">spray_way,</if>
<if test="blankDiameter != null">blank_diameter,</if>
<if test="blankNo != null">blank_no,</if>
@ -106,6 +107,7 @@
<if test="pc != null">#{pc},</if>
#{iei},
#{manStandar},
#{warehouseCycle},
<if test="sprayWay != null">#{sprayWay},</if>
<if test="blankDiameter != null">#{blankDiameter},</if>
<if test="blankNo != null">#{blankNo},</if>
@ -149,7 +151,8 @@
update base_product_attached
set
iei = #{iei},
man_standar = #{manStandar}
man_standar = #{manStandar},
warehouse_cycle = #{warehouseCycle}
where id = #{id}
</update>

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

@ -48,7 +48,8 @@
<where>
<if test="siteCode != null and siteCode != ''">and Site_code = #{siteCode}</if>
<if test="procureCode != null and procureCode != ''">and Procure_Code = #{procureCode}</if>
<if test="materialCode != null and materialCode != ''">and Material_Code = #{materialCode}</if>
<if test="materialCode != null and materialCode != ''">and Material_Code like concat('%', #{materialCode},
'%') </if>
<if test="materialDesc != null and materialDesc != ''">and Material_Desc = #{materialDesc}</if>
<if test="planDate != null ">and Plan_Date = #{planDate}</if>
<if test="planNumber != null ">and Plan_Number = #{planNumber}</if>

@ -139,4 +139,106 @@
#{id}
</foreach>
</delete>
<insert id="insertProductProductionRecord">
insert into wms_product_production_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="productOrder != null">product_order,</if>
<if test="productName != null">product_name,</if>
<if test="productCode != null">product_code,</if>
<if test="whCode != null">wh_code,</if>
<if test="waCode != null">wa_code,</if>
<if test="wlCode != null">wl_code,</if>
<if test="sn != null">sn,</if>
<if test="userDefined1 != null">user_defined1,</if>
<if test="userDefined2 != null">user_defined2,</if>
<if test="userDefined3 != null">user_defined3,</if>
<if test="userDefined4 != null">user_defined4,</if>
<if test="userDefined5 != null">user_defined5,</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="batchCode != null">batch_code,</if>
<if test="quantity != null">quantity,</if>
<if test="lineName != null">lineName,</if>
<if test="lineCode != null">lineCode,</if>
<if test="productDate != null">product_date,</if>
<if test="siteCode != null">siteCode,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="productOrder != null">#{productOrder},</if>
<if test="productName != null">#{productName},</if>
<if test="productCode != null">#{productCode},</if>
<if test="whCode != null">#{whCode},</if>
<if test="waCode != null">#{waCode},</if>
<if test="wlCode != null">#{wlCode},</if>
<if test="sn != null">#{sn},</if>
<if test="userDefined1 != null">#{userDefined1},</if>
<if test="userDefined2 != null">#{userDefined2},</if>
<if test="userDefined3 != null">#{userDefined3},</if>
<if test="userDefined4 != null">#{userDefined4},</if>
<if test="userDefined5 != null">#{userDefined5},</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="batchCode != null">#{batchCode},</if>
<if test="quantity != null">#{quantity},</if>
<if test="lineName != null">#{lineName},</if>
<if test="lineCode != null">#{lineCode},</if>
<if test="productDate != null">#{productDate},</if>
<if test="siteCode != null">#{siteCode},</if>
</trim>
</insert>
<select id="selectProductProductionRecords" resultType="com.op.wms.domain.WmsProductProductionRecords">
SELECT
id,
product_order AS productOrder,
product_name AS productName,
product_code AS productCode,
wh_code AS whCode,
wa_code AS waCode,
wl_code AS wlCode,
sn,
user_defined1 AS userDefined1,
user_defined2 AS userDefined2,
user_defined3 AS userDefined3,
user_defined4 AS userDefined4,
user_defined5 AS userDefined5,
create_by AS createBy,
create_time AS createTime,
update_by AS updateBy,
batch_code AS batchCode,
quantity,
lineName,
lineCode ,
product_date AS productDate,
siteCode,
update_time AS updateTime
FROM
wms_product_production_records
<where>
<if test="id != null and id != ''">and id = #{id}</if>
<if test="productOrder != null and productOrder != ''">and product_order like concat('%', #{productOrder},
'%')</if>
<if test="productName != null and productName != ''">and product_name like concat('%', #{productName},
'%') </if>
<if test="productCode != null and productCode != ''">and product_code like concat('%', #{productCode},
'%')</if>
<if test="sn != null and sn != ''">and sn = #{sn}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="batchCode != null and batchCode != ''">and batch_code like concat('%', #{batchCode},
'%')</if>
<if test="quantity != null and quantity != ''">and quantity = #{quantity}</if>
<if test="lineName != null and lineName != ''">and lineName = #{lineName}</if>
<if test="lineCode != null and lineCode != ''">and lineCode = #{lineCode}</if>
<if test="productDate != null ">and product_date= #{productDate}</if>
<if test="siteCode != null and siteCode != ''">and siteCode = #{siteCode}</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save