| | |
| | | import java.io.OutputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.slcf.bean.WaitPakOutLogCondition; |
| | | import com.slcf.controller.param.SetEmsParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import com.slcf.pojo.UserBean; |
| | | import com.slcf.bean.WaitPakOutCondition; |
| | |
| | | |
| | | /** |
| | | * 出库通知档控制器层 |
| | | * |
| | | * @author admin |
| | | * @date 2018年11月21日 |
| | | */ |
| | |
| | | @RequestMapping("/work") |
| | | public class WaitPakOutController { |
| | | |
| | | @Resource |
| | | WaitPakOutService waitPakOutService; |
| | | @Autowired |
| | | SysLogService sysLogService; |
| | | @Autowired |
| | | MatCodeService matCodeService; |
| | | @Autowired |
| | | LocDetailService locDetailService; |
| | | @Autowired |
| | | RoleService roleService; |
| | | @Autowired |
| | | LocationService locationService; |
| | | @Autowired |
| | | StaDescService staDescService; |
| | | @Autowired |
| | | StationService stationService; |
| | | @Autowired |
| | | WorkNoService workNoService; |
| | | @Autowired |
| | | WorkFileService workFileService; |
| | | @Autowired |
| | | RowNoService rowNoService; |
| | | @Autowired |
| | | CrnService crnService; |
| | | @Autowired |
| | | OperateService operateService; |
| | | |
| | | @RequestMapping("/goWaitPakOut.action") |
| | | public String goWaitPakOutPage(HttpServletRequest request){ |
| | | try { |
| | | String rid = request.getSession().getAttribute("ROLEID").toString(); |
| | | String authCode = roleService.getAuthListByRoleMenu(Integer.parseInt(rid), |
| | | AuthorityCode.WaitPakOutCode); |
| | | request.getSession().setAttribute("AUTHCODE",authCode); |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("goWaitPakOut.action"); |
| | | sysLog.setTts_keyname("访问:出库通知档"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | }catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return "waitPakOut"; |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param WaitPakOut |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/addWaitPakOut.action") |
| | | public Integer insertWaitPakOut(WaitPakOutBean waitPakOut,HttpServletRequest request){ |
| | | int result=0; |
| | | try { |
| | | UserBean user=(UserBean)request.getSession().getAttribute("USER"); |
| | | if(waitPakOut.getSheet_no()==null || waitPakOut.getSheet_no().equals("")) { |
| | | int random = (int)(Math.random()*900 + 100); |
| | | String seq = Integer.toString(random); |
| | | String sheet_no = DateTimeUtil.getStringDateTime(14); |
| | | waitPakOut.setSheet_no(sheet_no+seq); |
| | | } |
| | | waitPakOut.setSheet_no(waitPakOut.getSheet_no().trim()); |
| | | waitPakOut.setModi_user(user.getUser_account()); |
| | | result = waitPakOutService.insertWaitPakOut(waitPakOut); |
| | | @Resource |
| | | WaitPakOutService waitPakOutService; |
| | | @Autowired |
| | | SysLogService sysLogService; |
| | | @Autowired |
| | | MatCodeService matCodeService; |
| | | @Autowired |
| | | LocDetailService locDetailService; |
| | | @Autowired |
| | | RoleService roleService; |
| | | @Autowired |
| | | LocationService locationService; |
| | | @Autowired |
| | | StaDescService staDescService; |
| | | @Autowired |
| | | StationService stationService; |
| | | @Autowired |
| | | WorkNoService workNoService; |
| | | @Autowired |
| | | WorkFileService workFileService; |
| | | @Autowired |
| | | RowNoService rowNoService; |
| | | @Autowired |
| | | CrnService crnService; |
| | | @Autowired |
| | | OperateService operateService; |
| | | |
| | | if(result>0) { |
| | | // 插入日志 |
| | | @RequestMapping("/goWaitPakOut.action") |
| | | public String goWaitPakOutPage(HttpServletRequest request) { |
| | | try { |
| | | String rid = request.getSession().getAttribute("ROLEID").toString(); |
| | | String authCode = roleService.getAuthListByRoleMenu(Integer.parseInt(rid), |
| | | AuthorityCode.WaitPakOutCode); |
| | | request.getSession().setAttribute("AUTHCODE", authCode); |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("goWaitPakOut.action"); |
| | | sysLog.setTts_keyname("访问:出库通知档"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return "waitPakOut"; |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param WaitPakOut |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/addWaitPakOut.action") |
| | | public Integer insertWaitPakOut(WaitPakOutBean waitPakOut, HttpServletRequest request) { |
| | | int result = 0; |
| | | try { |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | if (waitPakOut.getSheet_no() == null || waitPakOut.getSheet_no().equals("")) { |
| | | int random = (int) (Math.random() * 900 + 100); |
| | | String seq = Integer.toString(random); |
| | | String sheet_no = DateTimeUtil.getStringDateTime(14); |
| | | waitPakOut.setSheet_no(sheet_no + seq); |
| | | } |
| | | waitPakOut.setSheet_no(waitPakOut.getSheet_no().trim()); |
| | | waitPakOut.setModi_user(user.getUser_account()); |
| | | result = waitPakOutService.insertWaitPakOut(waitPakOut); |
| | | |
| | | if (result > 0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("addWaitPakOut.action"); |
| | | sysLog.setTts_keyname("插入通知档:" + waitPakOut.getSheet_no() + "-" + waitPakOut.getMat_no()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | result=0; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 分页查询所有 |
| | | * @param pageNumber |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/waitPakOutList.action") |
| | | public Map<String,Object> queryWaitPakOutListByPages(WaitPakOutCondition waitPakOutCon){ |
| | | Map<String,Object>map=waitPakOutService.queryWaitPakOutList(waitPakOutCon); |
| | | return map; |
| | | } |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("addWaitPakOut.action"); |
| | | sysLog.setTts_keyname("插入通知档:" + waitPakOut.getSheet_no() + "-" + waitPakOut.getMat_no()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | result = 0; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 验证物料编号是否存在 |
| | | * @param did |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/checkCodeOut.action") |
| | | public Map<String,Object> checkMatCodeOut(@RequestParam("did")String id){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | /** |
| | | * 分页查询所有 |
| | | * |
| | | * @param pageNumber |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/waitPakOutList.action") |
| | | public Map<String, Object> queryWaitPakOutListByPages(WaitPakOutCondition waitPakOutCon) { |
| | | Map<String, Object> map = waitPakOutService.queryWaitPakOutList(waitPakOutCon); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 出库通知档设置任务为紧急状态 |
| | | * |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/waitPakOutSetEms.action", produces = "text/html; charset=UTF-8") |
| | | public String syncStocksFromSap(@RequestBody List<SetEmsParam> list) throws Exception { |
| | | Integer i = 0; |
| | | String errorTxt = ""; |
| | | if (list.size() > 0) { |
| | | // 判断紧急任务的库位是否超过三个,超过则进行提醒 |
| | | List<String> vlplaList = new ArrayList<String>(); |
| | | for (SetEmsParam item : list) { |
| | | if (!vlplaList.contains(item.getVlpla())) { |
| | | vlplaList.add(item.getVlpla()); |
| | | } |
| | | } |
| | | Integer emsNum = waitPakOutService.countEmsNum(); |
| | | if ((emsNum + vlplaList.size()) <= 3) { |
| | | // 设置任务为紧急状态 |
| | | for (SetEmsParam item : list) { |
| | | if (waitPakOutService.waitPakOutSetEms(item) > 0) { |
| | | i++; |
| | | } |
| | | } |
| | | } else { |
| | | errorTxt = "紧急任务不同库位已超出3个,请耐心等待任务完成"; |
| | | } |
| | | } else { |
| | | throw new Error("数据异常"); |
| | | } |
| | | return (i == 0) ? errorTxt : i.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 验证物料编号是否存在 |
| | | * |
| | | * @param did |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/checkCodeOut.action") |
| | | public Map<String, Object> checkMatCodeOut(@RequestParam("did") String id) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | // boolean flag=userService.validUserAccount(account, uid); |
| | | try { |
| | | MatCodeBean matCode = matCodeService.queryMatCodeById(id); |
| | | try { |
| | | MatCodeBean matCode = matCodeService.queryMatCodeById(id); |
| | | // count = locDetailService.getLocStockCount(mat_no); |
| | | if(matCode!=null){ |
| | | map.put("msg", "代号可用"); |
| | | map.put("mat_name_add",matCode.getMat_name()); |
| | | }else{ |
| | | map.put("msg", "物料号不存在"); |
| | | } |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/queryWaitPakOutById.action") |
| | | public WaitPakOutBean queryWaitPakOutById(@RequestParam("sheet_no")String sheet_no, |
| | | @RequestParam("mat_no")String mat_no,HttpServletRequest request){ |
| | | try { |
| | | return waitPakOutService.queryWaitPakOutById(sheet_no,mat_no); |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | if (matCode != null) { |
| | | map.put("msg", "代号可用"); |
| | | map.put("mat_name_add", matCode.getMat_name()); |
| | | } else { |
| | | map.put("msg", "物料号不存在"); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/queryWaitPakOutById.action") |
| | | public WaitPakOutBean queryWaitPakOutById(@RequestParam("sheet_no") String sheet_no, |
| | | @RequestParam("mat_no") String mat_no, HttpServletRequest request) { |
| | | try { |
| | | return waitPakOutService.queryWaitPakOutById(sheet_no, mat_no); |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 验证工作代号是否唯一 |
| | | // * @param did |
| | |
| | | // } |
| | | // return map; |
| | | // } |
| | | |
| | | /** |
| | | * 手工完结入库通知档,反馈ERP |
| | | * @param WaitPakInEntity |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/overWaitPakOut.action") |
| | | public Integer overWaitPakOut(WaitPakOutBean waitPakout,HttpServletRequest request){ |
| | | int result = 0; |
| | | try { |
| | | UserBean user=(UserBean)request.getSession().getAttribute("USER"); |
| | | waitPakout.setModi_user(user.getUser_account()); |
| | | |
| | | WaitPakOutBean waitPakOutBean = waitPakOutService.queryWaitPakOutByNum(waitPakout); |
| | | String httpUrl = Constants.SAP_URL + "/sap/opu/odata/SAP/Z_WM_H5_SRV/ToConHeadSet"; |
| | | result = sendPakOutStatus(httpUrl,waitPakOutBean); |
| | | |
| | | /** |
| | | * 手工完结入库通知档,反馈ERP |
| | | * |
| | | * @param WaitPakInEntity |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/overWaitPakOut.action") |
| | | public Integer overWaitPakOut(WaitPakOutBean waitPakout, HttpServletRequest request) { |
| | | int result = 0; |
| | | try { |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | waitPakout.setModi_user(user.getUser_account()); |
| | | |
| | | WaitPakOutBean waitPakOutBean = waitPakOutService.queryWaitPakOutByNum(waitPakout); |
| | | String httpUrl = Constants.SAP_URL + "/sap/opu/odata/SAP/Z_WM_H5_SRV/ToConHeadSet"; |
| | | result = sendPakOutStatus(httpUrl, waitPakOutBean); |
| | | // result=waitPakInService.upWaitPakIn(waitPakIn); |
| | | if(result>0) { |
| | | // 插入日志 |
| | | if (result > 0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("upWaitPakIn.action"); |
| | | sysLog.setTts_keyname("修改入库通知档:" + waitPakout.getSheet_no()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 出库完成,调用sap接口上传完成信息 |
| | | */ |
| | | private int sendPakOutStatus(String httpUrl,WaitPakOutBean waitPakOut) { |
| | | int result = 0; |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("upWaitPakIn.action"); |
| | | sysLog.setTts_keyname("修改入库通知档:" + waitPakout.getSheet_no()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 出库完成,调用sap接口上传完成信息 |
| | | */ |
| | | private int sendPakOutStatus(String httpUrl, WaitPakOutBean waitPakOut) { |
| | | int result = 0; |
| | | // String token = getXCsrfToken(httpUrl); |
| | | String input = Constants.SAP_USER + ":" + Constants.SAP_PASSWORD;//"ZHANGX:654321"; |
| | | String input = Constants.SAP_USER + ":" + Constants.SAP_PASSWORD;//"ZHANGX:654321"; |
| | | BASE64Encoder base = new BASE64Encoder(); |
| | | String encodedPassword; |
| | | String token=""; |
| | | String session_value=""; |
| | | try { |
| | | encodedPassword = base.encode(input.getBytes("UTF-8")); |
| | | URL url1 = new URL(httpUrl); |
| | | HttpURLConnection connection1 = (HttpURLConnection) url1.openConnection(); |
| | | connection1.setDoOutput(true); |
| | | connection1.setDoInput(true); |
| | | connection1.setRequestMethod("GET"); |
| | | connection1.setRequestProperty("Authorization", "Basic " + encodedPassword); |
| | | connection1.setRequestProperty("x-csrf-token","Fetch"); |
| | | String sessionCookie = connection1.getHeaderField("Set-Cookie"); |
| | | String[] sessionId = sessionCookie.split(";"); |
| | | session_value = sessionId[0]; |
| | | token = connection1.getHeaderField("x-csrf-token"); |
| | | String token = ""; |
| | | String session_value = ""; |
| | | try { |
| | | encodedPassword = base.encode(input.getBytes("UTF-8")); |
| | | URL url1 = new URL(httpUrl); |
| | | HttpURLConnection connection1 = (HttpURLConnection) url1.openConnection(); |
| | | connection1.setDoOutput(true); |
| | | connection1.setDoInput(true); |
| | | connection1.setRequestMethod("GET"); |
| | | connection1.setRequestProperty("Authorization", "Basic " + encodedPassword); |
| | | connection1.setRequestProperty("x-csrf-token", "Fetch"); |
| | | String sessionCookie = connection1.getHeaderField("Set-Cookie"); |
| | | String[] sessionId = sessionCookie.split(";"); |
| | | session_value = sessionId[0]; |
| | | token = connection1.getHeaderField("x-csrf-token"); |
| | | // Map<String, List<String>> map = connection1.getHeaderFields(); |
| | | // token = map.get("x-csrf-token").toString(); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | JSONObject jsObj = new JSONObject(); |
| | | JSONArray arr = new JSONArray(); |
| | | for(int i=0;i<1;i++) { |
| | | JSONObject json = new JSONObject(); |
| | | json.put("lgnum",waitPakOut.getLgnum()); |
| | | json.put("tanum",Long.toString(waitPakOut.getTanum())); |
| | | json.put("tapos",Integer.toString(waitPakOut.getTapos())); |
| | | |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | JSONObject jsObj = new JSONObject(); |
| | | JSONArray arr = new JSONArray(); |
| | | for (int i = 0; i < 1; i++) { |
| | | JSONObject json = new JSONObject(); |
| | | json.put("lgnum", waitPakOut.getLgnum()); |
| | | json.put("tanum", Long.toString(waitPakOut.getTanum())); |
| | | json.put("tapos", Integer.toString(waitPakOut.getTapos())); |
| | | |
| | | // json.put("nista",Double.toString(waitPakOut.getVsolm())); |
| | | // json.put("ndifa","0"); |
| | | json.put("altme",waitPakOut.getMeins()); |
| | | json.put("nltyp","A01"); |
| | | json.put("nlpla",waitPakOut.getNlpla()); |
| | | arr.add(json); |
| | | } |
| | | jsObj.put("item", arr); |
| | | byte[] buff = jsObj.toString().getBytes(); |
| | | int buffLen = buff.length; |
| | | //创建连接 |
| | | try { |
| | | json.put("altme", waitPakOut.getMeins()); |
| | | json.put("nltyp", "A01"); |
| | | json.put("nlpla", waitPakOut.getNlpla()); |
| | | arr.add(json); |
| | | } |
| | | jsObj.put("item", arr); |
| | | byte[] buff = jsObj.toString().getBytes(); |
| | | int buffLen = buff.length; |
| | | //创建连接 |
| | | try { |
| | | // String input = "ZHANGX:654321"; |
| | | // BASE64Encoder base = new BASE64Encoder(); |
| | | // String encodedPassword = base.encode(input.getBytes("UTF-8")); |
| | | |
| | | URL url = new URL(httpUrl); |
| | | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setRequestMethod("POST"); |
| | | // connection.setUseCaches(false); |
| | | // connection.setInstanceFollowRedirects(true); |
| | | |
| | | URL url = new URL(httpUrl); |
| | | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setRequestMethod("POST"); |
| | | // connection.setUseCaches(false); |
| | | // connection.setInstanceFollowRedirects(true); |
| | | // connection.setRequestProperty("Content-Type","text/json;charset=gb2312"); |
| | | connection.setRequestProperty("Cookie", session_value); |
| | | connection.setRequestProperty("Content-Type","application/json"); |
| | | connection.setRequestProperty("Accept","application/json"); |
| | | connection.setRequestProperty("Accept-Language","zh-CN,zh;q=0.9,en;q=0.8"); |
| | | connection.setRequestProperty("Content-Length","" + buffLen); |
| | | connection.setRequestProperty("Cookie", session_value); |
| | | connection.setRequestProperty("Content-Type", "application/json"); |
| | | connection.setRequestProperty("Accept", "application/json"); |
| | | connection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8"); |
| | | connection.setRequestProperty("Content-Length", "" + buffLen); |
| | | // connection.setRequestProperty("Authorization", "Basic " + encodedPassword); |
| | | connection.setRequestProperty("x-csrf-token",token); |
| | | |
| | | //POST请求 |
| | | OutputStream out = connection.getOutputStream(); |
| | | out.write(buff); |
| | | out.close(); |
| | | |
| | | //读取响应 |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader( |
| | | connection.getInputStream())); |
| | | String lines; |
| | | StringBuffer sb = new StringBuffer(""); |
| | | while ((lines = reader.readLine()) != null) { |
| | | lines = new String(lines.getBytes(), "utf-8"); |
| | | sb.append(lines); |
| | | } |
| | | System.out.println(sb.toString()); |
| | | result = 1; |
| | | }catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | }catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 修改信息 |
| | | * @param WaitPakOutEntity |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/upWaitPakOut.action") |
| | | public Integer upWaitPakOut(WaitPakOutBean waitPakOut,HttpServletRequest request){ |
| | | int result = 0; |
| | | try { |
| | | UserBean user=(UserBean)request.getSession().getAttribute("USER"); |
| | | waitPakOut.setModi_user(user.getUser_account()); |
| | | |
| | | result=waitPakOutService.upWaitPakOut(waitPakOut,1); |
| | | if(result>0) { |
| | | // 插入日志 |
| | | connection.setRequestProperty("x-csrf-token", token); |
| | | |
| | | //POST请求 |
| | | OutputStream out = connection.getOutputStream(); |
| | | out.write(buff); |
| | | out.close(); |
| | | |
| | | //读取响应 |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader( |
| | | connection.getInputStream())); |
| | | String lines; |
| | | StringBuffer sb = new StringBuffer(""); |
| | | while ((lines = reader.readLine()) != null) { |
| | | lines = new String(lines.getBytes(), "utf-8"); |
| | | sb.append(lines); |
| | | } |
| | | System.out.println(sb.toString()); |
| | | result = 1; |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 修改信息 |
| | | * |
| | | * @param WaitPakOutEntity |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/upWaitPakOut.action") |
| | | public Integer upWaitPakOut(WaitPakOutBean waitPakOut, HttpServletRequest request) { |
| | | int result = 0; |
| | | try { |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | waitPakOut.setModi_user(user.getUser_account()); |
| | | |
| | | result = waitPakOutService.upWaitPakOut(waitPakOut, 1); |
| | | if (result > 0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("upWaitPakOut.action"); |
| | | sysLog.setTts_keyname("修改出库通知档:" + waitPakOut.getSheet_no()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 删除信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/delWaitPakOut.action") |
| | | public int delWaitPakOut(WaitPakOutBean waitPakout,HttpServletRequest request){ |
| | | int result = 0; |
| | | try { |
| | | result=waitPakOutService.delWaitPakOut(waitPakout); |
| | | |
| | | if(result>0) { |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("delWaitPakOut.action"); |
| | | sysLog.setTts_keyname("删除通知档资料:" + waitPakout.getLgnum() + "-" + waitPakout.getTanum()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/getWaitPakOut.action") |
| | | public List<WaitPakOutBean> getWaitPakOut(){ |
| | | try { |
| | | return waitPakOutService.getWaitPakOutList(); |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通知档资料转历史档 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/movePakOutToLog.action") |
| | | public int movePakOutToLog(@RequestParam("ids")String[] sheetNos,@RequestParam("matStr")String[] matNos, |
| | | @RequestParam("locStr")String[] locNos,HttpServletRequest request){ |
| | | int result = 0; |
| | | try { |
| | | String sheet_no="", mat_no="",loc_no=""; |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("upWaitPakOut.action"); |
| | | sysLog.setTts_keyname("修改出库通知档:" + waitPakOut.getSheet_no()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 删除信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/delWaitPakOut.action") |
| | | public int delWaitPakOut(WaitPakOutBean waitPakout, HttpServletRequest request) { |
| | | int result = 0; |
| | | try { |
| | | result = waitPakOutService.delWaitPakOut(waitPakout); |
| | | |
| | | if (result > 0) { |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("delWaitPakOut.action"); |
| | | sysLog.setTts_keyname("删除通知档资料:" + waitPakout.getLgnum() + "-" + waitPakout.getTanum()); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有 |
| | | * |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/getWaitPakOut.action") |
| | | public List<WaitPakOutBean> getWaitPakOut() { |
| | | try { |
| | | return waitPakOutService.getWaitPakOutList(); |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通知档资料转历史档 |
| | | * |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/movePakOutToLog.action") |
| | | public int movePakOutToLog(@RequestParam("ids") String[] sheetNos, @RequestParam("matStr") String[] matNos, |
| | | @RequestParam("locStr") String[] locNos, HttpServletRequest request) { |
| | | int result = 0; |
| | | try { |
| | | String sheet_no = "", mat_no = "", loc_no = ""; |
| | | // for(int i=0;i<sheetNos.length;i++) { |
| | | // result=waitPakOutService.moveToLog(sheetNos[i], matNos[i]); |
| | | // } |
| | | for(int i=0;i<matNos.length;i++) { |
| | | mat_no = matNos[i]; |
| | | sheet_no=sheetNos[i]; |
| | | loc_no=locNos[i]; |
| | | LocationBean location = locationService.queryLocationById(loc_no); |
| | | if(location!=null) { |
| | | location.setLoc_sts("F"); |
| | | result = locationService.upLocation(location); |
| | | } |
| | | if(result>0) { |
| | | WaitPakOutBean waitPakOut = new WaitPakOutBean(); |
| | | waitPakOut.setSheet_no(sheet_no); |
| | | waitPakOut.setMat_no(mat_no); |
| | | result = waitPakOutService.delWaitPakOut(waitPakOut); |
| | | } |
| | | } |
| | | if(result>0) { |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("movePakInToLog.action"); |
| | | sysLog.setTts_keyname("取消出库:" + sheet_no + "-" + mat_no); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 添加出库单 |
| | | * @param sheet_no |
| | | * @param locstr |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/addPakOutData.action") |
| | | public Map<String,Object> addPakOutData(@RequestParam("sheet_no")String sheet_no, |
| | | @RequestParam("locstr")String[] locstr,HttpServletRequest request) throws Exception{ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | try { |
| | | UserBean user=(UserBean)request.getSession().getAttribute("USER"); |
| | | if(locstr!=null) { |
| | | for(String ids:locstr) { |
| | | String[] arr = ids.split(";"); |
| | | if(arr==null || arr.length<2) { |
| | | continue; |
| | | } |
| | | String loc_no = arr[0]; |
| | | String mat_no = arr[1]; |
| | | WaitPakOutBean waitPakOutBean = waitPakOutService.queryWaitPakOutByMatNo(mat_no); |
| | | if(waitPakOutBean!=null) {//待出库档中物料号已存在 |
| | | map.put("code", 1); |
| | | map.put("msg", "出库档中物料号已存在"); |
| | | continue; |
| | | } |
| | | LocationBean location = locationService.queryLocationById(loc_no); |
| | | if(location==null || !location.getLoc_sts().equals("F")){ |
| | | map.put("code", 1); |
| | | map.put("msg", "库位不是在库状态"); |
| | | continue; |
| | | } |
| | | |
| | | //插入出库通知档,更新库存库位状态 |
| | | WaitPakOutBean waitPakOut = new WaitPakOutBean(); |
| | | waitPakOut.setSheet_no(sheet_no); |
| | | waitPakOut.setLoc_no(loc_no); |
| | | waitPakOut.setCtns(13); //代替优先级 |
| | | waitPakOut.setIo_status("1"); |
| | | waitPakOut.setMemo(DateTimeUtil.getStringDateTime(10)); |
| | | waitPakOut.setMat_no(mat_no); |
| | | waitPakOut.setModi_user(user.getUser_account()); |
| | | int result = waitPakOutService.insertWaitPakOut(waitPakOut); |
| | | if(result>0) { |
| | | location.setLoc_sts("L"); |
| | | result=locationService.upLocation(location); |
| | | if(result>0) { |
| | | map.put("code", 0); |
| | | map.put("msg", ""); |
| | | } |
| | | }else { |
| | | map.put("code", 1); |
| | | map.put("msg", "添加到出库单失败"); |
| | | continue; |
| | | } |
| | | } |
| | | }else { |
| | | map.put("code", 1); |
| | | map.put("msg", "没有选择库位"); |
| | | return map; |
| | | } |
| | | |
| | | if((Integer)map.get("code")==0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("addPakOutData.action"); |
| | | sysLog.setTts_keyname("添加出库单"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(RuntimeException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 出库启动 |
| | | * @param ids |
| | | * @param locstr |
| | | * @param stn_no |
| | | * @param stn_no1 |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/confirmRetrieve.action") |
| | | public Map<String,Object> confirmRetrieve(@RequestParam("ids")String[] ids,@RequestParam("locstr")String[] locstr, |
| | | @RequestParam("stn_no")int stn_no,HttpServletRequest request) throws Exception{ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | try { |
| | | CommonMethod commonMethod = new CommonMethod(workFileService,workNoService,crnService, |
| | | stationService,locationService,rowNoService,staDescService); |
| | | |
| | | UserBean user=(UserBean)request.getSession().getAttribute("USER"); |
| | | if(locstr!=null && ids!=null) { |
| | | for(String loc_no:locstr) { |
| | | LocationBean location = locationService.queryLocationById(loc_no); |
| | | if(location==null || !location.getLoc_sts().equals("L")){ |
| | | continue; |
| | | } |
| | | map = operateService.insertPakRetrieve1(loc_no, ids, stn_no, user, commonMethod); |
| | | } |
| | | }else { |
| | | map.put("code", 1); |
| | | map.put("msg", "没有选择出库库位"); |
| | | return map; |
| | | } |
| | | |
| | | if((Integer)map.get("code")==0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("confirmRetrieve.action"); |
| | | sysLog.setTts_keyname("启动出库"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(RuntimeException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | for (int i = 0; i < matNos.length; i++) { |
| | | mat_no = matNos[i]; |
| | | sheet_no = sheetNos[i]; |
| | | loc_no = locNos[i]; |
| | | LocationBean location = locationService.queryLocationById(loc_no); |
| | | if (location != null) { |
| | | location.setLoc_sts("F"); |
| | | result = locationService.upLocation(location); |
| | | } |
| | | if (result > 0) { |
| | | WaitPakOutBean waitPakOut = new WaitPakOutBean(); |
| | | waitPakOut.setSheet_no(sheet_no); |
| | | waitPakOut.setMat_no(mat_no); |
| | | result = waitPakOutService.delWaitPakOut(waitPakOut); |
| | | } |
| | | } |
| | | if (result > 0) { |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("movePakInToLog.action"); |
| | | sysLog.setTts_keyname("取消出库:" + sheet_no + "-" + mat_no); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 调整优先级 |
| | | * @param locstr |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/addDataIopri.action") |
| | | public Map<String,Object> addDataIopri(@RequestParam("pri")String pri, |
| | | @RequestParam("locstr")String[] locstr,HttpServletRequest request) throws Exception{ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | try { |
| | | UserBean user=(UserBean)request.getSession().getAttribute("USER"); |
| | | if(locstr!=null) { |
| | | for(String ids:locstr) { |
| | | String[] arr = ids.split(";"); |
| | | if(arr==null || arr.length<2) { |
| | | continue; |
| | | } |
| | | String loc_no = arr[0]; |
| | | String mat_no = arr[1]; |
| | | WaitPakOutBean waitPakOutBean = waitPakOutService.queryWaitPakOutByMatNo(mat_no); |
| | | if(waitPakOutBean!=null) {//待出库档中物料号已存在 |
| | | int ctns = waitPakOutBean.getCtns() + Integer.parseInt(pri); |
| | | waitPakOutBean.setCtns(ctns); |
| | | int result = waitPakOutService.upWaitPakOut(waitPakOutBean,2); |
| | | if(result>0) { |
| | | map.put("code", 0); |
| | | map.put("msg", "调整成功"); |
| | | }else { |
| | | map.put("code", 1); |
| | | map.put("msg", "出库档中物料号已存在"); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | } |
| | | }else { |
| | | map.put("code", 1); |
| | | map.put("msg", "没有选择库位"); |
| | | return map; |
| | | } |
| | | |
| | | if((Integer)map.get("code")==0) { |
| | | // 插入日志 |
| | | /** |
| | | * 添加出库单 |
| | | * |
| | | * @param sheet_no |
| | | * @param locstr |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/addPakOutData.action") |
| | | public Map<String, Object> addPakOutData(@RequestParam("sheet_no") String sheet_no, |
| | | @RequestParam("locstr") String[] locstr, HttpServletRequest request) throws Exception { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | try { |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | if (locstr != null) { |
| | | for (String ids : locstr) { |
| | | String[] arr = ids.split(";"); |
| | | if (arr == null || arr.length < 2) { |
| | | continue; |
| | | } |
| | | String loc_no = arr[0]; |
| | | String mat_no = arr[1]; |
| | | WaitPakOutBean waitPakOutBean = waitPakOutService.queryWaitPakOutByMatNo(mat_no); |
| | | if (waitPakOutBean != null) {//待出库档中物料号已存在 |
| | | map.put("code", 1); |
| | | map.put("msg", "出库档中物料号已存在"); |
| | | continue; |
| | | } |
| | | LocationBean location = locationService.queryLocationById(loc_no); |
| | | if (location == null || !location.getLoc_sts().equals("F")) { |
| | | map.put("code", 1); |
| | | map.put("msg", "库位不是在库状态"); |
| | | continue; |
| | | } |
| | | |
| | | //插入出库通知档,更新库存库位状态 |
| | | WaitPakOutBean waitPakOut = new WaitPakOutBean(); |
| | | waitPakOut.setSheet_no(sheet_no); |
| | | waitPakOut.setLoc_no(loc_no); |
| | | waitPakOut.setCtns(13); //代替优先级 |
| | | waitPakOut.setIo_status("1"); |
| | | waitPakOut.setMemo(DateTimeUtil.getStringDateTime(10)); |
| | | waitPakOut.setMat_no(mat_no); |
| | | waitPakOut.setModi_user(user.getUser_account()); |
| | | int result = waitPakOutService.insertWaitPakOut(waitPakOut); |
| | | if (result > 0) { |
| | | location.setLoc_sts("L"); |
| | | result = locationService.upLocation(location); |
| | | if (result > 0) { |
| | | map.put("code", 0); |
| | | map.put("msg", ""); |
| | | } |
| | | } else { |
| | | map.put("code", 1); |
| | | map.put("msg", "添加到出库单失败"); |
| | | continue; |
| | | } |
| | | } |
| | | } else { |
| | | map.put("code", 1); |
| | | map.put("msg", "没有选择库位"); |
| | | return map; |
| | | } |
| | | |
| | | if ((Integer) map.get("code") == 0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("addDataIopri.action"); |
| | | sysLog.setTts_keyname("调整优先级"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | }catch(RuntimeException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有单号 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/getSheetNo.action") |
| | | public Map<String,Object> getSheetNo(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | try { |
| | | map.put("rows",waitPakOutService.getSheetNoList()); |
| | | }catch(Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("addPakOutData.action"); |
| | | sysLog.setTts_keyname("添加出库单"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (RuntimeException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 出库启动 |
| | | * |
| | | * @param ids |
| | | * @param locstr |
| | | * @param stn_no |
| | | * @param stn_no1 |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/confirmRetrieve.action") |
| | | public Map<String, Object> confirmRetrieve(@RequestParam("ids") String[] ids, @RequestParam("locstr") String[] locstr, |
| | | @RequestParam("stn_no") int stn_no, HttpServletRequest request) throws Exception { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | try { |
| | | CommonMethod commonMethod = new CommonMethod(workFileService, workNoService, crnService, |
| | | stationService, locationService, rowNoService, staDescService); |
| | | |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | if (locstr != null && ids != null) { |
| | | for (String loc_no : locstr) { |
| | | LocationBean location = locationService.queryLocationById(loc_no); |
| | | if (location == null || !location.getLoc_sts().equals("L")) { |
| | | continue; |
| | | } |
| | | map = operateService.insertPakRetrieve1(loc_no, ids, stn_no, user, commonMethod); |
| | | } |
| | | } else { |
| | | map.put("code", 1); |
| | | map.put("msg", "没有选择出库库位"); |
| | | return map; |
| | | } |
| | | |
| | | if ((Integer) map.get("code") == 0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("confirmRetrieve.action"); |
| | | sysLog.setTts_keyname("启动出库"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (RuntimeException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 调整优先级 |
| | | * |
| | | * @param locstr |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/addDataIopri.action") |
| | | public Map<String, Object> addDataIopri(@RequestParam("pri") String pri, |
| | | @RequestParam("locstr") String[] locstr, HttpServletRequest request) throws Exception { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | try { |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | if (locstr != null) { |
| | | for (String ids : locstr) { |
| | | String[] arr = ids.split(";"); |
| | | if (arr == null || arr.length < 2) { |
| | | continue; |
| | | } |
| | | String loc_no = arr[0]; |
| | | String mat_no = arr[1]; |
| | | WaitPakOutBean waitPakOutBean = waitPakOutService.queryWaitPakOutByMatNo(mat_no); |
| | | if (waitPakOutBean != null) {//待出库档中物料号已存在 |
| | | int ctns = waitPakOutBean.getCtns() + Integer.parseInt(pri); |
| | | waitPakOutBean.setCtns(ctns); |
| | | int result = waitPakOutService.upWaitPakOut(waitPakOutBean, 2); |
| | | if (result > 0) { |
| | | map.put("code", 0); |
| | | map.put("msg", "调整成功"); |
| | | } else { |
| | | map.put("code", 1); |
| | | map.put("msg", "出库档中物料号已存在"); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | map.put("code", 1); |
| | | map.put("msg", "没有选择库位"); |
| | | return map; |
| | | } |
| | | |
| | | if ((Integer) map.get("code") == 0) { |
| | | // 插入日志 |
| | | // UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("addDataIopri.action"); |
| | | sysLog.setTts_keyname("调整优先级"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | } |
| | | } catch (RuntimeException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有单号 |
| | | * |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/getSheetNo.action") |
| | | public Map<String, Object> getSheetNo() { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | try { |
| | | map.put("rows", waitPakOutService.getSheetNoList()); |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 导出所有 |
| | | * @param response |
| | | */ |
| | | @RequestMapping("/exportWaitPakOut.action") |
| | | public void ExportExcel(WaitPakOutCondition waitPakOutCondition, HttpServletResponse response, HttpServletRequest request){ |
| | | try { |
| | | waitPakOutService.ExportWaitPakOutList(waitPakOutCondition,response); |
| | | |
| | | // 插入日志 |
| | | UserBean user = (UserBean) request.getSession().getAttribute("USER"); |
| | | SysLogBean sysLog = new SysLogBean(); |
| | | sysLog.setLogin_no(user.getUser_account()); |
| | | sysLog.setMachine_ip(request.getRemoteAddr()); |
| | | sysLog.setForm_no("exportWaitPakOut.action"); |
| | | sysLog.setTts_keyname("导出出库通知档到EXCEL"); |
| | | sysLog.setModi_user(user.getUser_account()); |
| | | sysLogService.insertSysLog(sysLog); |
| | | }catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |