|  |  |  | 
|---|
|  |  |  | import com.zy.common.model.enums.WorkNoType; | 
|---|
|  |  |  | import com.zy.common.service.CommonService; | 
|---|
|  |  |  | import com.zy.common.utils.NodeUtils; | 
|---|
|  |  |  | import com.zy.third.erp.task.ERPOutHedTBScheduler; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private WrkMastService wrkMastService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ERPOutHedTBScheduler erpOutHedTBScheduler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 出库站点 | 
|---|
|  |  |  | Integer outSite = null; | 
|---|
|  |  |  | List<BasDevp> devps = basDevpService.selectList(new EntityWrapper<BasDevp>().in("dev_no", 223, 123)); | 
|---|
|  |  |  | List<BasDevp> devps = basDevpService.selectList(new EntityWrapper<BasDevp>().in("dev_no", 223, 123).orderBy("dev_no",false)); | 
|---|
|  |  |  | for (BasDevp basDevp : devps) { | 
|---|
|  |  |  | // 无工作号,无物 | 
|---|
|  |  |  | if (basDevp.getWrkNo() == 0 && basDevp.getLoading().equals("N")) { | 
|---|
|  |  |  | if (basDevp.getWrkNo() == 0 && basDevp.getLoading().equals("Y")) { | 
|---|
|  |  |  | outSite = basDevp.getDevNo(); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (outSite == null) { | 
|---|
|  |  |  | outSite = 123; | 
|---|
|  |  |  | outSite = 223; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取单据 | 
|---|
|  |  |  | Order order = orderService.selectByNo(orderNo); | 
|---|
|  |  |  | if (order == null) { | 
|---|
|  |  |  | erpOutHedTBScheduler.OutHedTBScheduler(orderNo); | 
|---|
|  |  |  | order = orderService.selectByNo(orderNo); | 
|---|
|  |  |  | //            int i = 30; | 
|---|
|  |  |  | //            while (i >= 0) { | 
|---|
|  |  |  | //                try { | 
|---|
|  |  |  | //                    Thread.sleep(1000); | 
|---|
|  |  |  | //                    System.out.println(i); | 
|---|
|  |  |  | //                } catch (InterruptedException e) { | 
|---|
|  |  |  | //                    throw new RuntimeException(e); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                order = orderService.selectByNo(orderNo); | 
|---|
|  |  |  | //                if (order != null) { | 
|---|
|  |  |  | //                    break; | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                i--; | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (order == null) { | 
|---|
|  |  |  | return R.parse("单据不存在:" + orderNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 获取单据明细 | 
|---|
|  |  |  | List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("出库成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public void syncMat(MatSyncParam param) { | 
|---|
|  |  |  | if (Cools.isEmpty(param.getMatDetails()) || param.getMatDetails().size() <=0 ) { | 
|---|
|  |  |  | if (Cools.isEmpty(param.getMatDetails()) || param.getMatDetails().size() <= 0) { | 
|---|
|  |  |  | throw new CoolException("商品数据为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for(MatSyncParam.MatParam matParam : param.getMatDetails()){ | 
|---|
|  |  |  | if(Cools.isEmpty(matParam.getMatnr())){ | 
|---|
|  |  |  | for (MatSyncParam.MatParam matParam : param.getMatDetails()) { | 
|---|
|  |  |  | if (Cools.isEmpty(matParam.getMatnr())) { | 
|---|
|  |  |  | throw new CoolException("商品编码不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | mat.sync(param); | 
|---|
|  |  |  | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr",matParam.getMatnr()))) { | 
|---|
|  |  |  | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr", matParam.getMatnr()))) { | 
|---|
|  |  |  | throw new CoolException("更新已存在商品信息失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|