| | |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | // LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | // issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | int ioType = (issued >= locDetl.getAnfme() && locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())) == 1) ? 101 : 103; |
| | | locDetl.getAnfme()); |
| | | // int ioType = (issued >= locDetl.getAnfme() && locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())) == 1) ? 101 : 103; |
| | | int ioType = 101; |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); |
| | | locDto.setStaNos(staNos); |
| | | locDtos.add(locDto); |
| | |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | boolean lack = true; |
| | | for (LocDto locDto : locDtos) { |
| | | if (Cools.isEmpty(locDto.getStaNo())) { |
| | | return R.error(locDto.getLocNo()+"库位请选择出库站"); |
| | | } |
| | | } |
| | | for (LocDto locDto : locDtos) { |
| | | if (!locDto.isLack()) { |
| | | lack = false; |
| | |
| | | if (order.getSettle() > 2) { |
| | | return R.error(orderDto.getOrderNo() + "订单已失效,请及时刷新页面"); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), orderDto.getMatnr(), orderDto.getBatch()); |
| | | if (orderDetl.getAnfme() - orderDetl.getQty() < orderDto.getAnfme()) { |
| | | return R.ok(orderDto.getOrderNo() + "订单已作业,请及时刷新页面"); |
| | | } |
| | | // OrderDetl orderDetl = orderDetlService.selectItemNoneOfBatch(orderDto.getOrderNo(), orderDto.getMatnr()); |
| | | // if (orderDetl.getAnfme() - orderDetl.getQty() < orderDto.getAnfme()) { |
| | | // return R.ok(orderDto.getOrderNo() + "订单已作业,请及时刷新页面"); |
| | | // } |
| | | } |
| | | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | public Double getEnableQty() { |
| | | Double enableQty = null; |
| | | if (null != this.anfme && this.qty != null) { |
| | | return this.anfme - this.qty; |
| | | enableQty = this.anfme - this.qty; |
| | | if (enableQty < 0) { |
| | | enableQty = 0.0D; |
| | | } |
| | | // return this.anfme - this.qty; |
| | | } |
| | | return null; |
| | | return enableQty; |
| | | } |
| | | |
| | | public void sync(Object source) { |
| | |
| | | |
| | | OrderDetl selectItemByOrderNo(@Param("orderNo") String orderNo, @Param("matnr") String matnr, @Param("batch") String batch); |
| | | |
| | | OrderDetl selectItemNoneOfBatch(String orderNo, String matnr); |
| | | |
| | | List<OrderDetl> selectWorkingDetls(Long orderId); |
| | | |
| | | List<OrderDetl> getPakoutPage(Map<String, Object> map); |
| | |
| | | |
| | | List<Integer> queryOutStaNosByLocNo(@Param("locNo") String locNo, @Param("typeNo") Integer typeNo); |
| | | |
| | | List<Integer> queryOutStaNosByCrnNo(@Param("crnNo") Integer crnNo, @Param("typeNo") Integer typeNo); |
| | | |
| | | StaDesc queryCrnStn(Integer crnNo); |
| | | |
| | | } |
| | |
| | | |
| | | OrderDetl selectItem(String orderNo, String matnr, String batch); |
| | | |
| | | OrderDetl selectItemNoneOfBatch(String orderNo, String matnr); |
| | | |
| | | OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch); |
| | | |
| | | boolean increaseAnfme(Long orderId, String matnr, String batch, Double qty); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl selectItemNoneOfBatch(String orderNo, String matnr) { |
| | | return this.baseMapper.selectItemNoneOfBatch(orderNo, matnr); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch) { |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (orderDetl.getOrderId().equals(orderId) && orderDetl.getMatnr().equals(matnr)) { |
| | |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.OrderDto; |
| | | import com.zy.common.model.OrderMergeVo; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private ErpService erpService; |
| | | |
| | | @Override |
| | | public Order selectByNo(String orderNo) { |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.mapper.StaDescMapper; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | @Service("staDescService") |
| | | public class StaDescServiceImpl extends ServiceImpl<StaDescMapper, StaDesc> implements StaDescService { |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Override |
| | | public List<Integer> queryOutStaNosByLocNo(String locNo, Integer typeNo) { |
| | | return this.baseMapper.queryOutStaNosByLocNo(locNo, typeNo); |
| | | int crnNo = 0; |
| | | int row = Utils.getRow(locNo); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | crnNo = 1; |
| | | } |
| | | if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | crnNo = 3; |
| | | } |
| | | if (row == 1) { |
| | | crnNo = 1; |
| | | } |
| | | if (row == 31 || row == 32) { |
| | | crnNo = 3; |
| | | } |
| | | return this.baseMapper.queryOutStaNosByCrnNo(crnNo, typeNo); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.service.erp.entity.VoucherDetail; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | if (!erpService.updateStateForVoucher(order.getOrderNo(), state)) { |
| | | throw new CoolException(order.getOrderNo() + "订单修改State为"+state+"失败"); |
| | | } else { |
| | | erpService.updateTimeForVoucherDetail(order.getOrderNo()); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | VoucherDetail voucherDetail = new VoucherDetail(); |
| | | voucherDetail.setVoucherID(order.getOrderNo()); |
| | | voucherDetail.setPickID("fepvnn0496"); |
| | | voucherDetail.setBarcode(orderDetl.getBatch()); |
| | | if (!erpService.insertVoucherDetail(voucherDetail)) { |
| | | throw new CoolException(order.getOrderNo() + "订单添加VoucherDetail"+ JSON.toJSONString(voucherDetail)+"失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | // 修改 erp Goods 表 |
| | | List<WrkDetl> wrkDetls0 = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls0) { |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | Goods goods = erpService.selectGoodsOne(wrkDetl.getBatch()); |
| | | if (!Cools.isEmpty(goods)) { |
| | | if (!erpService.updateStateForGoods(goods.getBarCode(), 4)) { |
| | | log.error("{}条码在erp数据库中更新失败!", goods.getBarCode()); |
| | | } |
| | | } else { |
| | | log.error("{}条码不在erp数据库中!", wrkDetl.getMatnr()); |
| | | } |
| | | } |
| | | for (WrkDetl wrkDetl : wrkDetlsKeyOrder) { |
| | | Goods goods = erpService.selectGoodsOne(wrkDetl.getBatch()); |
| | | if (!Cools.isEmpty(goods)) { |
| | | if (!erpService.updateStateForGoods(goods.getBarCode(), 4)) { |
| | |
| | | } |
| | | } |
| | | // 修改 erp Goods 表 |
| | | List<WrkDetl> wrkDetls0 = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls0) { |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | Goods goods = erpService.selectGoodsOne(wrkDetl.getBatch()); |
| | | if (!Cools.isEmpty(goods)) { |
| | | if (!erpService.updateStateForGoods(goods.getBarCode(), 4)) { |
| | | log.error("{}条码在erp数据库中更新失败!", goods.getBarCode()); |
| | | } |
| | | } else { |
| | | log.error("{}条码不在erp数据库中!", wrkDetl.getMatnr()); |
| | | } |
| | | } |
| | | for (WrkDetl wrkDetl : wrkDetlsKeyOrder) { |
| | | Goods goods = erpService.selectGoodsOne(wrkDetl.getBatch()); |
| | | if (!Cools.isEmpty(goods)) { |
| | | if (!erpService.updateStateForGoods(goods.getBarCode(), 4)) { |
| | |
| | | return erpSqlServer.update(sql) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 新增 VoucherDetail 表 |
| | | */ |
| | | public boolean insertVoucherDetail(VoucherDetail voucherDetail){ |
| | | String sql = "update VoucherDetail set LastUpdatedDate = ''{1}'' where VoucherID = ''{0}''"; |
| | | sql = MessageFormat.format(sql, voucherID, DateUtils.convert(new Date())); |
| | | return erpSqlServer.update(sql) > 0; |
| | | } |
| | | |
| | | } |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectItemNoneOfBatch" resultMap="BaseResultMap"> |
| | | select * from man_order_detl |
| | | where 1=1 |
| | | and order_no = #{orderNo} |
| | | and matnr = #{matnr} |
| | | </select> |
| | | |
| | | <select id="selectWorkingDetls" resultMap="BaseResultMap"> |
| | | select * from man_order_detl |
| | | where 1=1 |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="queryOutStaNosByCrnNo" resultType="java.lang.Integer"> |
| | | select |
| | | distinct asd.stn_no |
| | | from asr_sta_desc asd |
| | | where 1=1 |
| | | and asd.crn_no = #{crnNo} |
| | | and asd.type_no = #{typeNo} |
| | | </select> |
| | | |
| | | <select id="queryCrnStn" resultMap="BaseResultMap"> |
| | | select top 1 * from asr_sta_desc |
| | | where 1=1 |
| | |
| | | {type: 'numbers'}, |
| | | {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'}, |
| | | {field: 'docType$', align: 'center', title: '类型', minWidth: 160, width: 160}, |
| | | {field: 'postFee', align: 'center', title: '总数量', minWidth: 130, width: 130}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160}, |
| | | {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200}, |
| | | {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 160, width: 160}, |