| | |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.entity.Parameter; |
| | |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class MobileServiceImpl implements MobileService { |
| | | |
| | | @Value("${srHangJia.url}") |
| | | private String srHangJiaUrl; |
| | | |
| | | @Value("${srHangJia.reportOutPath}") |
| | | private String reportOutPath; |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void trussComb(TrussCombParam param, Long userId) { |
| | | param.setUuid(String.valueOf(new Date().getTime())); |
| | | param.setBarcode(String.valueOf(new Date().getTime())); |
| | | |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | throw new CoolException("参数:码垛位编号 palletizingNo为空"); |
| | | }else if (Cools.isEmpty(param.getBoxType())){ |
| | | throw new CoolException("参数:木箱类型 boxType为空"); |
| | | }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size() != 1){ |
| | | throw new CoolException("参数:物料明细 matLists为空"); |
| | | } |
| | | |
| | | param.setStaEnd(param.getPalletizingNo2()); |
| | | |
| | | try{ |
| | | ReturnT<String> success = new PostMesDataUtils().postMesData("桁架上位软件", srHangJiaUrl, reportOutPath, param); |
| | | if (success.getCode()!=200){ |
| | | throw new CoolException("组托失败"); |
| | | } |
| | | } catch (Exception e){ |
| | | throw new CoolException("组托失败"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void trussCombOrder(TrussCombParam param, Long userId) { |
| | | |
| | | param.setBarcode(String.valueOf(new Date().getTime())); |
| | | |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | throw new CoolException("参数:码垛位编号 palletizingNo为空"); |
| | | }else if (Cools.isEmpty(param.getOrderNo())){ |
| | | throw new CoolException("参数:退货单单号 orderNo为空"); |
| | | }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size() != 1){ |
| | | throw new CoolException("参数:物料明细 matLists为空"); |
| | | } |
| | | |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (Cools.isEmpty(order)){ |
| | | throw new CoolException("未查询到此订单,单号:"+param.getOrderNo()); |
| | | } |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (Cools.isEmpty(docType) || !docType.getDocName().equals("退货入库单")){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+"不是退货入库单"); |
| | | } |
| | | |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | if (Cools.isEmpty(orderDetls) || orderDetls.size()==0){ |
| | | throw new CoolException("未查询到此订单明细,单号:"+param.getOrderNo()); |
| | | } |
| | | List<String> orderBoxNoList = new ArrayList<>(); |
| | | for (OrderDetl orderDetl: orderDetls){ |
| | | if (orderDetl.getWorkQty()==0){ |
| | | orderBoxNoList.add(orderDetl.getBatch()); |
| | | } |
| | | } |
| | | if (orderBoxNoList.size()==0 || orderBoxNoList.size()<param.getMatList().size()){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+" 退货数量大于明细数量"); |
| | | } |
| | | List<String> matListBoxNoList = new ArrayList<>(); |
| | | for (TrussCombParam.MatList matList: param.getMatList()){ |
| | | if (!orderBoxNoList.contains(matList.getBoxNo())){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+" 箱号:"+matList.getBatch()+"不属于此订单或者已经入库"); |
| | | }else { |
| | | matListBoxNoList.add(matList.getBoxNo()); |
| | | } |
| | | } |
| | | List<OrderDetl> orderDetlList = new ArrayList<>(); |
| | | for (OrderDetl orderDetl: orderDetls){ |
| | | if (matListBoxNoList.contains(orderDetl.getBatch())){ |
| | | orderDetlList.add(orderDetl); |
| | | } |
| | | } |
| | | TrussCombParam trussCombParam = new TrussCombParam(param, order, orderDetlList); |
| | | try{ |
| | | ReturnT<String> success = new PostMesDataUtils().postMesData("桁架上位软件", srHangJiaUrl, reportOutPath, trussCombParam); |
| | | if (success.getCode()!=200){ |
| | | throw new CoolException("组托失败"); |
| | | } |
| | | } catch (Exception e){ |
| | | throw new CoolException("组托失败"); |
| | | } |
| | | } |
| | | @Override |
| | | @Transactional |