| | |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | List<LocDetl> locDetls = locDetlService.queryStockAll(null, exist,orderDetl.getMatnr(), orderDetl.getBatch(), |
| | | orderDetl.getBrand(),orderDetl.getStandby1(),orderDetl.getStandby2(),orderDetl.getStandby3(),orderDetl.getBoxType1(),orderDetl.getBoxType2(),orderDetl.getBoxType3()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | List<LocDetl> locDetls = locDetlService.queryStockAll(null, exist,orderDetl.getMatnr(), orderDetl.getBatch(), |
| | | orderDetl.getBrand(),orderDetl.getStandby1(),orderDetl.getStandby2(),orderDetl.getStandby3(),orderDetl.getBoxType1(),orderDetl.getBoxType2(),orderDetl.getBoxType3()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | |
| | | // ------------------------------------------------- |
| | | |
| | | List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | List<LocDetl> queryStockAll(@Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos, @Param("matnr")String matnr, @Param("batch")String batch, |
| | | @Param("brand")String brand,@Param("standby1")String standby1,@Param("standby2")String standby2, |
| | | @Param("standby3")String standby3,@Param("boxType1")String boxType1,@Param("boxType2")String boxType2,@Param("boxType3")String boxType3); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | |
| | | |
| | | List<Order> selectComplete(); |
| | | List<Order> selectComplete1(); |
| | | List<Order> selectComplete99(); |
| | | List<Order> selectComplete8(); |
| | | |
| | | int addToLogTable(Order order); |
| | |
| | | |
| | | List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | |
| | | List<LocDetl> queryStockAll(String orderNo, Set<String> locNos,String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | | List<StockVo> queryStockTotal(); |
| | |
| | | |
| | | List<Order> selectComplete(); |
| | | List<Order> selectComplete1(); |
| | | List<Order> selectComplete99(); |
| | | List<Order> selectComplete8(); |
| | | |
| | | boolean addToLogTable(Order order); |
| | |
| | | return this.baseMapper.queryStock(matnr, batch, orderNo, locNos); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<LocDetl> queryStockAll(String orderNo, Set<String> locNos,String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3) { |
| | | return this.baseMapper.queryStockAll(orderNo,locNos, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3); |
| | | } |
| | | |
| | | @Override |
| | | public Double queryStockAnfme(String matnr, String batch) { |
| | | return this.baseMapper.queryStockAnfme(matnr, batch); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Order> selectComplete99() { |
| | | return this.baseMapper.selectComplete99(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Order> selectComplete8() { |
| | | return this.baseMapper.selectComplete8(); |
| | | } |
| | |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReportOrderIssuedOnceMore() { |
| | | List<Order> orderList = orderService.selectComplete99(); |
| | | for (Order order : orderList) { |
| | | try { |
| | | ReturnT<String> result = orderSyncHandler.startOrderIssuedOnceMore(order); |
| | | if (!result.isSuccess()) { |
| | | log.error("单据[orderNo={}]再次转执行表失败", order.getOrderNo()); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | log.error("单据[orderNo={}]再次转执行表失败", order.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReportOrderIssued() { |
| | | // String erpReport = Parameter.get().getErpReport(); |
| | | // if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | |
| | | try { |
| | | ReturnT<String> result = orderSyncHandler.startOrderIssued(order); |
| | | if (!result.isSuccess()) { |
| | | log.error("单据[orderNo={}]上报erp失败", order.getOrderNo()); |
| | | log.error("单据[orderNo={}]转执行表失败", order.getOrderNo()); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | log.error("单据[orderNo={}]上报erp失败", order.getOrderNo()); |
| | | log.error("单据[orderNo={}]转执行表失败", order.getOrderNo()); |
| | | } |
| | | } |
| | | // } |
| | |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | @Transactional |
| | | public ReturnT<String> startOrderIssuedOnceMore(Order order) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | } |
| | | |
| | | Order order1 = OrderInAndOutUtil.selectByNo(order.getPakinPakoutStatus$(), order.getOrderNo()); |
| | | if (!Cools.isEmpty(order1)){ |
| | | return FAIL.setMsg("请等待...订单执行档案正在转历史档案!!!"); |
| | | } |
| | | List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(order.getPakinPakoutStatus$(), order.getId()); |
| | | if (!Cools.isEmpty(orderDetls) || !orderDetls.isEmpty()) { |
| | | return FAIL.setMsg("请等待...订单执行明细档案正在转历史档案!!!"); |
| | | } |
| | | |
| | | // 单据明细档 |
| | | List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId()); |
| | | for (OrderDetl orderDetl : orderDetlList){ |
| | | if (orderDetl.getQty().equals(0D)){ |
| | | continue; |
| | | } |
| | | orderDetl.setWorkQty(orderDetl.getQty()); |
| | | orderDetl.setAnfme(orderDetl.getAnfme()-orderDetl.getQty()); |
| | | orderDetl.setQty(0D); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | |
| | | // 修改订单状态 99.再次作业 ===>> 1.待作业 |
| | | if (!orderService.updateSettle(order.getId(), 1L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> startOrderIssued(Order order) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> startOrderInAndOutUtil(Order order) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | } |
| | | long settle = 6L; |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | // 入库完成上报 |
| | | if (docType.getPakin() == 1) { |
| | |
| | | pakinParam.setLgortFrom("5008"); |
| | | pakinParam.setLgortTo("5006"); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (!orderDetl.getQty().equals(orderDetl.getAnfme())){ |
| | | settle = 99L;//二次生成单据 |
| | | } |
| | | String serial = Cools.isEmpty(orderDetl.getBatch()) ? "" : orderDetl.getBatch(); |
| | | pakinParam.getList().add(new MesPakinParam.Detl(orderDetl.getMatnr() + (Cools.isEmpty(serial) ? "" : "-" + serial), orderDetl.getAnfme())); |
| | | } |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } else { |
| | |
| | | } |
| | | pakoutParam.setOrderNo(order.getOrderNo()); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (!orderDetl.getQty().equals(orderDetl.getAnfme())){ |
| | | settle = 99L;//二次生成单据 |
| | | } |
| | | String serial = Cools.isEmpty(orderDetl.getBatch()) ? "" : orderDetl.getBatch(); |
| | | pakoutParam.getList().add(new MesPakoutParam.Detl(orderDetl.getMatnr() + (Cools.isEmpty(serial) ? "" : "-" + serial), orderDetl.getAnfme())); |
| | | } |
| | |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } else { |
| | |
| | | </otherwise> |
| | | </choose> |
| | | </sql> |
| | | <sql id="batchSeqA"> |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </when> |
| | | <otherwise> |
| | | and (a.batch IS NULL OR a.batch = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="brand != null and brand != ''"> |
| | | and a.brand = #{brand} |
| | | </when> |
| | | <otherwise> |
| | | and (a.brand IS NULL OR a.brand = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="standby1 != null and standby1 != ''"> |
| | | and a.standby1 = #{standby1} |
| | | </when> |
| | | <otherwise> |
| | | and (a.standby1 IS NULL OR a.standby1 = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="standby2 != null and standby2 != ''"> |
| | | and a.standby2 = #{standby2} |
| | | </when> |
| | | <otherwise> |
| | | and (a.standby2 IS NULL OR a.standby2 = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="standby3 != null and standby3 != ''"> |
| | | and a.standby3 = #{standby3} |
| | | </when> |
| | | <otherwise> |
| | | and (a.standby3 IS NULL OR a.standby3 = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="boxType1 != null and boxType1 != ''"> |
| | | and a.box_type1 = #{boxType1} |
| | | </when> |
| | | <otherwise> |
| | | and (a.box_type1 IS NULL OR a.box_type1 = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="boxType2 != null and boxType2 != ''"> |
| | | and a.box_type2 = #{boxType2} |
| | | </when> |
| | | <otherwise> |
| | | and (a.box_type2 IS NULL OR a.box_type2 = '') |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="boxType3 != null and boxType3 != ''"> |
| | | and a.box_type3 = #{boxType3} |
| | | </when> |
| | | <otherwise> |
| | | and (a.box_type3 IS NULL OR a.box_type3 = '') |
| | | </otherwise> |
| | | </choose> |
| | | </sql> |
| | | <sql id="batchSeqNew"> |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | |
| | | desc |
| | | </select> |
| | | |
| | | <select id="queryStockAll" resultMap="BaseResultMap"> |
| | | select a.* |
| | | from asr_loc_detl a |
| | | left join asr_loc_mast b on a.loc_no = b.loc_no |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | <!-- <choose>--> |
| | | <!-- <when test="batch != null and batch != ''">--> |
| | | <!-- and a.batch = #{batch}--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- and (a.batch IS NULL OR a.batch = '')--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.order_no = #{orderNo} |
| | | </if> |
| | | |
| | | <include refid="batchSeqA"></include> |
| | | |
| | | |
| | | <if test="locNos != null and locNos.size > 0"> |
| | | and b.loc_no not in |
| | | <foreach item="item" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme |
| | | desc, |
| | | NEWID(), |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | | when (left(a.loc_no, 2) = '03') then 1 |
| | | when (left(a.loc_no, 2) = '04') then 0 |
| | | when (left(a.loc_no, 2) = '05') then 0 |
| | | when (left(a.loc_no, 2) = '06') then 1 |
| | | when (left(a.loc_no, 2) = '07') then 1 |
| | | when (left(a.loc_no, 2) = '08') then 0 |
| | | when (left(a.loc_no, 2) = '09') then 0 |
| | | when (left(a.loc_no, 2) = '10') then 1 |
| | | when (left(a.loc_no, 2) = '11') then 1 |
| | | when (left(a.loc_no, 2) = '12') then 0 |
| | | when (left(a.loc_no, 2) = '13') then 0 |
| | | when (left(a.loc_no, 2) = '14') then 1 |
| | | when (left(a.loc_no, 2) = '15') then 1 |
| | | when (left(a.loc_no, 2) = '16') then 0 |
| | | when (left(a.loc_no, 2) = '17') then 0 |
| | | when (left(a.loc_no, 2) = '18') then 1 |
| | | when (left(a.loc_no, 2) = '19') then 1 |
| | | when (left(a.loc_no, 2) = '20') then 0 |
| | | when (left(a.loc_no, 2) = '21') then 0 |
| | | when (left(a.loc_no, 2) = '22') then 1 |
| | | when (left(a.loc_no, 2) = '23') then 1 |
| | | when (left(a.loc_no, 2) = '24') then 0 |
| | | when (left(a.loc_no, 2) = '25') then 0 |
| | | when (left(a.loc_no, 2) = '26') then 1 |
| | | when (left(a.loc_no, 2) = '27') then 1 |
| | | when (left(a.loc_no, 2) = '28') then 0 |
| | | when (left(a.loc_no, 2) = '29') then 0 |
| | | when (left(a.loc_no, 2) = '30') then 1 |
| | | when (left(a.loc_no, 2) = '31') then 1 |
| | | when (left(a.loc_no, 2) = '32') then 0 |
| | | when (left(a.loc_no, 2) = '33') then 0 |
| | | when (left(a.loc_no, 2) = '34') then 1 |
| | | when (left(a.loc_no, 2) = '35') then 1 |
| | | when (left(a.loc_no, 2) = '36') then 0 |
| | | when (left(a.loc_no, 2) = '37') then 0 |
| | | when (left(a.loc_no, 2) = '38') then 1 |
| | | when (left(a.loc_no, 2) = '39') then 1 |
| | | when (left(a.loc_no, 2) = '40') then 0 |
| | | when (left(a.loc_no, 2) = '41') then 0 |
| | | when (left(a.loc_no, 2) = '42') then 1 |
| | | when (left(a.loc_no, 2) = '43') then 1 |
| | | when (left(a.loc_no, 2) = '44') then 0 |
| | | when (left(a.loc_no, 2) = '45') then 0 |
| | | when (left(a.loc_no, 2) = '46') then 1 |
| | | when (left(a.loc_no, 2) = '47') then 1 |
| | | when (left(a.loc_no, 2) = '48') then 0 |
| | | else 0 |
| | | end |
| | | desc |
| | | </select> |
| | | |
| | | <select id="queryStockAnfme" resultType="java.lang.Double"> |
| | | select sum(anfme) as count from man_loc_detl |
| | | where 1=1 |
| | |
| | | order by create_time asc |
| | | </select> |
| | | |
| | | <select id="selectComplete99" resultMap="BaseResultMap"> |
| | | select top 5 * |
| | | from man_order |
| | | where 1=1 |
| | | and settle = 99 |
| | | and status = 1 |
| | | order by create_time asc |
| | | </select> |
| | | |
| | | <select id="selectComplete8" resultMap="BaseResultMap"> |
| | | select top 5 * |
| | | from man_order |
| | |
| | | {type: 'numbers'}, |
| | | {field: 'matnr', title: '商品编码', width: 160}, |
| | | {field: 'maktx', title: '商品名称', width: 160}, |
| | | {field: 'specs', title: '规格'}, |
| | | {field: 'batch', title: '批号'}, |
| | | {field: 'anfme', title: '数量'}, |
| | | {field: 'workQty', title: '作业数量'}, |
| | | {field: 'qty', title: '完成数量', style: 'font-weight: bold'}, |
| | | {field: 'anfme', title: '待完结数量'}, |
| | | {field: 'qty', title: '待上报数量', style: 'font-weight: bold'}, |
| | | {field: 'workQty', title: '已上报数量'}, |
| | | // {field: 'unit', title: '单位'}, |
| | | // { |
| | | // field: 'createTime$', title: '创建时间', sort: true, templet: function (d) { |
| | |
| | | // }, width: 180 |
| | | // }, |
| | | // {field: 'inQty', title: '已入库量'}, |
| | | // {field: 'color', title: '颜色'}, |
| | | {field: 'specs', title: '规格'} |
| | | // {field: 'color', title: '颜色'} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | var traceCharts = echarts.init(document.getElementById('wrkTraceCharts')); |
| | | var traceOptions = { |
| | | title: { |
| | | text: '总量/作业/完成', x: 'center', y: '38%', |
| | | text: '作业/完结/上报', x: 'center', y: '38%', |
| | | textStyle: {fontSize: 18, color: '#262626', fontWeight: 'normal'}, |
| | | subtextStyle: {fontSize: 36, color: '#10B4E8'}, |
| | | itemGap: 20 |