From f25c800bca726b67ea74e6ed576b038b1b9561a7 Mon Sep 17 00:00:00 2001 From: 18516761980 <4761516tqsxp> Date: 星期一, 16 八月 2021 08:22:57 +0800 Subject: [PATCH] # --- src/main/java/com/slcf/controller/WaitPakOutController.java | 1219 ++++++++++++++++++++++++++++++--------------------------- 1 files changed, 634 insertions(+), 585 deletions(-) diff --git a/src/main/java/com/slcf/controller/WaitPakOutController.java b/src/main/java/com/slcf/controller/WaitPakOutController.java index 350b0db..d4ded6b 100644 --- a/src/main/java/com/slcf/controller/WaitPakOutController.java +++ b/src/main/java/com/slcf/controller/WaitPakOutController.java @@ -5,6 +5,7 @@ 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; @@ -12,11 +13,10 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +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; @@ -49,6 +49,7 @@ /** * 鍑哄簱閫氱煡妗f帶鍒跺櫒灞� + * * @author admin * @date 2018骞�11鏈�21鏃� */ @@ -56,150 +57,189 @@ @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; + } + + /** + * 鍑哄簱閫氱煡妗h缃换鍔′负绱ф�ョ姸鎬� + * + * @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", "浠e彿鍙敤"); - 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", "浠e彿鍙敤"); + 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; + } + } + // /** // * 楠岃瘉宸ヤ綔浠e彿鏄惁鍞竴 // * @param did @@ -222,467 +262,476 @@ // } // return map; // } - - /** - * 鎵嬪伐瀹岀粨鍏ュ簱閫氱煡妗o紝鍙嶉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); + + /** + * 鎵嬪伐瀹岀粨鍏ュ簱閫氱煡妗o紝鍙嶉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; - } - - /** - * 鍑哄簱瀹屾垚锛岃皟鐢╯ap鎺ュ彛涓婁紶瀹屾垚淇℃伅 - */ - 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; + } + + /** + * 鍑哄簱瀹屾垚锛岃皟鐢╯ap鎺ュ彛涓婁紶瀹屾垚淇℃伅 + */ + 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("鍒犻櫎閫氱煡妗h祫鏂�:" + 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; - } - } - - /** - * 閫氱煡妗h祫鏂欒浆鍘嗗彶妗� - * @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("鍒犻櫎閫氱煡妗h祫鏂�:" + 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; + } + } + + /** + * 閫氱煡妗h祫鏂欒浆鍘嗗彶妗� + * + * @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", "鍑哄簱妗d腑鐗╂枡鍙峰凡瀛樺湪"); - continue; - } - LocationBean location = locationService.queryLocationById(loc_no); - if(location==null || !location.getLoc_sts().equals("F")){ - map.put("code", 1); - map.put("msg", "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��"); - continue; - } - - //鎻掑叆鍑哄簱閫氱煡妗o紝鏇存柊搴撳瓨搴撲綅鐘舵�� - WaitPakOutBean waitPakOut = new WaitPakOutBean(); - waitPakOut.setSheet_no(sheet_no); - waitPakOut.setLoc_no(loc_no); - waitPakOut.setCtns(13); //浠f浛浼樺厛绾� - 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", "鍑哄簱妗d腑鐗╂枡鍙峰凡瀛樺湪"); - 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", "鍑哄簱妗d腑鐗╂枡鍙峰凡瀛樺湪"); + continue; + } + LocationBean location = locationService.queryLocationById(loc_no); + if (location == null || !location.getLoc_sts().equals("F")) { + map.put("code", 1); + map.put("msg", "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��"); + continue; + } + + //鎻掑叆鍑哄簱閫氱煡妗o紝鏇存柊搴撳瓨搴撲綅鐘舵�� + WaitPakOutBean waitPakOut = new WaitPakOutBean(); + waitPakOut.setSheet_no(sheet_no); + waitPakOut.setLoc_no(loc_no); + waitPakOut.setCtns(13); //浠f浛浼樺厛绾� + 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", "鍑哄簱妗d腑鐗╂枡鍙峰凡瀛樺湪"); + 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; + } + } -- Gitblit v1.9.1