Merge remote-tracking branch 'origin/master'

master
Yangwl 1 year ago
commit 54a0e76ed1

@ -12,8 +12,8 @@ public class IEquipmentVO {
private Double failureRate;
// 设备有效利用率
private Double utilizationRatio;
// 设备维修质量
private Double rapairQuantity;
// 设备维修质量 拼错了!!!!!
private String rapairQuantity;
// 设备状态
private String equipmentStatus;
@ -25,11 +25,11 @@ public class IEquipmentVO {
this.equipmentStatus = equipmentStatus;
}
public Double getRapairQuantity() {
public String getRapairQuantity() {
return rapairQuantity;
}
public void setRapairQuantity(Double rapairQuantity) {
public void setRapairQuantity(String rapairQuantity) {
this.rapairQuantity = rapairQuantity;
}

@ -26,6 +26,7 @@ public interface DeviceInterfaceMapper {
* @return
*/
List<IEquipmentVO> selectEquipmentList(EquOperation equOperation);
List<IEquipmentVO> selectEquipmentVOList(EquOperation equOperation);
/**
*

@ -53,7 +53,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
/**
*
* :/
* /
* //*24
*
* @return
*/
@ -61,10 +61,10 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
@DS("#header.poolName")
public AjaxResult getEquipmentInfo(EquOperation equOperation) {
if (equOperation.getTimeDimension() == null) {
equOperation.setTimeDimension("dd");
equOperation.setTimeDimension("yyyy");
}
// 获取所有设备信息
List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList(equOperation);
List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentVOList(equOperation);
return success(equipmentVOList);
}
@ -95,26 +95,26 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
runTime += diffTime;
}
// 计算维修质量(故障时间(小时)/故障次数)
double rapairQuantity = runTime / 3600000 / workOrderList.size();
equipmentVO.setRapairQuantity(Double.valueOf(rapairQuantity));
Double rapairQuantity = runTime / 3600000 / workOrderList.size();
String douStr = String.format("%.2f", rapairQuantity);
equipmentVO.setRapairQuantity(douStr);
} else {
// 没有该记录则默认为0
equipmentVO.setRapairQuantity(0D);
equipmentVO.setRapairQuantity("0.00");
}
}
// 按照raparQuantity字段进行排序并使用subList获取前10个结果
List<IEquipmentVO> top10 = equipmentVOList.stream()
.sorted(Comparator.comparingDouble(IEquipmentVO::getRapairQuantity)) // 排序
.limit(10) // 限制结果数量为10
.collect(Collectors.toList()); // 将结果收集到List中
.sorted(Comparator.comparing(IEquipmentVO::getRapairQuantity).reversed())// 由正序改为 反转排序 倒序
.limit(10) // 限制结果数量为10 改为不限制结果数量
.collect(Collectors.toList()); //将结果收集到List中
return success(top10);
}
/**
* -MTBF top10
* -MTBF
* /
*/
@Override
@ -132,13 +132,12 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
/**
*
* /
* -/
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentIntactRate(EquOperation equOperation) {
//查询所有设备(设备停用的除外)
// CAST(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100.00/COUNT(*) as decimal(18,2)) AS intactRate
EquOperation equipmentIntactRate = deviceInterfaceMapper.getEquipmentIntactRate(equOperation);
Double totalEquipment = new Double(equipmentIntactRate.getTotalEquipment());
Double operationEquipment = new Double(equipmentIntactRate.getOperationEquipment());

@ -150,7 +150,14 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairWorkOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
return equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder);
int result = equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder);
//2.修改设备状态
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(equipmentCode);
equEquipment.setEquipmentStatus("0");//0故障
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
return result;
}
/**

@ -21,7 +21,8 @@
<select id="selectEquipmentList" parameterType="EquOperation" resultType="com.op.device.domain.vo.IEquipmentVO">
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName',be.equipment_status AS
'equipmentStatus', (SELECT ROUND(
'equipmentStatus',be.department AS
'department',(SELECT ROUND(
SUM(CAST(fault_time AS FLOAT)) /
SUM(CAST(actual_operation_time AS FLOAT)),
2)
@ -41,6 +42,28 @@
and be.equipment_category = '0'
</select>
<select id="selectEquipmentVOList" parameterType="EquOperation" resultType="com.op.device.domain.vo.IEquipmentVO">
SELECT
be.equipment_code AS 'equipmentCode',
be.equipment_name AS 'equipmentName',
be.equipment_status AS 'equipmentStatus',
be.department AS 'department',
ROUND(SUM(CAST(eo.fault_time AS FLOAT)) * 100 / SUM(CAST(eo.actual_operation_time AS FLOAT)),2) AS 'failureRate',
CAST(SUM(CAST(eo.actual_operation_time AS DECIMAL(10,2)))*100 / (365*24) AS DECIMAL(18,2)) AS 'utilizationRatio'
FROM equ_operation eo
LEFT JOIN base_equipment be ON eo.equipment_code = be.equipment_code
<where>
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
AND eo.del_flag = '0'
AND be.del_flag = '0'
AND be.equipment_category = '0'
</where>
GROUP BY be.equipment_code,be.equipment_name,be.equipment_status,be.department
ORDER BY failureRate DESC
</select>
<select id="selectRepairEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO">
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName'
from base_equipment be
@ -95,7 +118,7 @@
)/COUNT(equipment_code) as decimal(18,2))as mtbf
from equ_operation eo
<where>
<if test="timeDimension == 'dd' ">and day(eo.create_time) = day(getdate())</if>
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
</where>

@ -155,7 +155,7 @@ public class RyTask {
}
/************质量管理系统定时任务开始*****************/
//过程巡检,每15分钟执行一次
//过程巡检,每3分钟执行检查一次
public void createProduceXJTask(){
logger.info("++质量管理系统+过程巡检+开始++createProduceXJTask+++++");
remoteQualityService.createProduceXJTask();

@ -52,7 +52,7 @@ import com.op.common.core.utils.poi.ExcelUtilDailyReport;
* @date 2023-08-24
*/
@RestController
@RequestMapping("./reportWork")
@RequestMapping("/reportWork")
public class MesReportWorkController extends BaseController {
@Autowired
private IMesReportWorkService mesReportWorkService;

@ -86,8 +86,6 @@ public class MesReportWork extends BaseEntity {
@Excel(name = "物料消耗单位")
private String materialNameUnit;
/** 报工单编号 */
// @Excel(name = "报工单编号")
private String reportCode;
@ -96,18 +94,12 @@ public class MesReportWork extends BaseEntity {
//@Excel(name = "报工类型报工类型SELF上位机报工、UNI系统报工")
private String reportType;
/** 规格型号 */
//@Excel(name = "规格型号")
private String spec;
private BigDecimal quantitySplit;
/** 合格数量 */
//@Excel(name = "合格数量")
private BigDecimal quantityQualified;
@ -120,13 +112,9 @@ public class MesReportWork extends BaseEntity {
//@Excel(name = "报工人员")
private String userName;
/** 报工途径PAD、MOBILE、PC */
//@Excel(name = "报工途径PAD、MOBILE、PC")
private String feedbackChannel;
private String feedbackTimeStr;
/** 录入人员 */
@ -137,16 +125,10 @@ public class MesReportWork extends BaseEntity {
//@Excel(name = "状态")
private String status;
/** 线体编码 */
//@Excel(name = "线体编码")
private String machineCode;
/** 班组编码 */
//@Excel(name = "班组编码")
private String teamCode;
@ -226,6 +208,15 @@ public class MesReportWork extends BaseEntity {
private String voucher;
//版本
private String version;
private String sapCode;
public String getSapCode() {
return sapCode;
}
public void setSapCode(String sapCode) {
this.sapCode = sapCode;
}
public String getVoucher() {
return voucher;

@ -107,6 +107,15 @@ public class MesReportWorkConsume extends BaseEntity {
private String productGroupName;
//上级物料
private String pMaterialCode;
private String workorderCodeSap;
public String getWorkorderCodeSap() {
return workorderCodeSap;
}
public void setWorkorderCodeSap(String workorderCodeSap) {
this.workorderCodeSap = workorderCodeSap;
}
public String getpMaterialCode() {
return pMaterialCode;

@ -295,14 +295,14 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
* * =
* * ----------------------------------------
* *
* * =sum(/)
* * =sum()
* * = *
* * =
* * =
* * <p>
* *
* * =
* * = *
* * =sum()
* * = 4*sum()
* * =
* * =
* * ----------------------------------------
@ -344,7 +344,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
/**(两层报工)子工单先报工,然后母工单报工**/
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
mesReportWork.setWorkorderCode(workOrders.get(1).getWorkorderCode());
mesReportWork.setWorkorderCode(workOrders.get(0).getWorkorderCode());
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if(sHzWorks==null){
return R.fail("未查询到子报工单");
@ -355,7 +355,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
logger.info("==========================子工单报工结束:"+JSONObject.toJSONString(sapRson));
if(sapRson.getCode()== 200){
//一定是子单报工成功返回后,再母单报工
mesReportWork.setWorkorderCode(workOrders.get(0).getWorkorderCode());
mesReportWork.setWorkorderCode(workOrders.get(1).getWorkorderCode());
MesReportWork pHzWork = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if(pHzWork==null){
return R.fail("未查询到母报工单");
@ -368,7 +368,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
//母工单报工
logger.info("==========================母工单报工开始");
pHzWork.setQuantityFeedback(sHzWorks.getQuantityFeedback());
pHzWork.setSac1(sHzWorks.getSac1());
pHzWork.setSac2("4");//母单报工固定值
R sapR = this.reportHzToSap(pHzWork,2);
logger.info("==========================母工单报工结束"+JSONObject.toJSONString(sapR));
return sapR;
@ -449,8 +449,8 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return R.fail("mes_report_work_consume没有数据");
}
sapRFW.setLt_hwList(lt_hwList);
sapRFW.setAnzma(workOrder.getSapCode());//产线编号
logger.info(workOrder.getWorkorderCodeSap() + "sap工单报工请求" + JSONObject.toJSONString(sapRFW));
R r = remoteSapService.sapRFWOrder(sapRFW);
logger.info(workOrder.getWorkorderCodeSap() + "sap工单报工结果" + r.getCode() + "," + r.getData() + "," + r.getMsg());
//上传成功更改mes_report_work状态

@ -102,9 +102,11 @@
mrwc.quantity,
mrwc.unit,
mrwc.create_time createTime,
mrwc.recoil
mrwc.recoil,
pow.workorder_code_sap workorderCodeSap
from mes_report_work_consume mrwc
where mrwc.del_flag = '0'
left join pro_order_workorder pow on mrwc.workorder_code = pow.workorder_code
where mrwc.del_flag = '0' and pow.del_flag = '0'
and mrwc.workorder_code = #{workorderCode}
order by mrwc.recoil
</select>

@ -529,24 +529,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getReportList" resultType="com.op.mes.domain.MesReportWork">
select
id,
workorder_code workorderCode,
report_code reportCode,
batch,
quantity_feedback quantityFeedback,
unit,
work_time workTime,
use_man useMan,
create_time createTime
from mes_report_work
where del_flag='0'
mrw.id,
mrw.workorder_code workorderCode,
mrw.report_code reportCode,
mrw.batch,
mrw.quantity_feedback quantityFeedback,
mrw.unit,
mrw.work_time workTime,
mrw.use_man useMan,
mrw.create_time createTime,
pow.workorder_code_sap workorderCodeSap
from mes_report_work mrw
left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code
where mrw.del_flag='0' and pow.del_flag = '0'
<if test='parentOrder=="0"'>
and workorder_code = #{workorderCode}
and mrw.workorder_code = #{workorderCode}
</if>
<if test='parentOrder!="0"'>
and parent_order = #{workorderCode}
and mrw.parent_order = #{workorderCode}
</if>
order by end_report
order by mrw.end_report
</select>
<select id="getPrepareList" resultType="com.op.mes.domain.MesPrepareDetail">
select
@ -572,12 +574,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mrw.product_code productCode,
mrw.product_name productName,
mrw.sac1,
mrw.sac2
mrw.sac2,
equ.sap_code sapCode
from (
select
workorder_code,
sum(quantity_feedback) quantity_feedback,
sum(round( work_time/use_man,2)) sac1,
sum(work_time) sac1,
use_man sac2,
product_code,
product_name
@ -588,7 +591,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by workorder_code,product_code,product_name,use_man
) mrw
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
<!--left join pro_route rte on rte.route_code = ow.route_code-->
left join base_equipment equ on equ.equipment_code = ow.workorder_name
</select>
<select id="getReportWorkHz1" resultType="com.op.mes.domain.MesReportWork">
select
@ -598,7 +601,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mrw.product_code productCode,
mrw.product_name productName,
mrw.sac1,
mrw.sac2
mrw.sac2,
equ.sap_code sapCode
from (
select
workorder_code,
@ -614,6 +618,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by workorder_code,product_code,product_name,use_man
) mrw
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
left join base_equipment equ on equ.equipment_code = ow.workorder_name
</select>
<select id="getEndReport" resultType="com.op.mes.domain.MesReportWork">
select end_report endReport

@ -73,7 +73,7 @@ public interface OpenMapper {
List<QcCheckTaskDetailDTO> getTPByTypeGroup(QcCheckTypeProjectDTO qctp);
void insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce);
int insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce);
public int addBatch(@Param("list") List<QcCheckTaskDetailDTO> items);

@ -370,7 +370,7 @@ public class OpenServiceImpl implements OpenService {
}
/**qc_check_task_user**/
int m = openMapper.addCheckUsers(users);
logger.info("检查人新增" + m + "成功");
logger.info(qcCheckTaskProduce.getOrderNo()+":检查人新增" + m + "成功");
/**qc_check_type_project**/
List<QcCheckTaskDetailDTO> items = openMapper.getTPByTypeMaterial(qctp);
@ -378,7 +378,7 @@ public class OpenServiceImpl implements OpenService {
/**qc_material_group_detail**/
QcMaterialGroupDetailDTO group = openMapper.getGroupByMaterial(qcCheckTaskProduce.getMaterialCode());
if (group == null) {
logger.info(qcCheckTaskProduce.getMaterialCode()+"没有维护物料组检测项,检验任务生成失败");
logger.info(qcCheckTaskProduce.getOrderNo()+":"+qcCheckTaskProduce.getMaterialCode()+"没有维护物料组检测项,检验任务生成失败");
return 0;//没有找到检测项目
}
qctp.setGroupId(group.getGroupId());//共性
@ -391,7 +391,6 @@ public class OpenServiceImpl implements OpenService {
}
/**qc_check_task**/
qcCheckTaskProduce.setRecordId(beLongId);
qcCheckTaskProduce.setFactoryCode(factoryCode);
qcCheckTaskProduce.setCreateTime(nowDate);
@ -401,7 +400,9 @@ public class OpenServiceImpl implements OpenService {
qcCheckTaskProduce.setSupplierName(qcCheckTaskProduce.getCarName());
qcCheckTaskProduce.setCheckManName(null);
qcCheckTaskProduce.setCheckManCode(null);
openMapper.insertQcCheckTaskProduce(qcCheckTaskProduce);
int m0 = openMapper.insertQcCheckTaskProduce(qcCheckTaskProduce);
logger.info(qcCheckTaskProduce.getOrderNo()+":qc_check_task新增" + m0 + "成功");
/**qc_check_task_detail**/
for (QcCheckTaskDetailDTO item : items) {
item.setRecordId(IdUtils.fastSimpleUUID());
@ -411,7 +412,9 @@ public class OpenServiceImpl implements OpenService {
item.setFactoryCode(factoryCode);
item.setStatus("Y");
}
return openMapper.addBatch(items);
int n = openMapper.addBatch(items);
logger.info(qcCheckTaskProduce.getOrderNo()+":qc_check_task_detail新增" + n + "成功");
return n;
}
@Override

@ -77,6 +77,19 @@ public class ProOrderWorkorderController extends BaseController {
return proOrderWorkorderService.subChangeWorkOrder(splitOrderDTO);
}
/**
*
*
* @param splitOrderDTO
* @return
*/
@PostMapping("/subChangeWorkOrderPro")
@RequiresPermissions("mes:pro:workorder:edit")
@Log(title = "修改成品工单", businessType = BusinessType.UPDATE)
public AjaxResult subChangeWorkOrderPro(@RequestBody SplitOrderDTO splitOrderDTO) {
return proOrderWorkorderService.subChangeWorkOrderPro(splitOrderDTO);
}
/**
* -
*
@ -234,6 +247,7 @@ public class ProOrderWorkorderController extends BaseController {
return toAjax(1);
}
/**
* workorderIds
*/

@ -174,7 +174,7 @@ public class ProOrderWorkorder extends TreeEntity {
* 2
*/
private String attr2;
private String atrr2;
/**
* 3
*/
@ -376,6 +376,14 @@ public class ProOrderWorkorder extends TreeEntity {
this.bucketCode = bucketCode;
}
public String getAtrr2() {
return atrr2;
}
public void setAtrr2(String atrr2) {
this.atrr2 = atrr2;
}
public Integer getMaterialId() {
return materialId;
}

@ -78,4 +78,5 @@ public interface ProOrderWorkorderBatchMapper {
*/
List<String> selectCodeByWorkOrderIds(String[] workorderIds);
public int deleteBatch(String[] workorderIds);
}

@ -129,4 +129,6 @@ public interface IProOrderWorkorderService {
List<ProOrderWorkorder> getWorkorderLevel0List(ProOrderWorkorder proOrderWorkorder);
List<ProOrderWorkorder> getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder);
AjaxResult subChangeWorkOrderPro(SplitOrderDTO splitOrderDTO);
}

@ -248,16 +248,16 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
ProOrderWorkorder work = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId);
if (work != null) {
workers.add(work);
ProOrderWorkorder bottomWork = work;
ProOrderWorkorder topWork = work;
Boolean run = true;
while (run) {
//
ProOrderWorkorder topworkers = proOrderWorkorderMapper.selectWorkOrderByCode(bottomWork.getParentOrder());
//
ProOrderWorkorder sonWorkers = proOrderWorkorderMapper.selectSonWorkOrder(topWork.getWorkorderCode());
//有上级code
if (topworkers != null) {
workers.add(topworkers);
delteIds.add(topworkers.getWorkorderId());
bottomWork.setParentOrder(topworkers.getParentOrder());
if (sonWorkers != null) {
workers.add(sonWorkers);
delteIds.add(sonWorkers.getWorkorderId());
topWork.setWorkorderCode(sonWorkers.getWorkorderCode());
} else {
run = false;
}
@ -268,7 +268,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
//删除工单(字母)pro_order_workorder
proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds0);
//删除批次pro_order_workorder_batch
proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(workorderIds0);
proOrderWorkorderBatchMapper.deleteBatch(workorderIds0);
}
if (!CollectionUtils.isEmpty(workers)) {
@ -376,7 +376,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
SapCreateOrder sap = new SapCreateOrder();
sap.setWerks(whiteOrder.getFactoryCode());//工厂编码
sap.setAufpar("LJ01");//订单类型
sap.setVerid(whiteOrder.getAttr2());//生产版本
sap.setVerid(whiteOrder.getAtrr2());//生产版本
sap.setMatnr(whiteOrder.getProductCode());//物料编号
sap.setQuantity(whiteOrder.getQuantitySplit() + "");//数量
sap.setDates(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//开始时间
@ -831,7 +831,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
"订单数量变更结果:" + rSapChange.getCode() + "," + rSapChange.getMsg());
}
// 获得对应工单
// 获得对应工单----------------------------------------------------------------------------
ProOrderWorkorder proOrderWorkorder = workOrderList.get(--index);
// 更新订单
proOrder.setUpdateBy(SecurityContextHolder.getUserName());
@ -882,9 +882,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
// 更新至数据库
proOrderWorkorderBatchMapper.insertProOrderWorkorderBatch(workBatch);
// 测试
// System.out.println("这里是workorderId----------->"+workBatch.getWorkorderId());
// System.out.println("这里是拆分数量----------->"+workBatch.getBatchQuantity());
}
// 如果存在子节点
@ -900,7 +897,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
}
}
return success("变更成功");
// throw new RuntimeException();
}
@ -910,6 +906,192 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return error(500, "批次号不能重复");
}
/**
*
*
* @param splitOrderDTO
* @return
*/
@Override
@DS("#header.poolName")
@Transactional
public AjaxResult subChangeWorkOrderPro(SplitOrderDTO splitOrderDTO) {
// 获得子工单对象——(这里没有用BeanUtils是因为若依与这个冲突造成死循环得到错误的结果)
ProOrderWorkorder proWorkOrder = splitOrderDTO.getProOrderWorkorder();
// 通过子工单获得所有工单信息,并将所有工单信息放入list中
List<ProOrderWorkorder> workOrderList = new ArrayList<>();
// 将获得的工单的id存放
List<String> ids = new ArrayList<>();
boolean getworkOrder = true;
// 将工单放入list
workOrderList.add(proWorkOrder);
// 将id放入
ids.add(proWorkOrder.getWorkorderId());
// 用于循环
ProOrderWorkorder childWorkOrder = new ProOrderWorkorder();
BeanUtils.copyProperties(proWorkOrder, childWorkOrder);
while (getworkOrder) {
// 通过parentOrder查询子工单信息
ProOrderWorkorder sonWorkOrder = proOrderWorkorderMapper.selectSonWorkOrder(childWorkOrder.getWorkorderCode());
if (sonWorkOrder != null) {
// 将重置对象
BeanUtils.copyProperties(sonWorkOrder, childWorkOrder);
// 将工单放入list
workOrderList.add(sonWorkOrder);
// 将id放入
ids.add(sonWorkOrder.getWorkorderId());
} else {
// 终止循环
getworkOrder = false;
}
}
boolean checkout = true;
// 校验批次编号是否存在(重复问题)
String[] workorderIds = (String[]) ids.toArray(new String[ids.size()]);
List<String> batchCodes = proOrderWorkorderBatchMapper.selectCodeByWorkOrderIds(workorderIds);
for (int i = 0; i < batchCodes.size(); i++) {
for (int j = 0; j < splitOrderDTO.getFormFields().size(); j++) {
if (batchCodes.get(i).equals(splitOrderDTO.getFormFields().get(j).getBatchCode())) {
checkout = false;
}
}
}
//校验各工序设备是否已选择
List<CascaderDTO> processes = proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode());
if (splitOrderDTO.getProdLineCodeArray().length == 0) {
checkout = false;
return error(500, "必须选择工单生产设备!");
} else {
String codeArray = JSONArray.toJSONString(splitOrderDTO.getProdLineCodeArray());
for (int i = 0; i < processes.size(); i++) {
if (codeArray.indexOf(processes.get(i).getValue()) < 0) {
checkout = false;
return error(500, "所有有工序节点都必须选择生产设备!");
}
}
String[][] array = splitOrderDTO.getProdLineCodeArray();
for (int m = 0; m < array.length; m++) {
if (array[m].length < 2) {
checkout = false;
return error(500, "工序没有生产设备可选择,请维护工艺!");
}
}
splitOrderDTO.setProdLineCode(codeArray);
}
if (checkout) {
// 删除所有工单s下的批次信息
int i = proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(workorderIds);
// 删除湿料计划
proWetMaterialPlanDetailMapper.deleteProWetMaterialPlanDetailByWorkId(proWorkOrder.getWorkorderId());
// 创建订单信息并将信息copy进去
ProOrder proOrder = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), proOrder);
// 设置换算基数,用于获得换算值
Long quantity = proOrder.getQuantity();
// 创建批次表通用对象
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
boolean run = true;
// 获取单位换算值
Long conver = 1L;
int index = 0;
while (run) {
if (StringUtils.isBlank(proOrder.getParentOrder())) {
//推送sap订单更新信息
SapShopOrderQuery sapChange = new SapShopOrderQuery();
sapChange.setAufnr(proOrder.getOrderCode());//母订单号
BigDecimal newSapQuantityNum = new BigDecimal(proOrder.getQuantity())
.subtract(new BigDecimal(proOrder.getAtrr1()));
sapChange.setQuantity(newSapQuantityNum.toString());//母订单新数量
logger.info("母订单" + proOrder.getOrderCode() +
"订单数量变更:修改前" + proOrder.getQuantity() + "," +
"已拆数量" + proOrder.getAtrr1() + "," +
"给sap汇报数量" + newSapQuantityNum.toString());
R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据
logger.info("母订单" + proOrder.getOrderCode() +
"订单数量变更结果:" + rSapChange.getCode() + "," + rSapChange.getMsg());
}
// 获得对应工单----------------------------------------------------------------------------
ProOrderWorkorder proOrderWorkorder = workOrderList.get(index++);
// 更新订单
proOrder.setUpdateBy(SecurityContextHolder.getUserName());
proOrder.setUpdateTime(DateUtils.getNowDate());
proOrder.setQuantitySplit(proOrder.getQuantitySplit() + Long.valueOf(proOrder.getAtrr1()));
if (proOrder.getQuantity().longValue() == proOrder.getQuantitySplit().longValue()) {
// 已拆分
proOrder.setStatus("o2");
} else {
// 拆分中
proOrder.setStatus("o1");
}
proOrderMapper.updateProOrder(proOrder);
// 设置工单信息
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
proOrderWorkorder.setUpdateTime(DateUtils.getNowDate());
// 拆分数量
proOrderWorkorder.setQuantitySplit(Long.valueOf(proOrder.getAtrr1()));
// 2.将工单信息更新至数据库
if (splitOrderDTO.getProdLineCode() != null) {
proOrderWorkorder.setProdLineCode(splitOrderDTO.getProdLineCode());
}
if (splitOrderDTO.getProductDate() != null) {
proOrderWorkorder.setProductDate(splitOrderDTO.getProductDate());
}
if (splitOrderDTO.getShiftId() != null) {
proOrderWorkorder.setShiftId(splitOrderDTO.getShiftId());
}
if (splitOrderDTO.getRouteCode() != null) {
proOrderWorkorder.setRouteCode(splitOrderDTO.getRouteCode());
}
proOrderWorkorderMapper.updateProOrderWorkorder(proOrderWorkorder);
// 删除工单下对应批次信息
proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderId(proOrderWorkorder.getWorkorderId());
// 生成对应批次表
workBatch.setWorkorderId(proOrderWorkorder.getWorkorderId());
// 生成批次表信息并更新至数据库
for (Batch batch : splitOrderDTO.getFormFields()) {
// 生成批次id
workBatch.setBatchId(IdUtils.fastSimpleUUID());
// 生成批次号
workBatch.setBatchCode(batch.getBatchCode());
// 生成批次数量
workBatch.setBatchQuantity(batch.getBatchQuantity() * conver);
// 更新至数据库
proOrderWorkorderBatchMapper.insertProOrderWorkorderBatch(workBatch);
}
// 如果存在子节点
if (proOrder.getChildren().size() > 0) {
ProOrderDTO newProOrder = (ProOrderDTO) proOrder.getChildren().get(0);
// 更新换算值
conver = (newProOrder.getQuantity() / quantity);
// 将child信息重新赋值给proOrder
BeanUtils.copyProperties(newProOrder, proOrder);
} else {
// 结束循环
run = false;
}
}
return success("变更成功");
}
return error(500, "批次号不能重复");
}
/**
*
* 湿

@ -296,7 +296,7 @@
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="prodSpc != null">prod_spc = #{prodSpc},</if>
from_sap_time = GETDATE(),
cegci = #{cegci},
<if test="cegci != null">cegci = #{cegci},</if>
<if test="syncUser != null">sync_user = #{syncUser},</if>
</trim>
where id = #{id}

@ -150,4 +150,13 @@
)
</delete>
<delete id="deleteBatch" parameterType="String">
update pro_order_workorder_batch
set del_flag = '1'
where workorder_id in
<foreach item="workorderId" collection="array" open="(" separator="," close=")">
#{workorderId}
</foreach>
</delete>
</mapper>

@ -27,6 +27,8 @@
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="atrr2" column="atrr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
@ -189,9 +191,18 @@
</where>
</select>
<select id="selectProOrderWorkorderByWorkorderId" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where (workorder_code = #{workorderId} or workorder_id = #{workorderId})
and del_flag = '0'
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code, pow.product_id,
pow.product_code, pow.product_name,
pow.product_spc, pow.unit, pow.quantity_produced, pow.quantity_split, pow.route_code, pow.prod_line_code,
pow.product_date,
pow.shift_id, pow.parent_order, pow.ancestors, pow.status, pow.remark, pow.attr1, pow.attr2,
pow.attr3, pow.attr4, pow.create_by, pow.create_time,
pow.update_by, pow.update_time, pow.prod_type, pow.factory_code , pow.end_flag , pow.car_num,
pow.sort_no,pow.workorder_code_sap, po.atrr2
from pro_order_workorder pow
left join pro_order po on pow.order_code = po.order_code
where (pow.workorder_code = #{workorderId} or pow.workorder_id = #{workorderId})
and pow.del_flag = '0'
</select>
<select id="selectFirWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">

@ -0,0 +1,126 @@
package com.op.quality.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcGoal;
//import com.op.quality.service.IQcGoalService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Open Platform
* @date 2024-03-04
*/
@RestController
@RequestMapping("/qcGoal")
public class QcGoalController extends BaseController {
// @Autowired
// private IQcGoalService qcGoalService;
//
// /**
// * 查询质量目标列表
// */
// @RequiresPermissions("quality:qcGoal:list")
// @GetMapping("/list")
// public TableDataInfo list(QcGoal qcGoal) {
// startPage();
// List<QcGoal> list = qcGoalService.selectQcGoalList(qcGoal);
// return getDataTable(list);
// }
//
// /**
// * 查询二级质量目标
// */
// @GetMapping("/getChildrenList/{parentId}")
// public List<QcGoal> getChildrenList(@PathVariable("parentId") String parentId) {
// QcGoal goal = new QcGoal();
// goal.setParentGoal(parentId);
// List<QcGoal> list = qcGoalService.selectChildrenByParent(goal);
// return list;
// }
//
// /**
// * 导出质量目标列表
// */
// @RequiresPermissions("quality:qcGoal:export")
// @Log(title = "质量目标", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, QcGoal qcGoal) {
// List<QcGoal> list = qcGoalService.selectQcGoalList(qcGoal);
// ExcelUtil<QcGoal> util = new ExcelUtil<QcGoal>(QcGoal. class);
// util.exportExcel(response, list, "质量目标数据");
// }
//
// /**
// * 获取质量目标详细信息
// */
// @RequiresPermissions("quality:qcGoal:query")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") String id) {
// return success(qcGoalService.selectQcGoalById(id));
// }
//
// /**
// * 获取质量目标下拉树列表
// */
// @GetMapping("/treeSelect")
// public AjaxResult treeSelect(QcGoal qcGoal) {
// List<QcGoal> qcGoals = qcGoalService.selectQcGoalList(qcGoal);
// return success(qcGoalService.buildQcGoalTreeSelect(qcGoals));
// }
//
// /**
// * 新增质量目标
// */
// @RequiresPermissions("quality:qcGoal:add")
// @Log(title = "质量目标", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody QcGoal qcGoal) {
// return toAjax(qcGoalService.insertQcGoal(qcGoal));
// }
//
// /**
// * 拆解质量目标
// */
// @GetMapping("/generate/{id}")
// public TableDataInfo generate(@PathVariable("id") String id) {
// List<QcGoal> qcGoalList = qcGoalService.generate(id);
// return getDataTable(qcGoalList);
// }
//
//
// /**
// * 修改质量目标
// */
// @RequiresPermissions("quality:qcGoal:edit")
// @Log(title = "质量目标", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody QcGoal qcGoal) {
// return toAjax(qcGoalService.updateQcGoal(qcGoal));
// }
//
// /**
// * 删除质量目标
// */
// @RequiresPermissions("quality:qcGoal:remove")
// @Log(title = "质量目标", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable String[] ids) {
// int rows = qcGoalService.deleteQcGoalByIds(ids);
// if (rows > 0 ) {
// return success("操作成功");
// }else {
// return error("操作失败,请检查要删除的项目是否含有子项目");
// }
// }
}

@ -0,0 +1,118 @@
package com.op.quality.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.quality.domain.QcGoal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcGoalDistribute;
//import com.op.quality.service.IQcGoalDistributeService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Open Platform
* @date 2024-03-07
*/
@RestController
@RequestMapping("/qcGoalDistribute")
public class QcGoalDistributeController extends BaseController {
// @Autowired
// private IQcGoalDistributeService qcGoalDistributeService;
//
///**
// * 查询质量目标分配列表
// */
//@RequiresPermissions("quality:qcGoalDistribute:list")
//@GetMapping("/list")
// public TableDataInfo list(QcGoalDistribute qcGoalDistribute) {
// startPage();
// List<QcGoalDistribute> list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute);
// return getDataTable(list);
// }
//
// /**
// * 导出质量目标分配列表
// */
// @RequiresPermissions("quality:qcGoalDistribute:export")
// @Log(title = "质量目标分配", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, QcGoalDistribute qcGoalDistribute) {
// List<QcGoalDistribute> list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute);
// ExcelUtil<QcGoalDistribute> util = new ExcelUtil<QcGoalDistribute>(QcGoalDistribute. class);
// util.exportExcel(response, list, "质量目标分配数据");
// }
//
// /**
// * 获取质量目标分配详细信息
// */
// @RequiresPermissions("quality:qcGoalDistribute:query")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") String id) {
// return success(qcGoalDistributeService.selectQcGoalDistributeById(id));
// }
//
// /**
// * 新增质量目标分配
// */
// @Log(title = "质量目标分配", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody QcGoalDistribute qcGoalDistribute) {
// return toAjax(qcGoalDistributeService.insertQcGoalDistribute(qcGoalDistribute));
// }
//
// /**
// * 修改质量目标分配
// */
// @RequiresPermissions("quality:qcGoalDistribute:edit")
// @Log(title = "质量目标分配", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody QcGoalDistribute qcGoalDistribute) {
// return toAjax(qcGoalDistributeService.updateQcGoalDistribute(qcGoalDistribute));
// }
//
// /**
// * 删除质量目标分配
// */
// @RequiresPermissions("quality:qcGoalDistribute:remove")
// @Log(title = "质量目标分配", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable String[] ids) {
// return toAjax(qcGoalDistributeService.deleteQcGoalDistributeByIds(ids));
// }
// /**
// * 获取未分配供应商数据
// */
// @GetMapping(value = "/getLeftList")
// public TableDataInfo getLeftList(QcGoalDistribute qcGoalDistribute) {
// startPage();
// List<QcGoalDistribute> list = qcGoalDistributeService.getLeftList(qcGoalDistribute);
// return getDataTable(list);
// }
//
// /**
// * 获取已分配供应商数据
// */
// @GetMapping(value = "/getRightList")
// public TableDataInfo getRightList(QcGoalDistribute qcGoalDistribute) {
// startPage();
// List<QcGoalDistribute> list = qcGoalDistributeService.getRightList(qcGoalDistribute);
// return getDataTable(list);
// }
}

@ -189,6 +189,12 @@ public class QuaController extends BaseController {
if(CollectionUtils.isEmpty(qcCheckTaskIncome.getQcCheckTaskDetails())){
return error("[List<QcCheckTaskDetail>]不能为空");
}
if(StringUtils.isBlank(qcCheckTaskIncome.getUpdateBy())){
return error("[updateBy]不能为空");
}
if(StringUtils.isBlank(qcCheckTaskIncome.getUpdateByName())){
return error("[updateByName]不能为空");
}
return toAjax(qcCheckTaskIncomeService.commitCheckResults(qcCheckTaskIncome));
}
/**

@ -0,0 +1,273 @@
package com.op.quality.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* qc_goal
*
* @author Open Platform
* @date 2024-03-04
*/
public class QcGoal extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
*
*/
@Excel(name = "目标年份", readConverterExp = "月=份")
private String goalYm;
/**
*
*/
@Excel(name = "目标类别")
private String goalType;
/**
*
*/
@Excel(name = "不良率")
private BigDecimal nookRate;
/**
*
*/
@Excel(name = "抽样比例")
private BigDecimal nookQualityRate;
/**
* 1
*/
@Excel(name = "预留字段1")
private String attr1;
/**
* 2
*/
@Excel(name = "预留字段2")
private String attr2;
/**
* 3
*/
@Excel(name = "预留字段3")
private String attr3;
/**
* 4
*/
@Excel(name = "预留字段4")
private String attr4;
/**
*
*/
@Excel(name = "工厂编码")
private String factoryCode;
/**
* 10
*/
private String delFlag;
/**
*
*/
@Excel(name = "检验节点小节点")
private String checkType;
/**
*
*/
@Excel(name = "检验节点大类")
private String typeCode;
/**
*
*/
@Excel(name = "适配范围")
private String scope;
/**
*
*/
@Excel(name = "父级目标")
private String parentGoal;
private Boolean hasChildren;
private List<QcGoal> children = new ArrayList<>();
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setGoalYm(String goalYm) {
this.goalYm = goalYm;
}
public String getGoalYm() {
return goalYm;
}
public void setGoalType(String goalType) {
this.goalType = goalType;
}
public String getGoalType() {
return goalType;
}
public void setNookRate(BigDecimal nookRate) {
this.nookRate = nookRate;
}
public BigDecimal getNookRate() {
return nookRate;
}
public void setNookQualityRate(BigDecimal nookQualityRate) {
this.nookQualityRate = nookQualityRate;
}
public BigDecimal getNookQualityRate() {
return nookQualityRate;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public String getCheckType() {
return checkType;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getTypeCode() {
return typeCode;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getScope() {
return scope;
}
public void setParentGoal(String parentGoal) {
this.parentGoal = parentGoal;
}
public String getParentGoal() {
return parentGoal;
}
public Boolean getHasChildren() {
return hasChildren;
}
public void setHasChildren(Boolean hasChildren) {
this.hasChildren = hasChildren;
}
public List<QcGoal> getChildren() {
return children;
}
public void setChildren(List<QcGoal> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("goalYm", getGoalYm())
.append("goalType", getGoalType())
.append("nookRate", getNookRate())
.append("nookQualityRate", getNookQualityRate())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.append("checkType", getCheckType())
.append("typeCode", getTypeCode())
.append("scope", getScope())
.append("parentGoal", getParentGoal())
.toString();
}
}

@ -0,0 +1,216 @@
package com.op.quality.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.util.List;
/**
* qc_goal_distribute
*
* @author Open Platform
* @date 2024-03-07
*/
public class QcGoalDistribute extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* id
*/
@Excel(name = "所属质量目标id")
private String belongGoalId;
/**
* ()
*/
@Excel(name = "供应商(产品)编码")
private String supplierCode;
/**
* ()
*/
@Excel(name = "供应商(产品)名称")
private String supplierName;
/**
* 1
*/
@Excel(name = "预留字段1")
private String attr1;
/**
* 2
*/
@Excel(name = "预留字段2")
private String attr2;
/**
* 3
*/
@Excel(name = "预留字段3")
private String attr3;
/**
* 4
*/
@Excel(name = "预留字段4")
private String attr4;
/**
*
*/
@Excel(name = "工厂编码")
private String factoryCode;
/**
* 10
*/
private String delFlag;
private String label;
private String key;
private String[] SupplierCodes;
private List<String> selectedValues;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setBelongGoalId(String belongGoalId) {
this.belongGoalId = belongGoalId;
}
public String getBelongGoalId() {
return belongGoalId;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getSupplierCode() {
return supplierCode;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getSupplierName() {
return supplierName;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String[] getSupplierCodes() {
return SupplierCodes;
}
public void setSupplierCodes(String[] supplierCodes) {
SupplierCodes = supplierCodes;
}
public List<String> getSelectedValues() {
return selectedValues;
}
public void setSelectedValues(List<String> selectedValues) {
this.selectedValues = selectedValues;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("belongGoalId", getBelongGoalId())
.append("supplierCode", getSupplierCode())
.append("supplierName", getSupplierName())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -1,9 +1,11 @@
package com.op.quality.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.op.quality.domain.QcGoal;
import com.op.quality.domain.QcMaterialGroup;
import javax.xml.bind.annotation.XmlEnum;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
@ -42,6 +44,12 @@ public class TreeSelect implements Serializable {
this.children = qcMaterialGroup.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(QcGoal qcGoal) {
this.id = qcGoal.getId();
this.label = qcGoal.getGoalYm();
this.children = qcGoal.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public String getId() {
return id;
}

@ -0,0 +1,70 @@
package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcGoalDistribute;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author Open Platform
* @date 2024-03-07
*/
@Mapper
public interface QcGoalDistributeMapper {
/**
*
*
* @param id
* @return
*/
public QcGoalDistribute selectQcGoalDistributeById(String id);
/**
*
*
* @param qcGoalDistribute
* @return
*/
public List<QcGoalDistribute> selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute);
/**
*
*
* @param qcGoalDistribute
* @return
*/
public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute);
/**
*
*
* @param qcGoalDistribute
* @return
*/
public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute);
/**
*
*
* @param id
* @return
*/
public int deleteQcGoalDistributeById(String id);
public int deleteQcGoalDistributeByBelongId(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteQcGoalDistributeByIds(String[] ids);
public List<QcGoalDistribute> getGoalDistributeUndo(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getGoalDistributeDo(QcGoalDistribute qcGoalDistribute);
}

@ -0,0 +1,75 @@
package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcGoal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author Open Platform
* @date 2024-03-04
*/
@Mapper
public interface QcGoalMapper {
/**
*
*
* @param id
* @return
*/
public QcGoal selectQcGoalById(String id);
/**
*
*
* @param qcGoal
* @return
*/
public List<QcGoal> selectQcGoalList(QcGoal qcGoal);
public List<QcGoal> selectChildrenByParent(QcGoal qcGoal);
/**
*
*
* @param qcGoal
* @return
*/
public int insertQcGoal(QcGoal qcGoal);
/**
*
* @param qcGoalList
* @return
*/
public int insertQcGoalList(@Param("qcGoalList") List<QcGoal> qcGoalList);
/**
*
*
* @param qcGoal
* @return
*/
public int updateQcGoal(QcGoal qcGoal);
/**
*
*
* @param id
* @return
*/
public int deleteQcGoalById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteQcGoalByIds(String[] ids);
public int getTodayMaxNum(QcGoal qcGoal);
}

@ -0,0 +1,153 @@
//package com.op.quality.service.impl;
//
//import java.util.Date;
//import java.util.List;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.op.common.core.utils.DateUtils;
//import com.op.common.core.utils.StringUtils;
//import com.op.common.core.utils.uuid.IdUtils;
//import com.op.common.security.utils.SecurityUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.op.quality.mapper.QcGoalDistributeMapper;
//import com.op.quality.domain.QcGoalDistribute;
//import com.op.quality.service.IQcGoalDistributeService;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * 质量目标分配Service业务层处理
// *
// * @author Open Platform
// * @date 2024-03-07
// */
//@Service
//public class QcGoalDistributeServiceImpl implements IQcGoalDistributeService {
// @Autowired
// private QcGoalDistributeMapper qcGoalDistributeMapper;
//
// /**
// * 查询质量目标分配
// *
// * @param id 质量目标分配主键
// * @return 质量目标分配
// */
// @Override
// @DS("#header.poolName")
// public QcGoalDistribute selectQcGoalDistributeById(String id) {
// return qcGoalDistributeMapper.selectQcGoalDistributeById(id);
// }
//
// /**
// * 查询质量目标分配列表
// *
// * @param qcGoalDistribute 质量目标分配
// * @return 质量目标分配
// */
// @Override
// @DS("#header.poolName")
// public List<QcGoalDistribute> selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute) {
// return qcGoalDistributeMapper.selectQcGoalDistributeList(qcGoalDistribute);
// }
//
// /**
// * 新增质量目标分配
// *
// * @param qcGoalDistribute 质量目标分配
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute) {
//
// if (StringUtils.isNotEmpty(qcGoalDistribute.getBelongGoalId())) {
// qcGoalDistributeMapper.deleteQcGoalDistributeByBelongId(qcGoalDistribute.getBelongGoalId());
// }
// int count = 0;
// if (qcGoalDistribute.getSelectedValues().size() > 0){
// QcGoalDistribute dto = null;
// Date now = DateUtils.getNowDate();
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// String key = "#header.poolName";
// String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
// for (String supplierCode : qcGoalDistribute.getSelectedValues()) {
// dto = new QcGoalDistribute();
// dto.setId(IdUtils.fastSimpleUUID());
// dto.setCreateTime(now);
// dto.setCreateBy(SecurityUtils.getUsername());
// dto.setBelongGoalId(qcGoalDistribute.getBelongGoalId());
// dto.setSupplierCode(supplierCode);
// dto.setFactoryCode(factoryCode);
// count += qcGoalDistributeMapper.insertQcGoalDistribute(dto);
// }
// }else {
// count = 1;
// }
// return count;
// }
//
// /**
// * 修改质量目标分配
// *
// * @param qcGoalDistribute 质量目标分配
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute) {
// qcGoalDistribute.setUpdateTime(DateUtils.getNowDate());
// return qcGoalDistributeMapper.updateQcGoalDistribute(qcGoalDistribute);
// }
//
// /**
// * 批量删除质量目标分配
// *
// * @param ids 需要删除的质量目标分配主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalDistributeByIds(String[] ids) {
// return qcGoalDistributeMapper.deleteQcGoalDistributeByIds(ids);
// }
//
// /**
// * 删除质量目标分配信息
// *
// * @param id 质量目标分配主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalDistributeById(String id) {
// return qcGoalDistributeMapper.deleteQcGoalDistributeById(id);
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoalDistribute> getLeftList(QcGoalDistribute qcGoalDistribute) {
// List<QcGoalDistribute> dto = qcGoalDistributeMapper.getGoalDistributeUndo(qcGoalDistribute);
// List<QcGoalDistribute> selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute);
// dto.addAll(selected);
// dto.forEach(item -> {
// item.setKey(item.getSupplierCode());
// });
// return dto;
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoalDistribute> getRightList(QcGoalDistribute qcGoalDistribute) {
// List<QcGoalDistribute> selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute);
// selected.forEach(item -> {
// item.setKey(item.getSupplierCode());
// });
// return selected;
// }
//
//
//
//}

@ -0,0 +1,245 @@
//package com.op.quality.service.impl;
//
//import java.math.BigDecimal;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.Iterator;
//import java.util.List;
//import java.util.stream.Collectors;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.op.common.core.utils.DateUtils;
//import com.op.common.security.utils.SecurityUtils;
//import com.op.quality.domain.vo.TreeSelect;
//import com.sun.xml.bind.v2.TODO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.op.quality.mapper.QcGoalMapper;
//import com.op.quality.domain.QcGoal;
//import com.op.quality.service.IQcGoalService;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * 质量目标Service业务层处理
// *
// * @author Open Platform
// * @date 2024-03-04
// */
//@Service
//public class QcGoalServiceImpl implements IQcGoalService {
// @Autowired
// private QcGoalMapper qcGoalMapper;
//
// /**
// * 查询质量目标
// *
// * @param id 质量目标主键
// * @return 质量目标
// */
// @Override
// @DS("#header.poolName")
// public QcGoal selectQcGoalById(String id) {
// return qcGoalMapper.selectQcGoalById(id);
// }
//
// /**
// * 查询质量目标列表
// *
// * @param qcGoal 质量目标
// * @return 质量目标
// */
// @Override
// @DS("#header.poolName")
// public List<QcGoal> selectQcGoalList(QcGoal qcGoal) {
// List<QcGoal> qcGoals = qcGoalMapper.selectQcGoalList(qcGoal);
// for (QcGoal item : qcGoals) {
// item.setHasChildren(true);
// }
// return qcGoals;
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoal> selectChildrenByParent(QcGoal goal) {
// return qcGoalMapper.selectChildrenByParent(goal);
// }
//
// @Override
// @DS("#header.poolName")
// public List<TreeSelect> buildQcGoalTreeSelect(List<QcGoal> qcGoals) {
// List<QcGoal> qcGoalTrees = buildGoalTree(qcGoals);
// return qcGoalTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
// }
//
// /**
// * 新增质量目标
// *
// * @param qcGoal 质量目标
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int insertQcGoal(QcGoal qcGoal) {
// qcGoal.setCreateTime(DateUtils.getNowDate());
// qcGoal.setCreateBy(SecurityUtils.getUsername());
//
// qcGoal.setId(getSerialNumber(qcGoal));
// qcGoal.setFactoryCode(getFactoryCode());
// qcGoal.setParentGoal("0");
//
// return qcGoalMapper.insertQcGoal(qcGoal);
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoal> generate(String id) {
// QcGoal goal = qcGoalMapper.selectQcGoalById(id);
// List<QcGoal> genResult = new ArrayList<>();
//
// // 提前分配大小,有助于减少不必要的计算和内存分配,从而提高代码的性能。
// String goalYm = goal.getGoalYm();
// BigDecimal nookQualityRate = goal.getNookQualityRate();
// BigDecimal nookRate = goal.getNookRate();
// String checkType = goal.getCheckType();
// String typeCode = goal.getTypeCode();
// String factoryCode = getFactoryCode();
// String username = SecurityUtils.getUsername();
// Date nowDate = DateUtils.getNowDate();
// String parentGoal = goal.getId();
//
//
// int liushuiNum = qcGoalMapper.getTodayMaxNum(goal);
// String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
//
// int month = 12;
// for (int i = 1; i <= month; i++) {
// QcGoal monthGoal = new QcGoal();
//
// String liushuiStr = String.format("%04d", liushuiNum+i-1);
// monthGoal.setId(dateNumber+liushuiStr);
// String mon = String.format("%02d",i);
// monthGoal.setGoalYm(goalYm+"-"+mon);
// monthGoal.setGoalType("mm");
// monthGoal.setNookQualityRate(nookQualityRate);
// monthGoal.setNookRate(nookRate);
// monthGoal.setCheckType(checkType);
// monthGoal.setTypeCode(typeCode);
// monthGoal.setScope(goal.getScope());
// monthGoal.setCreateTime(nowDate);
// monthGoal.setCreateBy(username);
// monthGoal.setFactoryCode(factoryCode);
// monthGoal.setParentGoal(parentGoal);
// genResult.add(monthGoal);
// }
// // 批量插入
// int flag = qcGoalMapper.insertQcGoalList(genResult);
// if (flag > 0) {
// return genResult;
// }else {
// return goal.getChildren();
// }
//
// }
//
// /**
// * 修改质量目标
// *
// * @param qcGoal 质量目标
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int updateQcGoal(QcGoal qcGoal) {
// qcGoal.setUpdateTime(DateUtils.getNowDate());
// qcGoal.setUpdateBy(SecurityUtils.getUsername());
// return qcGoalMapper.updateQcGoal(qcGoal);
// }
//
// /**
// * 批量删除质量目标
// *
// * @param ids 需要删除的质量目标主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalByIds(String[] ids) {
// boolean flag = false;
// for (String id : ids) {
// QcGoal goal = new QcGoal();
// goal.setParentGoal(id);
// List<QcGoal> hasChildren = qcGoalMapper.selectChildrenByParent(goal);
// if (hasChildren.size() > 0) {
// flag = true;
// break;
// }
// }
// if (flag) {
// return 0;
// }else {
// return qcGoalMapper.deleteQcGoalByIds(ids);
// }
// }
//
// /**
// * 删除质量目标信息
// *
// * @param id 质量目标主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalById(String id) {
// return qcGoalMapper.deleteQcGoalById(id);
// }
//
// @Override
// public List<QcGoal> buildGoalTree(List<QcGoal> qcGoals) {
// List<QcGoal> returnList = new ArrayList<>();
// List<String> tempList = qcGoals.stream().map(QcGoal::getId).collect(Collectors.toList());
// for (Iterator<QcGoal> iterator = qcGoals.iterator(); iterator.hasNext(); ) {
// QcGoal qcGoal = (QcGoal) iterator.next();
// //如果是顶级节点,遍历父节点的所有子节点
// if (!tempList.contains(qcGoal.getParentGoal())) {
// List<QcGoal> childList = getChildList(qcGoals,qcGoal);
// qcGoal.setChildren(childList);
// returnList.add(qcGoal);
// }
// }
// if (returnList.isEmpty()) {
// returnList = qcGoals;
// }
// return returnList;
// }
//
// private List<QcGoal> getChildList(List<QcGoal> list, QcGoal t) {
// List<QcGoal> tlist = new ArrayList<>();
// Iterator<QcGoal> it = list.iterator();
// while (it.hasNext()) {
// QcGoal goal = (QcGoal) it.next();
// if (goal.getParentGoal().equals(t.getId())){
// tlist.add(goal);
// }
// }
// return tlist;
// }
//
// @DS("#header.poolName")
// private String getSerialNumber(QcGoal qcGoal) {
// int liushuiNum = qcGoalMapper.getTodayMaxNum(qcGoal);
// String liushuiStr = String.format("%04d", liushuiNum);
// String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
// return dateNumber + liushuiStr;
// }
// @DS("#header.poolName")
// private String getFactoryCode() {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// String key = "#header.poolName";
// return request.getHeader(key.substring(8)).replace("ds_", "");
// }
//
//}

@ -179,7 +179,8 @@
qct.confirm_man_name confirmManName
from qc_check_task qct
left join pro_order_workorder pow on qct.order_no = pow.workorder_code
where check_type = 'checkTypeSCXJ' and qct.del_flag = '0' and pow.del_flag = '0'
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
and pow.del_flag = '0'
and CONVERT(varchar(10),income_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
and pow.status = 'w2' and pow.parent_order = '0'
group by qct.factory_code,

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcGoalDistributeMapper">
<resultMap type="QcGoalDistribute" id="QcGoalDistributeResult">
<result property="id" column="id"/>
<result property="belongGoalId" column="belong_goal_id"/>
<result property="supplierCode" column="supplier_code"/>
<result property="supplierName" column="supplier_name"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="factoryCode" column="factory_code"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectQcGoalDistributeVo">
select id, belong_goal_id, supplier_code, supplier_name, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_goal_distribute
</sql>
<select id="selectQcGoalDistributeList" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
<include refid="selectQcGoalDistributeVo"/>
<where>
<if test="belongGoalId != null and belongGoalId != ''">
and belong_goal_id = #{belongGoalId}
</if>
<if test="supplierCode != null and supplierCode != ''">
and supplier_code = #{supplierCode}
</if>
<if test="supplierName != null and supplierName != ''">
and supplier_name like concat('%', #{supplierName}, '%')
</if>
<if test="attr1 != null and attr1 != ''">
and attr1 = #{attr1}
</if>
<if test="attr2 != null and attr2 != ''">
and attr2 = #{attr2}
</if>
<if test="attr3 != null and attr3 != ''">
and attr3 = #{attr3}
</if>
<if test="attr4 != null and attr4 != ''">
and attr4 = #{attr4}
</if>
<if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode}
</if>
</where>
</select>
<select id="selectQcGoalDistributeById" parameterType="String"
resultMap="QcGoalDistributeResult">
<include refid="selectQcGoalDistributeVo"/>
where id = #{id}
</select>
<insert id="insertQcGoalDistribute" parameterType="QcGoalDistribute">
insert into qc_goal_distribute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,
</if>
<if test="belongGoalId != null">belong_goal_id,
</if>
<if test="supplierCode != null">supplier_code,
</if>
<if test="supplierName != null">supplier_name,
</if>
<if test="attr1 != null">attr1,
</if>
<if test="attr2 != null">attr2,
</if>
<if test="attr3 != null">attr3,
</if>
<if test="attr4 != null">attr4,
</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="factoryCode != null and factoryCode != ''">factory_code,
</if>
<if test="delFlag != null">del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},
</if>
<if test="belongGoalId != null">#{belongGoalId},
</if>
<if test="supplierCode != null">#{supplierCode},
</if>
<if test="supplierName != null">#{supplierName},
</if>
<if test="attr1 != null">#{attr1},
</if>
<if test="attr2 != null">#{attr2},
</if>
<if test="attr3 != null">#{attr3},
</if>
<if test="attr4 != null">#{attr4},
</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="factoryCode != null and factoryCode != ''">#{factoryCode},
</if>
<if test="delFlag != null">#{delFlag},
</if>
</trim>
</insert>
<update id="updateQcGoalDistribute" parameterType="QcGoalDistribute">
update qc_goal_distribute
<trim prefix="SET" suffixOverrides=",">
<if test="belongGoalId != null">belong_goal_id =
#{belongGoalId},
</if>
<if test="supplierCode != null">supplier_code =
#{supplierCode},
</if>
<if test="supplierName != null">supplier_name =
#{supplierName},
</if>
<if test="attr1 != null">attr1 =
#{attr1},
</if>
<if test="attr2 != null">attr2 =
#{attr2},
</if>
<if test="attr3 != null">attr3 =
#{attr3},
</if>
<if test="attr4 != null">attr4 =
#{attr4},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="factoryCode != null and factoryCode != ''">factory_code =
#{factoryCode},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQcGoalDistributeById" parameterType="String">
delete from qc_goal_distribute where id = #{id}
</delete>
<delete id="deleteQcGoalDistributeByIds" parameterType="String">
delete from qc_goal_distribute where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteQcGoalDistributeByBelongId" parameterType="String">
delete from qc_goal_distribute where belong_goal_id = #{belongGoalId}
</delete>
<select id="getGoalDistributeUndo" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
select bs.supplier_code,
concat(bs.zh_desc,'(',bs.supplier_code,')') label,
concat(bs.zh_desc,'(',bs.supplier_code,')') supplierName
from base_supplier bs
where bs.active_flag = '1' and bs.del_flag = '0'
and bs.supplier_code not in (
select gd.supplier_code
from qc_goal_distribute gd
where gd.belong_goal_id =#{belongGoalId}
)
<if test="supplierName != null and supplierName != ''">and bs.zh_desc like concat('%', #{supplierName},
'%')
</if>
</select>
<select id="getGoalDistributeDo" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
select distinct
gd.supplier_code,
concat(bs.zh_desc,'(',bs.supplier_code,')') label
from qc_goal_distribute gd
left join base_supplier bs on gd.supplier_code = bs.supplier_code
where gd.belong_goal_id =#{belongGoalId}
<if test="supplierName != null and supplierName != ''">and bs.zh_desc like concat('%', #{supplierName},
'%')
</if>
</select>
</mapper>

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcGoalMapper">
<resultMap type="QcGoal" id="QcGoalResult">
<result property="id" column="id"/>
<result property="goalYm" column="goal_ym"/>
<result property="goalType" column="goal_type"/>
<result property="nookRate" column="noOk_rate"/>
<result property="nookQualityRate" column="noOk_quality_rate"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="factoryCode" column="factory_code"/>
<result property="delFlag" column="del_flag"/>
<result property="checkType" column="check_type"/>
<result property="typeCode" column="type_code"/>
<result property="scope" column="scope"/>
<result property="parentGoal" column="parent_goal"/>
</resultMap>
<sql id="selectQcGoalVo">
select id, goal_ym, goal_type, noOk_rate, noOk_quality_rate, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag, check_type, type_code, scope, parent_goal from qc_goal
</sql>
<select id="selectQcGoalList" parameterType="QcGoal" resultMap="QcGoalResult">
<include refid="selectQcGoalVo"/>
<where>
<if test="goalYm != null and goalYm != ''">
and goal_ym = #{goalYm}
</if>
<if test="goalType != null and goalType != ''">
and goal_type = #{goalType}
</if>
<if test="nookRate != null ">
and noOk_rate = #{nookRate}
</if>
<if test="nookQualityRate != null ">
and noOk_quality_rate = #{nookQualityRate}
</if>
<if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode}
</if>
<if test="checkType != null and checkType != ''">
and check_type = #{checkType}
</if>
<if test="typeCode != null and typeCode != ''">
and type_code = #{typeCode}
</if>
<if test="scope != null and scope != ''">
and scope = #{scope}
</if>
<if test="parentGoal != null and parentGoal != ''">
and parent_goal = #{parentGoal}
</if>
</where>
order by id desc
</select>
<select id="selectChildrenByParent" parameterType="QcGoal" resultMap="QcGoalResult">
<include refid="selectQcGoalVo"/>
<where>
<if test="goalYm != null and goalYm != ''">
and goal_ym = #{goalYm}
</if>
<if test="goalType != null and goalType != ''">
and goal_type = #{goalType}
</if>
<if test="nookRate != null ">
and noOk_rate = #{nookRate}
</if>
<if test="nookQualityRate != null ">
and noOk_quality_rate = #{nookQualityRate}
</if>
<if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode}
</if>
<if test="checkType != null and checkType != ''">
and check_type = #{checkType}
</if>
<if test="typeCode != null and typeCode != ''">
and type_code = #{typeCode}
</if>
<if test="scope != null and scope != ''">
and scope = #{scope}
</if>
<if test="parentGoal != null and parentGoal != ''">
and parent_goal = #{parentGoal}
</if>
</where>
order by id desc
</select>
<select id="selectQcGoalById" parameterType="String"
resultMap="QcGoalResult">
<include refid="selectQcGoalVo"/>
where id = #{id}
</select>
<insert id="insertQcGoal" parameterType="QcGoal">
insert into qc_goal
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,
</if>
<if test="goalYm != null">goal_ym,
</if>
<if test="goalType != null">goal_type,
</if>
<if test="nookRate != null">noOk_rate,
</if>
<if test="nookQualityRate != null">noOk_quality_rate,
</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="factoryCode != null and factoryCode != ''">factory_code,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="checkType != null">check_type,
</if>
<if test="typeCode != null">type_code,
</if>
<if test="scope != null">scope,
</if>
<if test="parentGoal != null">parent_goal,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},
</if>
<if test="goalYm != null">#{goalYm},
</if>
<if test="goalType != null">#{goalType},
</if>
<if test="nookRate != null">#{nookRate},
</if>
<if test="nookQualityRate != null">#{nookQualityRate},
</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="factoryCode != null and factoryCode != ''">#{factoryCode},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="checkType != null">#{checkType},
</if>
<if test="typeCode != null">#{typeCode},
</if>
<if test="scope != null">#{scope},
</if>
<if test="parentGoal != null">#{parentGoal},
</if>
</trim>
</insert>
<insert id="insertQcGoalList" parameterType="List">
insert into qc_goal(id,goal_ym,goal_type,noOk_rate,noOk_quality_rate,create_by,create_time,
update_by,update_time,factory_code,check_type,type_code,scope,parent_goal)values
<foreach collection="qcGoalList" item="item" index="index" separator=",">
(#{item.id},
#{item.goalYm},
#{item.goalType},
#{item.nookRate},
#{item.nookQualityRate},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.factoryCode},
#{item.checkType},
#{item.typeCode},
#{item.scope},
#{item.parentGoal})
</foreach>
</insert>
<update id="updateQcGoal" parameterType="QcGoal">
update qc_goal
<trim prefix="SET" suffixOverrides=",">
<if test="goalYm != null">goal_ym =
#{goalYm},
</if>
<if test="goalType != null">goal_type =
#{goalType},
</if>
<if test="nookRate != null">noOk_rate =
#{nookRate},
</if>
<if test="nookQualityRate != null">noOk_quality_rate =
#{nookQualityRate},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="factoryCode != null and factoryCode != ''">factory_code =
#{factoryCode},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="checkType != null">check_type =
#{checkType},
</if>
<if test="typeCode != null">type_code =
#{typeCode},
</if>
<if test="scope != null">scope =
#{scope},
</if>
<if test="parentGoal != null">parent_goal =
#{parentGoal},
</if>
</trim>
where id = #{id}
</update>
<select id="getTodayMaxNum" resultType="java.lang.Integer">
select count(0)+1
from qc_goal
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</select>
<delete id="deleteQcGoalById" parameterType="String">
delete from qc_goal where id = #{id}
</delete>
<delete id="deleteQcGoalByIds" parameterType="String">
delete from qc_goal where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -228,7 +228,7 @@ public class SapOrderServiceImpl implements SapOrderService {
// JCoDestination dest = SAPConnUtils.connect();
log.info("订单关闭入参------"+sapCloseOrderQuery.toString());
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZPPR_MES_PRODORD_CLOSE");
JCoFunction func = repository.getFunction("ZMES_AUFNR_CLOSE");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}

Loading…
Cancel
Save