| | |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.service.erp.entity.OutStockBillEntry; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | /** |
| | | * Created by vincent on 2020/7/6 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RestController |
| | | public class WorkLogHandler extends AbstractHandler<String> { |
| | | public class WorkLogHandler extends AbstractHandler<Exception> { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @GetMapping("/test1") |
| | | public String test1(String barcode){ |
| | | Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>().eq("zpallet", barcode); |
| | | // erp关联订单处理 |
| | | List<WaitPakin> waitPakins = waitPakinService.selectList(wrapper); |
| | | for (WaitPakin waitPakin : waitPakins) { |
| | | boolean erpRes = erpService.incrementPakIn(waitPakin.getSupplier(), waitPakin.getMatnr(), waitPakin.getAnfme()); |
| | | if (!erpRes) { |
| | | exceptionHandle("更新ERP入库数据[matnr={0}]失败", waitPakin.getMatnr()); |
| | | } |
| | | } |
| | | return "ok"; |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | public ReturnT<Exception> start(WrkMast wrkMast) { |
| | | try { |
| | | |
| | | if (!Cools.isEmpty(wrkMast.getBarcode())) { |
| | |
| | | if (!erpService.incrementCPakOut(FInterI, wrkDetl.getMatnr(), wrkDetl.getAnfme(), wrkDetl.getSupplier())) { |
| | | exceptionHandle("[xtyasrs_dual]更新ERP成品出库数据[matnr={0}]失败", wrkDetl.getMatnr()); |
| | | } |
| | | // if (!outStockService.incrementCPakOut(FInterI, wrkDetl.getMatnr(), wrkDetl.getAnfme(), wrkDetl.getSupplier())) { |
| | | // exceptionHandle("[xtyasrs]更新ERP成品出库数据[matnr={0}]失败", wrkDetl.getMatnr()); |
| | | // } |
| | | } |
| | | if (wrkDetl.getMemo().equals("原材料")) { |
| | | // 待实现 |
| | | |
| | | |
| | | } else if (wrkDetl.getMemo().equals("成品")) { |
| | | |
| | | if (!outStockService.incrementCPakOut(FInterI, wrkDetl.getMatnr(), wrkDetl.getAnfme(), wrkDetl.getSupplier())) { |
| | | exceptionHandle("[xtyasrs]更新ERP成品出库数据[matnr={0}]失败", wrkDetl.getMatnr()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 保存工作主档历史档 |
| | | if (!wrkMastLogService.save(wrkMast.getWrkNo())) { |
| | |
| | | // exceptionHandle("删除工作明细档[workNo={0}]失败", wrkMast.getWrkNo()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("fail", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | return FAIL.setContent(e); |
| | | } |
| | | return SUCCESS; |
| | | } |