package com.slcf.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import com.slcf.controller.param.SetEmsParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.slcf.bean.WaitPakOutCondition; import com.slcf.dao.WaitPakOutDao; import com.slcf.dao.WorkFileDao; import com.slcf.pojo.WaitPakOutBean; import com.slcf.pojo.WorkDetailBean; import com.slcf.pojo.WorkMastBean; import com.slcf.service.WaitPakOutService; /** * 入库通知档接口实现 * @author admin * @date 2018年11月17日 */ @Service public class WaitPakOutServiceImpl implements WaitPakOutService { @Autowired WaitPakOutDao WaitPakOutDao; @Autowired WorkFileDao workFileDao; /** * 添加 */ public int insertWaitPakOut(WaitPakOutBean waitPakOut) { int result=0; try { result=WaitPakOutDao.insertWaitPakOut(waitPakOut); }catch(Exception e) { System.out.println(e.getMessage()); } return result; } // /** // * 统计数量 // */ // public int queryWaitPakOutCount(){ // int result = 0; // try { // result = WaitPakOutDao.getWaitPakOutCount(); // }catch(Exception e) { // System.out.println(e.getMessage()); // } // return result; // } /** * 分页查询所有 */ public Map queryWaitPakOutList(WaitPakOutCondition waitPakOutCon) { try { Map map=new HashMap(); List list=WaitPakOutDao.queryWaitPakOutList(waitPakOutCon); int count =WaitPakOutDao.getWaitPakOutCount(waitPakOutCon); map.put("rows", list); map.put("total", count); return map; }catch(Exception e) { System.out.println(e.getMessage()); return null; } } // public List queryWaitPakOutList(int spage, int epage) { // try { // return WaitPakOutDao.queryWaitPakOutList(spage, epage); // }catch(Exception e) { // System.out.println(e.getMessage()); // return null; // } // } public Integer waitPakOutSetEms(SetEmsParam setEmsParam) { return WaitPakOutDao.waitPakOutSetEms(setEmsParam.getLgnum(), setEmsParam.getTanum(), setEmsParam.getTapos()); } public Integer countEmsNum() { return WaitPakOutDao.countEmsNum(); } /** * 根据id查找 */ public WaitPakOutBean queryWaitPakOutById(String sheet_no,String mat_no) { try { return WaitPakOutDao.getWaitPakOutById(sheet_no,mat_no); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } /** * 根据库位号查找 */ public WaitPakOutBean queryWaitPakOutByLocNo(String loc_no) { try { return WaitPakOutDao.getWaitPakOutByLocNo(loc_no); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } /** * 根据物料号号查找 */ public WaitPakOutBean queryWaitPakOutByMatNo(String mat_no) { try { return WaitPakOutDao.getWaitPakOutByMatNo(mat_no); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } //更新 public int upWaitPakOut(WaitPakOutBean WaitPakOut, int type) { int result=0; try { result=WaitPakOutDao.upWaitPakOut(WaitPakOut); // if(type==2) { // //如果工作档有数据,调整工作档优先级 // WorkDetailBean workDetail = workFileDao.getWorkDetlByMatNo(WaitPakOut.getMat_no()); // if(workDetail!=null) { // WorkMastBean workMast = workFileDao.getWorkMastById(workDetail.getWrk_no()); // if(workMast!=null) { // workMast.setIo_pri(WaitPakOut.getCtns()); // workFileDao.upWorkMast(workMast); // } // } // // } }catch(Exception e) { // System.out.println("TQSTQS---" + e.getMessage()); System.out.println(e.getMessage()); } return result; } //更新 public int upWaitPakOutByLocNo(WaitPakOutBean WaitPakOut) { int result=0; try { result=WaitPakOutDao.upWaitPakOutByLocNo(WaitPakOut); }catch(Exception e) { System.out.println(e.getMessage()); } return result; } /** * 根据id删除 */ public int delWaitPakOut(WaitPakOutBean WaitPakOut) { int result=0; try { result=WaitPakOutDao.delWaitPakOutById(WaitPakOut); }catch(Exception e) { System.out.println(e.getMessage()); } return result; } /** * 查询所有 * @return */ public List getWaitPakOutList() { try { return WaitPakOutDao.getWaitPakOutList(); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } /** * 转历史档 */ // @Transactional(propagation=Propagation.REQUIRED) @Transactional public int moveToLog(WaitPakOutBean WaitPakOut) { int result=0; try { result=WaitPakOutDao.insertLog(WaitPakOut); result=WaitPakOutDao.delWaitPakOutById(WaitPakOut); }catch(Exception e) { System.out.println(e.getMessage()); } return result; } /** * 查询所有单号 * @return */ public List getSheetNoList() { try { return WaitPakOutDao.getSheetNoList(); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } /** * 根据编号、行号查 */ public WaitPakOutBean queryWaitPakOutByNum(WaitPakOutBean waitPakOutBean) { try { return WaitPakOutDao.getWaitPakOutByNum(waitPakOutBean); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } /** * 查询最早一笔待反馈SAP数据 */ public WaitPakOutBean queryWaitPakOutFnh() { try { return WaitPakOutDao.getWaitPakOutFnh(); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } /** * 查询最早一笔待打印标签数据 */ public WaitPakOutBean getWaitPakOutPrint() { try { return WaitPakOutDao.getWaitPakOutPrint(); }catch(Exception e) { System.out.println(e.getMessage()); return null; } } }