master
Yangwl 1 year ago
parent ed23db844a
commit bd8870982d

@ -6,6 +6,7 @@ import com.op.system.api.factory.RemoteOpenFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map; import java.util.Map;
@ -16,8 +17,12 @@ import java.util.Map;
*/ */
@FeignClient(contextId = "remoteOpenService", value = ServiceNameConstants.OPEN_SERVICE, fallbackFactory = RemoteOpenFallbackFactory.class) @FeignClient(contextId = "remoteOpenService", value = ServiceNameConstants.OPEN_SERVICE, fallbackFactory = RemoteOpenFallbackFactory.class)
public interface RemoteOpenService { public interface RemoteOpenService {
/**提交ZL0010-来料检验不合格控制流程**/ /**提交流程**/
@PostMapping("/openInterface/OAInspection") @PostMapping("/openInterface/OAInspection")
public AjaxResult OAInspection(@RequestBody(required = false) Map<String, Object> paramMap); public AjaxResult OAInspection(@RequestBody(required = false) Map<String, Object> paramMap);
/**获取流程信息**/
@PostMapping("/openInterface/GetOaNodeInfo")
public AjaxResult GetOaNodeInfo(@RequestParam String requestId);
} }

@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map; import java.util.Map;
@ -20,7 +21,12 @@ public class RemoteOpenFallbackFactory implements FallbackFactory<RemoteOpenServ
return new RemoteOpenService() { return new RemoteOpenService() {
@Override @Override
public AjaxResult OAInspection(@RequestBody(required = false) Map<String, Object> paramMap) { public AjaxResult OAInspection(@RequestBody(required = false) Map<String, Object> paramMap) {
return AjaxResult.error("提交ZL0010-来料检验不合格控制流程失败"+throwable.getMessage()); return AjaxResult.error("提交流程失败"+throwable.getMessage());
}
@Override
public AjaxResult GetOaNodeInfo(@RequestParam String requestId) {
return AjaxResult.error("获取流程失败"+throwable.getMessage());
} }
}; };
} }

@ -148,9 +148,11 @@ public class Constants {
//领料 //领料
public static final Integer LL=261; public static final Integer LL=261;
//来料检验不合格控制流程workflowId //ZL0010-来料检验不合格控制流程
public static final Integer WORKFLOWID=26235; public static final Integer WORKFLOWID_ZL0010=26235;
//ZL0020-成品检验控制流程
public static final Integer WORKFLOWID_ZL0020=26234;
//过程检验不合格控制流程workflowId
} }

@ -87,7 +87,7 @@ public class MesReportWorkController extends BaseController {
// String dateEndStr = dtf.format(dateEnd)+" 00:00:00"; // String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
// mesReportWork.setCreateTimeEnd(dateEndStr);//end // mesReportWork.setCreateTimeEnd(dateEndStr);//end
// } // }
List<MesReportWork> list = mesReportWorkService.selectMesReportWorkList(mesReportWork); List<MesReportWork> list = mesReportWorkService.selectMesReportWorkList_S(mesReportWork);
ExcelUtil<MesReportWork> util = new ExcelUtil<MesReportWork>(MesReportWork.class); ExcelUtil<MesReportWork> util = new ExcelUtil<MesReportWork>(MesReportWork.class);
util.exportExcel(response, list, "报工报表数据"); util.exportExcel(response, list, "报工报表数据");
} }

@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.op.common.security.utils.SecurityUtils;
import com.op.mes.domain.MesUnitPrice; import com.op.mes.domain.MesUnitPrice;
import com.op.mes.service.IMesUnitPriceService; import com.op.mes.service.IMesUnitPriceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,6 +24,7 @@ import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo; import com.op.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* unitPriceController * unitPriceController
@ -58,12 +60,25 @@ public class MesUnitPriceController extends BaseController {
ExcelUtil<MesUnitPrice> util = new ExcelUtil<MesUnitPrice>(MesUnitPrice.class); ExcelUtil<MesUnitPrice> util = new ExcelUtil<MesUnitPrice>(MesUnitPrice.class);
util.exportExcel(response, list, "unitPrice数据"); util.exportExcel(response, list, "unitPrice数据");
} }
@Log(title = "计件薪资管理", businessType = BusinessType.IMPORT)
@RequiresPermissions("system:unitPrice:import")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<MesUnitPrice> util = new ExcelUtil<MesUnitPrice>(MesUnitPrice.class);
List<MesUnitPrice> UnitPriceList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
String message = mesUnitPriceService.importMesUnitPrice(UnitPriceList, updateSupport, operName);
return success(message);
}
@PostMapping("/importTemplate") @PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException { public void importTemplate(HttpServletResponse response) throws IOException {
ExcelUtil<MesUnitPrice> util = new ExcelUtil<MesUnitPrice>(MesUnitPrice.class); ExcelUtil<MesUnitPrice> util = new ExcelUtil<MesUnitPrice>(MesUnitPrice.class);
util.importTemplateExcel(response, "产品单价导入模板"); util.importTemplateExcel(response, "产品单价导入模板");
} }
/** /**
* unitPrice * unitPrice
*/ */

@ -21,19 +21,18 @@ public class MesReportWork extends BaseEntity {
/** 记录id */ /** 记录id */
private String id; private String id;
/** 线体名称 */
/** 报工单编号 */ @Excel(name = "线体名称")
@Excel(name = "报工单编号") private String machineName;
private String reportCode;
/** 报工类型报工类型SELF自行报工、UNI统一报工 */
@Excel(name = "报工类型报工类型SELF上位机报工、UNI系统报工")
private String reportType;
/** 生产工单编码 */ /** 生产工单编码 */
@Excel(name = "生产工单编码") @Excel(name = "生产工单编码")
private String workorderCode; private String workorderCode;
/** SAP订单号 */
@Excel(name = "SAP订单号")
private String workorderCodeSap;
/** 产品编码 */ /** 产品编码 */
@Excel(name = "产品编码") @Excel(name = "产品编码")
private String productCode; private String productCode;
@ -42,22 +41,73 @@ public class MesReportWork extends BaseEntity {
@Excel(name = "产品名称") @Excel(name = "产品名称")
private String productName; private String productName;
/** 规格型号 */ /** 批次号 */
@Excel(name = "规格型号") @Excel(name = "批次号")
private String spec; private String batch;
/** 单位 */ /** 单位 */
@Excel(name = "单位") @Excel(name = "单位")
private String unit; private String unit;
/** 排产数量 */
@Excel(name = "排产数量")
private BigDecimal quantity;
private BigDecimal quantitySplit;
/** 本次报工数量 */ /** 本次报工数量 */
@Excel(name = "本次报工数量") @Excel(name = "本次报工数量")
private BigDecimal quantityFeedback; private BigDecimal quantityFeedback;
/** 工时 */
@Excel(name = "工时")
private Long workTime;
@Excel(name = "用人")
private Long useMan;
/** 报工人员 */
@Excel(name = "报工人员")
private String nickName;
/** 报工时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "报工时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date feedbackTime;
/** 耗用物料编码 */
@Excel(name = "耗用物料编码")
private String materialCode;
/** 耗用物料名称 */
@Excel(name = "耗用物料名称")
private String materialName;
/** 物料消耗数量 */
@Excel(name = "物料消耗数量")
private BigDecimal quantity;
/** 物料消耗数量 */
@Excel(name = "物料消耗单位")
private String materialNameUnit;
/** 报工单编号 */
// @Excel(name = "报工单编号")
private String reportCode;
/** 报工类型报工类型SELF自行报工、UNI统一报工 */
//@Excel(name = "报工类型报工类型SELF上位机报工、UNI系统报工")
private String reportType;
/** 规格型号 */
//@Excel(name = "规格型号")
private String spec;
private BigDecimal quantitySplit;
/** 合格数量 */ /** 合格数量 */
//@Excel(name = "合格数量") //@Excel(name = "合格数量")
private BigDecimal quantityQualified; private BigDecimal quantityQualified;
@ -67,60 +117,50 @@ public class MesReportWork extends BaseEntity {
private BigDecimal quantityUnqualified; private BigDecimal quantityUnqualified;
/** 报工人员 */ /** 报工人员 */
@Excel(name = "报工人员") //@Excel(name = "报工人员")
private String userName; private String userName;
/** 人员名称 */
@Excel(name = "人员名称")
private String nickName;
/** 报工途径PAD、MOBILE、PC */ /** 报工途径PAD、MOBILE、PC */
//@Excel(name = "报工途径PAD、MOBILE、PC") //@Excel(name = "报工途径PAD、MOBILE、PC")
private String feedbackChannel; private String feedbackChannel;
/** 报工时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "报工时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date feedbackTime;
private String feedbackTimeStr; private String feedbackTimeStr;
/** 录入人员 */ /** 录入人员 */
@Excel(name = "录入人员") //@Excel(name = "录入人员")
private String recordUser; private String recordUser;
/** 状态 */ /** 状态 */
@Excel(name = "状态") //@Excel(name = "状态")
private String status; private String status;
/** 工时 */
@Excel(name = "工时")
private Long workTime;
@Excel(name = "用人")
private Long useMan;
/** 线体编码 */ /** 线体编码 */
@Excel(name = "线体编码") //@Excel(name = "线体编码")
private String machineCode; private String machineCode;
/** 线体名称 */
@Excel(name = "线体名称")
private String machineName;
/** 班组编码 */ /** 班组编码 */
@Excel(name = "班组编码") //@Excel(name = "班组编码")
private String teamCode; private String teamCode;
/** 班次编码 */ /** 班次编码 */
@Excel(name = "班次编码") //@Excel(name = "班次编码")
private String shiftCode; private String shiftCode;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "SAP报工时间") //@Excel(name = "SAP报工时间")
private Date uploadTime; private Date uploadTime;
@Excel(name = "SAP报工状态0待报工1成功2失败") //@Excel(name = "SAP报工状态0待报工1成功2失败")
private String uploadStatus; private String uploadStatus;
@Excel(name = "SAP报工信息") //@Excel(name = "SAP报工信息")
private String uploadMsg; private String uploadMsg;
/** 预留字段1 */ /** 预留字段1 */
//@Excel(name = "预留字段1") //@Excel(name = "预留字段1")
@ -137,23 +177,23 @@ public class MesReportWork extends BaseEntity {
/** 预留字段4 */ /** 预留字段4 */
//@Excel(name = "预留字段4") //@Excel(name = "预留字段4")
private String attr4; private String attr4;
@Excel(name = "计划生产日期") //@Excel(name = "计划生产日期")
private String productDate; private String productDate;
private String productDateStart; private String productDateStart;
private String productDateEnd; private String productDateEnd;
@Excel(name = "订单编号") //@Excel(name = "订单编号")
private String orderCode; private String orderCode;
@Excel(name = "规格型号") //@Excel(name = "规格型号")
private String productSpc; private String productSpc;
@Excel(name = "工序名称") //@Excel(name = "工序名称")
private String processName; private String processName;
@Excel(name = "工序编码") //@Excel(name = "工序编码")
private String processCode; private String processCode;
private String factoryCode; private String factoryCode;
private String factoryName; private String factoryName;
private String carCode; private String carCode;
private String carName; private String carName;
private String workorderCodeSap;
private String routeCode; private String routeCode;
private String sac1; private String sac1;
private String sac2; private String sac2;
@ -166,7 +206,7 @@ public class MesReportWork extends BaseEntity {
private String createTimeEnd; private String createTimeEnd;
private String feedbackTimeStart; private String feedbackTimeStart;
private String feedbackTimeEnd; private String feedbackTimeEnd;
private String batch;
private String endReport; private String endReport;
private String parentOrder; private String parentOrder;
private String workorderCodes; private String workorderCodes;
@ -180,8 +220,33 @@ public class MesReportWork extends BaseEntity {
private Long workTimes; private Long workTimes;
private String workCenter; private String workCenter;
private String shiftId; private String shiftId;
private List<MesReportWorkConsume> consumesInfos; private List<MesReportWorkConsume> consumesInfos;
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialNameUnit() {
return materialNameUnit;
}
public void setMaterialNameUnit(String materialNameUnit) {
this.materialNameUnit = materialNameUnit;
}
public String getShiftId() { public String getShiftId() {
return shiftId; return shiftId;
} }

@ -125,4 +125,6 @@ public interface MesReportWorkMapper {
public MesReportWork getReportWorkHz(MesReportWork mesReportWork); public MesReportWork getReportWorkHz(MesReportWork mesReportWork);
MesReportWork getEndReport(MesReportWork pWork); MesReportWork getEndReport(MesReportWork pWork);
List<MesReportWork> selectMesReportWorkList_S(MesReportWork mesReportWork);
} }

@ -98,4 +98,6 @@ public interface IMesReportWorkService {
int submitReportPS(List<MesReportWork> mesReportWorks); int submitReportPS(List<MesReportWork> mesReportWorks);
List<MesPrepareDetail> getPrepareList(MesPrepareDetail mesPrepareDetail); List<MesPrepareDetail> getPrepareList(MesPrepareDetail mesPrepareDetail);
List<MesReportWork> selectMesReportWorkList_S(MesReportWork mesReportWork);
} }

@ -59,4 +59,7 @@ public interface IMesUnitPriceService {
* @return * @return
*/ */
public int deleteMesUnitPriceByPicId(String picId); public int deleteMesUnitPriceByPicId(String picId);
public String importMesUnitPrice(List<MesUnitPrice> UnitPriceList, Boolean updateSupport,String operName);
} }

@ -169,6 +169,13 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
return mesReportWorkMapper.getPrepareList(mesPrepareDetail); return mesReportWorkMapper.getPrepareList(mesPrepareDetail);
} }
@Override
@DS("#header.poolName")
public List<MesReportWork> selectMesReportWorkList_S(MesReportWork mesReportWork) {
List<MesReportWork> dtos = mesReportWorkMapper.selectMesReportWorkList_S(mesReportWork);
return dtos;
}
/** /**
* *
* *

@ -3,10 +3,15 @@ package com.op.mes.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.DateUtils; 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.mes.domain.MesUnitPrice; import com.op.mes.domain.MesUnitPrice;
import com.op.mes.mapper.MesUnitPriceMapper; import com.op.mes.mapper.MesUnitPriceMapper;
import com.op.mes.service.IMesUnitPriceService; import com.op.mes.service.IMesUnitPriceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -19,9 +24,13 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class MesUnitPriceServiceImpl implements IMesUnitPriceService { public class MesUnitPriceServiceImpl implements IMesUnitPriceService {
private static final Logger log = LoggerFactory.getLogger(IMesUnitPriceService.class);
@Autowired @Autowired
private MesUnitPriceMapper mesUnitPriceMapper; private MesUnitPriceMapper mesUnitPriceMapper;
/** /**
* unitPrice * unitPrice
* *
@ -90,4 +99,38 @@ public class MesUnitPriceServiceImpl implements IMesUnitPriceService {
public int deleteMesUnitPriceByPicId(String picId) { public int deleteMesUnitPriceByPicId(String picId) {
return mesUnitPriceMapper.deleteMesUnitPriceByPicId(picId); return mesUnitPriceMapper.deleteMesUnitPriceByPicId(picId);
} }
@Override
@DS("#header.poolName")
public String importMesUnitPrice(List<MesUnitPrice> UnitPriceList, Boolean updateSupport, String operName) {
if (StringUtils.isNull(UnitPriceList) || UnitPriceList.size() == 0) {
throw new ServiceException("导入数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (MesUnitPrice mesUnitPrice : UnitPriceList) {
try {
// 验证是否存在这个产线产品
mesUnitPrice.setPicId(IdUtils.simpleUUID());
mesUnitPriceMapper.insertMesUnitPrice(mesUnitPrice);
successNum++;
successMsg.append("导入成功");
} catch (Exception e) {
failureNum++;
String msg = "导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
} }

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="reportType" column="report_type" /> <result property="reportType" column="report_type" />
<result property="reportCode" column="report_code" /> <result property="reportCode" column="report_code" />
<result property="workorderCode" column="workorder_code" /> <result property="workorderCode" column="workorder_code" />
<result property="workorderCodeSap" column="workorder_code_sap" />
<result property="productCode" column="product_code" /> <result property="productCode" column="product_code" />
<result property="productName" column="product_name" /> <result property="productName" column="product_name" />
<result property="spec" column="spec" /> <result property="spec" column="spec" />
@ -43,6 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="uploadMsg" column="upload_msg" /> <result property="uploadMsg" column="upload_msg" />
<result property="orderCode" column="order_code" /> <result property="orderCode" column="order_code" />
<result property="batch" column="batch" /> <result property="batch" column="batch" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialNameUnit" column="material_name_unit" />
</resultMap> </resultMap>
<resultMap type="com.op.system.api.domain.mes.ProOrderWorkorderDTO" id="ProOrderWorkorderDTOResult"> <resultMap type="com.op.system.api.domain.mes.ProOrderWorkorderDTO" id="ProOrderWorkorderDTOResult">
<result property="workorderId" column="workorder_id" /> <result property="workorderId" column="workorder_id" />
@ -586,6 +592,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from mes_report_work from mes_report_work
where end_report = '1' and workorder_code = #{workorderCode} where end_report = '1' and workorder_code = #{workorderCode}
</select> </select>
<select id="selectMesReportWorkList_S" parameterType="MesReportWork" resultMap="MesReportWorkResult">
SELECT
mrw.machine_name,
mrw.workorder_code,
pow.workorder_code_sap,
mrw.product_code,
mrw.product_name,
mrw.batch,
mrw.spec,
mrw.unit,
mrw.quantity_feedback,
mrw.work_time,
mrw.use_man,
mrw.nick_name,
mrw.feedback_time,
mrw.record_user,
mrwc.material_code,
mrwc.material_name,
mrwc.quantity,
mrwc.unit as material_name_unit
FROM
mes_report_work mrw
LEFT JOIN pro_order_workorder pow ON mrw.workorder_code = pow.workorder_code
LEFT JOIN mes_report_work_consume mrwc ON mrw.workorder_code=mrwc.workorder_code
<where>
and mrw.del_flag = '0' and pow.del_flag = '0'
<if test="reportCode != null and reportCode != ''"> and mrw.report_code like concat('%', #{reportCode}, '%')</if>
<if test="workorderCode != null and workorderCode != ''"> and mrw.workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="productCode != null and productCode != ''"> and mrw.product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and mrw.product_name like concat('%', #{productName}, '%')</if>
<if test="userName != null and userName != ''"> and mrw.user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and mrw.nick_name like concat('%', #{nickName}, '%')</if>
<if test="feedbackTime != null "> and mrw.feedback_time = #{feedbackTime}</if>
<if test="machineCode != null and machineCode != ''"> and mrw.machine_code = #{machineCode}</if>
<if test="machineName != null and machineName != ''"> and mrw.machine_name like concat('%', #{machineName}, '%')</if>
<if test="teamCode != null and teamCode != ''"> and mrw.team_code = #{teamCode}</if>
<if test="shiftCode != null and shiftCode != ''"> and mrw.shift_code = #{shiftCode}</if>
<if test="createTimeStart != null "> and CONVERT(varchar(30),mrw.create_time, 120) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} > CONVERT(varchar(30),mrw.create_time, 120)</if>
<if test="feedbackTimeStart != null "> and CONVERT(varchar(10),mrw.feedback_time, 120) >= #{feedbackTimeStart}</if>
<if test="feedbackTimeEnd != null "> and #{feedbackTimeEnd} >= CONVERT(varchar(10),mrw.feedback_time, 120)</if>
<if test="orderCode != null and orderCode != ''"> and pow.order_code like concat('%', #{orderCode}, '%')</if>
<if test="uploadStatus != null and uploadStatus != ''"> and mrw.upload_status = #{uploadStatus}</if>
</where>
ORDER BY
mrw.create_time DESC
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork"> <insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work insert into mes_report_work

@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMesUnitPriceList" parameterType="MesUnitPrice" resultMap="MesUnitPriceResult"> <select id="selectMesUnitPriceList" parameterType="MesUnitPrice" resultMap="MesUnitPriceResult">
<include refid="selectMesUnitPriceVo"/> <include refid="selectMesUnitPriceVo"/>
<where> <where>
<if test="factoryId != null "> and factory_id = #{factoryId}</if> <if test="factoryId != null "> and factory_id = #{factoryId}</if>
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if> <if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if>
@ -44,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr3 != null "> and attr3 = #{attr3}</if> <if test="attr3 != null "> and attr3 = #{attr3}</if>
<if test="attr4 != null "> and attr4 = #{attr4}</if> <if test="attr4 != null "> and attr4 = #{attr4}</if>
</where> </where>
ORDER BY childprocess_code ASC
</select> </select>
<select id="selectMesUnitPriceByPicId" parameterType="String" resultMap="MesUnitPriceResult"> <select id="selectMesUnitPriceByPicId" parameterType="String" resultMap="MesUnitPriceResult">

@ -11,10 +11,7 @@ import com.op.system.api.domain.mes.MesReportWorkDTO;
import com.op.system.api.domain.quality.QcCheckTaskDTO; import com.op.system.api.domain.quality.QcCheckTaskDTO;
import com.op.system.api.domain.quality.QcCheckTaskProduceDTO; import com.op.system.api.domain.quality.QcCheckTaskProduceDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -118,12 +115,25 @@ public class OpenController extends BaseController {
/** /**
* ZL0010- * ZL0010- :"workflowId": 26235
*
* CQ OEMCM LLLB 01MATNR MAKTX suppliernum * CQ OEMCM LLLB 01MATNR MAKTX suppliernum
* supplier CHARG comeQty testDate JYBH * supplier CHARG comeQty testDate JYBH
* BJY OEMWLLY ZCF ZCOEMCM OEM * BJY OEMWLLY ZCF ZCOEMCM OEM
* memo PZGLBZG QC * memo PZGLBZG QC
* "workflowId": 26235 *
* -------------------------------------------------------------
* ZL0020-:"workflowId": 26234
*
* ---------------
* PGBCJ /SSCJ /ZRPSN/GJZ/SCLX/OEM OEM/DH /DW/MEMO01 /
* MEMO03 /SFXZG QC/PGZG QC
* PGZRJL
* -------------
* {"colNames":"PROCODE,PRONAME,SCCODE......","details":[{"PROCODE":"","PRONAME":"",.....},{},{},.....]}
* PROCODE PRONAME SCCODE SCTOTAL
* BJDATE JYCODE JYDATE JYRESULT0 2
* PROCODEBAK BZ CPCYS PCJYBHGMS
* @param paramMap * @param paramMap
* @return * @return
*/ */
@ -134,14 +144,13 @@ public class OpenController extends BaseController {
} }
/** /**
* ZL0020- *
* * @param requestId
* @param paramMap
* @return * @return
*/ */
@PostMapping("/OAProcessInspection") @GetMapping("/GetOaNodeInfo")
public AjaxResult OAProcessInspection(@RequestBody(required = false) Map<String, Object> paramMap) { public AjaxResult GetOaNodeInfo(@RequestParam String requestId) {
return openService.OAProcessInspection(paramMap); return openService.GetOaNodeInfo(requestId);
} }

@ -31,5 +31,5 @@ public interface OpenService {
AjaxResult OAInspection(Map<String, Object> paramMap); AjaxResult OAInspection(Map<String, Object> paramMap);
AjaxResult OAProcessInspection(Map<String, Object> paramMap); AjaxResult GetOaNodeInfo(String requestId);
} }

@ -31,6 +31,7 @@ import com.op.system.api.domain.quality.*;
import com.op.system.api.domain.sap.SapCloseOrderQuery; import com.op.system.api.domain.sap.SapCloseOrderQuery;
import com.op.system.api.domain.sap.SapRFW; import com.op.system.api.domain.sap.SapRFW;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -41,8 +42,15 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
@ -64,13 +72,17 @@ public class OpenServiceImpl implements OpenService {
@Value("${OA.url}") @Value("${OA.url}")
private String oa_url; private String oa_url;
@Value("${OA.getnodeInfo}")
private String getnodeInfo;
@Autowired @Autowired
private OpenMapper openMapper; private OpenMapper openMapper;
// @Autowired // @Autowired
// private RemoteSapService remoteSapService; // private RemoteSapService remoteSapService;
/** /**
*
* JSON * JSON
* { * {
* "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID
@ -78,7 +90,7 @@ public class OpenServiceImpl implements OpenService {
* "rfidNo": "r12345" //rfid编号 * "rfidNo": "r12345" //rfid编号
* "factory" * "factory"
* } * }
* * <p>
* JSON * JSON
* { * {
* "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID
@ -103,6 +115,7 @@ public class OpenServiceImpl implements OpenService {
* } * }
* ], * ],
* } * }
*
* @param wcsdto * @param wcsdto
* @return * @return
*/ */
@ -377,10 +390,26 @@ public class OpenServiceImpl implements OpenService {
@Override @Override
public AjaxResult OAInspection(Map<String, Object> paramMap) { public AjaxResult OAInspection(Map<String, Object> paramMap) {
try { try {
// 从paramMap中提取需要的参数
String user = paramMap.get("user").toString();
String requestLevel = paramMap.get("requestLevel").toString();
String requestName = paramMap.get("requestName").toString();
String workflowId = paramMap.get("workflowId").toString();
String mainObject = paramMap.get("mainObject").toString();
String result = HttpUtils.sendPostOA(oa_url, convertJsonToUrlParams(JSONObject.toJSONString(paramMap))); // Building the postData string using StringBuilder
StringBuilder postDataBuilder = new StringBuilder();
postDataBuilder.append("user=").append(user)
.append("&requestLevel=").append(requestLevel)
.append("&requestName=").append(URLEncoder.encode(requestName, StandardCharsets.UTF_8.toString()))
.append("&workflowId=").append(workflowId)
.append("&mainObject=").append(URLEncoder.encode(mainObject, StandardCharsets.UTF_8.toString()));
if (Constants.WORKFLOWID_ZL0020.equals(workflowId)) {
postDataBuilder.append("&details=").append(URLEncoder.encode(mainObject, StandardCharsets.UTF_8.toString()));
}
String postData = postDataBuilder.toString();
String result = HttpUtils.sendPostOA(oa_url, postData);
System.out.println(result); System.out.println(result);
//返回示例{"result":"0","info":"成功","requestid":"2193799"} //返回示例{"result":"0","info":"成功","requestid":"2193799"}
Map resultMap=JSONObject.parseObject(result); Map resultMap=JSONObject.parseObject(result);
@ -389,62 +418,25 @@ public class OpenServiceImpl implements OpenService {
}else { }else {
return error(resultMap.get("info").toString()); return error(resultMap.get("info").toString());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return error(e.getMessage()); return error(e.getMessage());
} }
} }
@Override @Override
public AjaxResult OAProcessInspection(Map<String, Object> paramMap) { public AjaxResult GetOaNodeInfo(String requestId) {
try {
String result = HttpUtils.sendPostOA(oa_url, convertJsonToUrlParams(JSONObject.toJSONString(paramMap)));
System.out.println(result);
//返回示例{"result":"0","info":"成功","requestid":"2193799"}
Map resultMap=JSONObject.parseObject(result);
if (resultMap.get("result").equals(Constants.LOGIN_SUCCESS_STATUS)){
return success(resultMap.get("info").toString(),resultMap.get("requestid").toString());
}else {
return error(resultMap.get("info").toString());
}
try {
String result = HttpUtils.sendGet(getnodeInfo,"requestId="+requestId);
return success(result);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return error(e.getMessage()); return error(e.getMessage());
} }
} }
public static String convertJsonToUrlParams(String json) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(json);
StringBuilder urlParams = new StringBuilder();
Iterator<String> fieldNames = jsonNode.fieldNames();
while (fieldNames.hasNext()) {
String fieldName = fieldNames.next();
JsonNode fieldValue = jsonNode.get(fieldName);
if (urlParams.length() > 0) {
urlParams.append("&");
}
urlParams.append(fieldName).append("=").append(fieldValue);
}
return urlParams.toString();
}
public static void main(String args[]){
Map<String, Object> paramMap =new HashMap<>();
paramMap.put("A","B");
paramMap.put("C","D");
paramMap.put("E","F");
System.out.println(JSONObject.toJSONString(paramMap));
// DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// LocalDate today = LocalDate.now();
// LocalDate lastMonth3 = today.plus(-3, ChronoUnit.MONTHS);
//
// System.out.println("7天之前的日期为:"+lastMonth3.getYear());
}
} }

@ -318,28 +318,8 @@ public class SapItemSyncImpl implements SapItemSyncService {
throw new RuntimeException("Function does not exist in SAP"); throw new RuntimeException("Function does not exist in SAP");
} }
JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM"); JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM");
// System.out.println(L_ITEM);
//
// int successNum = 0;
// int failureNum = 0;
// StringBuilder successMsg = new StringBuilder();
// StringBuilder failureMsg = new StringBuilder();
log.info("反冲物料开始过账----------------------------------------"); log.info("反冲物料开始过账----------------------------------------");
// for (int i = 0; i < sapBackflushMPQueryList.size(); i++) {
// L_ITEM.setRow(i);
// L_ITEM.appendRow();
// L_ITEM.setValue("MATNR",sfp.getMatnr());
// }
for (SapBackflushMPQuery sfp:sapBackflushMPQueryList){ for (SapBackflushMPQuery sfp:sapBackflushMPQueryList){
// if (StringUtils.isEmpty(sfp.getMatnr())){
// return R.fail("物料号为空!");
// }
// if (StringUtils.isEmpty(sfp.getPlant())){
//
// }
L_ITEM.appendRow(); L_ITEM.appendRow();
L_ITEM.setValue("MATNR",sfp.getMatnr()); L_ITEM.setValue("MATNR",sfp.getMatnr());
L_ITEM.setValue("PLANT",sfp.getPlant()); L_ITEM.setValue("PLANT",sfp.getPlant());
@ -350,7 +330,6 @@ public class SapItemSyncImpl implements SapItemSyncService {
L_ITEM.setValue("MEINS",sfp.getMeins()); L_ITEM.setValue("MEINS",sfp.getMeins());
L_ITEM.setValue("BATCH",sfp.getBatch()); L_ITEM.setValue("BATCH",sfp.getBatch());
L_ITEM.setValue("MOVE_BATCH",sfp.getMove_batch()); L_ITEM.setValue("MOVE_BATCH",sfp.getMove_batch());
} }
func.execute(dest); func.execute(dest);
JCoTable maraTable = func.getTableParameterList().getTable("LT_RETURN"); JCoTable maraTable = func.getTableParameterList().getTable("LT_RETURN");

Loading…
Cancel
Save