| | |
| | | * @param result 输出参数 |
| | | */ |
| | | void callPdaReceiptBtn(@Param("C_IN_STR") String inStr, @Param("C_RESULT") String result); |
| | | |
| | | //PRC_MES_INV_ITEM_ARN_STATUS22 |
| | | void callPrcMesInvItemArnStatus22(@Param("PI_FACTORY") String factory, |
| | | @Param("PI_COMPANY") String company, |
| | | @Param("P_USERCODE") String userCode, |
| | | @Param("P_ID") Long id, |
| | | @Param("PO_RESULT") Integer poResult, |
| | | @Param("PO_TEXT") String poText); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.gs.xky.entity.MesInvItemArnDetail; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author 28567 |
| | |
| | | */ |
| | | public interface MesInvItemArnDetailMapper extends BaseMapper<MesInvItemArnDetail> { |
| | | |
| | | List<MesInvItemArnDetail> selectListByMid(@Param("mid") String mid); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author 28567 |
| | | * @description 针对表【MES_INV_ITEM_ARN(物料入库主表)】的数据库操作Mapper |
| | |
| | | */ |
| | | public interface MesInvItemArnMapper extends BaseMapper<MesInvItemArn> { |
| | | |
| | | List<MesInvItemArn> selectItemArnMinus(); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.gs.xky.dto.XkyDetail; |
| | | import com.gs.xky.entity.DeliveryNotice; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author 28567 |
| | |
| | | |
| | | |
| | | void callPdaReceiptBtn(String inStr, String result); |
| | | |
| | | Integer processMesInvItemArnStatus(String factory, String company, String userCode, Long id); |
| | | |
| | | void processMesInvItemArnStatusAsync(List<MesInvItemArn> itemArnMinus); |
| | | } |
| | |
| | | import com.gs.xky.dto.XkyDetail; |
| | | import com.gs.xky.entity.DeliveryNotice; |
| | | import com.gs.xky.entity.DeliveryNoticeDetail; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | import com.gs.xky.mapper.DeliveryNoticeMapper; |
| | | import com.gs.xky.service.DeliveryNoticeDetailService; |
| | | import com.gs.xky.service.DeliveryNoticeService; |
| | | import com.gs.xky.service.MesInvItemArnService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | implements DeliveryNoticeService { |
| | | |
| | | private final DeliveryNoticeDetailService detailService; |
| | | |
| | | private final MesInvItemArnService invItemArnService; |
| | | |
| | | |
| | | @Override |
| | |
| | | public void callPdaReceiptBtn(String inStr, String result) { |
| | | baseMapper.callPdaReceiptBtn(inStr, result); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Integer processMesInvItemArnStatus(String factory, String company, String userCode, Long id) { |
| | | Integer poResult = 1; |
| | | String poText = ""; |
| | | |
| | | // 调用存储过程 |
| | | baseMapper.callPrcMesInvItemArnStatus22(factory, company, userCode, id, poResult, poText); |
| | | |
| | | // 返回结果 |
| | | return poResult; |
| | | } |
| | | |
| | | // |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void processMesInvItemArnStatusAsync(List<MesInvItemArn> itemArnMinus) { |
| | | // 遍历每个 itemArn |
| | | itemArnMinus.forEach(itemArn -> { |
| | | try { |
| | | // 处理每个 itemArn |
| | | processMesInvItemArnStatus("1000", "1000", "PL017", itemArn.getId()); |
| | | } catch (Exception e) { |
| | | // 处理异常,例如记录日志 |
| | | System.err.println("Error processing itemArn: " + itemArn.getId()); |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | import com.gs.xky.service.MesInvItemArnService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author 28567 |
| | | * @description 针对表【MES_INV_ITEM_ARN(物料入库主表)】的数据库操作Service实现 |
| | |
| | | public class MesInvItemArnServiceImpl extends ServiceImpl<MesInvItemArnMapper, MesInvItemArn> |
| | | implements MesInvItemArnService { |
| | | |
| | | |
| | | @Override |
| | | public List<MesInvItemArn> getItemArnMinus() { |
| | | return baseMapper.selectItemArnMinus(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author 28567 |
| | | * @description 针对表【MES_INV_ITEM_ARN(物料入库主表)】的数据库操作Service |
| | |
| | | */ |
| | | public interface MesInvItemArnService extends IService<MesInvItemArn> { |
| | | |
| | | List<MesInvItemArn> getItemArnMinus(); |
| | | } |
| | |
| | | import com.gs.xky.config.DingTalkParam; |
| | | import com.gs.xky.config.DingTalkResponse; |
| | | import com.gs.xky.dto.EmployeeInfo; |
| | | import com.gs.xky.service.ApiService; |
| | | import com.gs.xky.service.MesStaffService; |
| | | import com.gs.xky.service.XkyService; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | import com.gs.xky.service.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | private final MesStaffService staffService; |
| | | |
| | | private final DeliveryNoticeService deliveryNoticeService; |
| | | |
| | | private final MesInvItemArnService invItemArnService; |
| | | |
| | | /** |
| | | * 每五分钟执行一次 |
| | | * 获取设备最近的一条记录 |
| | |
| | | xkyService.GetSaveDetail(); |
| | | } |
| | | |
| | | @Scheduled(cron = "10 3,8,13,18,23,28,33,38,43,48,53,58 * * * ?") |
| | | public void compensateMethod() throws IOException { |
| | | // 补偿逻辑 |
| | | List<MesInvItemArn> itemArnMinus = invItemArnService.getItemArnMinus(); |
| | | deliveryNoticeService.processMesInvItemArnStatusAsync(itemArnMinus); |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0/53 * * * ?") |
| | | public void getDinTalkData() throws IOException { |
| | | DingTalkParam dingTalkParam = new DingTalkParam(1); |
| | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driver-class-name: oracle.jdbc.OracleDriver |
| | | url: jdbc:oracle:thin:@122.226.249.238:5936/ORCL |
| | | url: jdbc:oracle:thin:@192.168.1.104:1521/ORCL |
| | | username: zmz_prd |
| | | password: zmzprd |
| | | druid: |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.gs.xky.mapper.DeliveryNoticeMapper"> |
| | | |
| | | |
| | | <select id="getNextVal" resultType="java.lang.Long"> |
| | | SELECT SEQ_XKY.NEXTVAL |
| | | FROM DUAL |
| | |
| | | #{C_RESULT, mode=OUT, jdbcType=VARCHAR} |
| | | )} |
| | | </select> |
| | | |
| | | <select id="callPrcMesInvItemArnStatus22" statementType="CALLABLE" resultType="java.lang.String"> |
| | | {call PRC_MES_INV_ITEM_ARN_STATUS22( |
| | | #{PI_FACTORY, mode=IN, jdbcType=VARCHAR}, |
| | | #{PI_COMPANY, mode=IN, jdbcType=VARCHAR}, |
| | | #{P_USERCODE, mode=IN, jdbcType=VARCHAR}, |
| | | #{P_ID, mode=IN, jdbcType=NUMERIC}, |
| | | #{PO_RESULT, mode=OUT, jdbcType=NUMERIC}, |
| | | #{PO_TEXT, mode=OUT, jdbcType=VARCHAR} |
| | | )} |
| | | </select> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.gs.xky.mapper.MesInvItemArnDetailMapper"> |
| | | |
| | | <select id="selectListByMid" resultType="com.gs.xky.entity.MesInvItemArnDetail"> |
| | | SELECT EBELN, WORK_LINE, ITEM_NO, ITEM_ID, ID |
| | | FROM mes_inv_item_arn_detail |
| | | WHERE MID = #{mid} |
| | | GROUP BY EBELN, WORK_LINE, ITEM_NO, ITEM_ID, ID |
| | | </select> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.gs.xky.mapper.MesInvItemArnMapper"> |
| | | |
| | | <select id="selectItemArnMinus" resultType="com.gs.xky.entity.MesInvItemArn"> |
| | | select * |
| | | from mes_inv_item_arn |
| | | where BILL_NO in (select BILL_NO |
| | | from (select b.BILL_NO |
| | | from mes_inv_item_arn_detail a |
| | | left join mes_inv_item_arn b on a.mid = b.id |
| | | where a.check_states = '待检') |
| | | minus |
| | | select LOT_NO |
| | | from MES_QA_ITEMS_DETECT_01) |
| | | and FSTATUS = 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.gs.xky; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.gs.xky.config.ApiResponse; |
| | | import com.gs.xky.config.BodyParam; |
| | | import com.gs.xky.config.DataAcquisitionConfiguration; |
| | | import com.gs.xky.config.XkyCommonParam; |
| | | import com.gs.xky.dto.BarcodeDeliveryNo; |
| | | import com.gs.xky.dto.LineList; |
| | | import com.gs.xky.dto.XkyDetail; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | import com.gs.xky.service.*; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest |
| | | class XkyApplicationTests { |
| | |
| | | @Autowired |
| | | private TblBarcodeInformationService barcodeInformationService; |
| | | |
| | | @Autowired |
| | | private MesInvItemArnService invItemArnService; |
| | | |
| | | @Test |
| | | void contextLoads() throws IOException { |
| | | |
| | | // xkyService.GetSaveDetail(); |
| | | List<MesInvItemArn> itemArnMinus = invItemArnService.getItemArnMinus(); |
| | | |
| | | deliveryNoticeService.processMesInvItemArnStatusAsync(itemArnMinus); |
| | | |
| | | } |
| | | |
| | | @Test |
| | |
| | | BodyParam bodyParam = new BodyParam(); |
| | | |
| | | bodyParam.setErpCode(DataAcquisitionConfiguration.TEST_ERP_CODE); |
| | | bodyParam.setDeliveryNo("222504146397"); |
| | | bodyParam.setDeliveryNo("222504279H65"); |
| | | bodyParam.setStatus(new int[]{1, 6}); |
| | | |
| | | param.setBody(bodyParam); |
| | |
| | | ApiResponse<XkyDetail> detail = apiService.sendListRequest(param, XkyDetail.class, "https://openapi.xiekeyun.com/delivery/getDetail.json"); |
| | | |
| | | XkyDetail deliveryNo = detail.getData(); |
| | | List<LineList> collect = deliveryNo.getLineList().stream().filter(s -> "1".equals(s.getStatus())).collect(Collectors.toList()); |
| | | System.out.println(JSON.toJSONString(collect)); |
| | | // deliveryNoticeService.saveDeliveryNotice(deliveryNo); |
| | | // List<BarcodeDeliveryNo> barcodeDeliveryNos = GetBarcodeInformation(deliveryNo.getDeliveryNo()); |
| | | // barcodeInformationService.SaveBarcodeInformation(barcodeDeliveryNos, deliveryNo.getDeliveryNo()); |
| | | // |
| | | // deliveryNoticeService.callPdaReceiptBtn("送货单签收[BTNOK[PL017[" + deliveryNo.getDeliveryNo(), ""); |
| | | // List<LineList> collect = deliveryNo.getLineList().stream().filter(s -> "1".equals(s.getStatus())).collect(Collectors.toList()); |
| | | // System.out.println(JSON.toJSONString(collect)); |
| | | deliveryNoticeService.saveDeliveryNotice(deliveryNo); |
| | | List<BarcodeDeliveryNo> barcodeDeliveryNos = GetBarcodeInformation(deliveryNo.getDeliveryNo()); |
| | | barcodeInformationService.SaveBarcodeInformation(barcodeDeliveryNos, deliveryNo.getDeliveryNo()); |
| | | |
| | | deliveryNoticeService.callPdaReceiptBtn("送货单签收[BTNOK[PL017[" + deliveryNo.getDeliveryNo(), ""); |
| | | } |
| | | |
| | | private List<BarcodeDeliveryNo> GetBarcodeInformation(String deliveryNo) throws IOException { |