| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | |
| | | import com.ruili.wcp.common.StringUtil; |
| | | import com.ruili.wcp.data.entity.config.View; |
| | | import com.ruili.wcp.data.entity.management.User; |
| | | import com.ruili.wcp.engine.form.IFormData; |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 归还扫描 |
| | | * @Date 2020/12/12 |
| | | **/ |
| | | @RequestMapping(value = "/returnScanPrint") |
| | | public ModelAndView returnScanPrint(Long viewId) { |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | modelAndView.setViewName("scanPrint/returnPrint"); |
| | | modelAndView.addObject("viewId", viewId); |
| | | |
| | | modelAndView.addObject("printType", 2); |
| | | return modelAndView; |
| | | } |
| | | |
| | | /** |
| | | * @Description 入库扫描 |
| | | * @Date 2020/12/12 |
| | | **/ |
| | | @RequestMapping(value = "/inScanPrint") |
| | | public ModelAndView inScanPrint(Long viewId) { |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | modelAndView.setViewName("scanPrint/scanPrint"); |
| | | modelAndView.setViewName("scanPrint/scanInPrint"); |
| | | modelAndView.addObject("viewId", viewId); |
| | | modelAndView.addObject("printType", 0); |
| | | return modelAndView; |
| | |
| | | @RequestMapping(value = "/saveScanPrintData") |
| | | @RequiresUser |
| | | @ResponseBody |
| | | public Object saveScanPrintData(@RequestBody List<Map<String, Object>> data, int printType, Long viewId) { |
| | | public Object saveScanPrintData(@RequestBody List<Map<String, Object>> data, int printType, Long viewId, String boxNum) { |
| | | Subject currentUser = SecurityUtils.getSubject(); |
| | | Session session = currentUser.getSession(); |
| | | User user = (User) session.getAttribute("user"); |
| | | |
| | | |
| | | View view = viewService.getViewById(viewId); |
| | | String mainTableName = view.getMainTableName(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if (data != null && data.size() > 0) { |
| | | if (printType == 0) { //入库扫描 |
| | | updateWarehousing(mainTableName, data); |
| | | try { |
| | | View view = viewService.getViewById(viewId); |
| | | String mainTableName = view.getMainTableName(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if (data != null && data.size() > 0) { |
| | | if (printType == 0) { //入库扫描 |
| | | updateWarehousing(data, boxNum); |
| | | } |
| | | if (printType == 1) { //出库 |
| | | outWarehousing(data); |
| | | } |
| | | if (printType == 2) { //归还 |
| | | returnWarehousing(data); |
| | | } |
| | | } |
| | | if (printType == 1) { //出库 |
| | | outWarehousing(data); |
| | | } |
| | | } catch (Exception e) { |
| | | return new AjaxResponse(false); |
| | | } |
| | | return new AjaxResponse(true); |
| | | } |
| | |
| | | * @Description 入库 |
| | | * @Date 2020/12/13 |
| | | **/ |
| | | private void updateWarehousing(String tableName, List<Map<String, Object>> data) { |
| | | private void updateWarehousing(List<Map<String, Object>> data, String boxNum) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | StringBuilder sql = new StringBuilder("UPDATE " + tableName + " SET IN_STATUS_CODE=0, IN_STATUS='已入库', IN_TIME=TO_DATE('" + sdf.format(new Date()) + "', 'yyyy-mm-dd hh24:mi:ss') WHERE ARCHIVAL_CODE IN ("); |
| | | //更新出库状态 |
| | | for (int i = 0; i < data.size(); i++) { |
| | | String archivalCode = (String) data.get(i).get("archival_code"); |
| | | if (archivalCode != null) { |
| | | sql.append("'" + archivalCode + "'"); |
| | | if (i < data.size() - 1) { |
| | | sql.append(","); |
| | | } |
| | | String sqlSelect = "select * from BUS_PACKING_MANAGE where ITEM_NUM = '" + archivalCode + "'"; |
| | | Map<String, Object> packingMap = jdbcTemplate.queryForMap(sqlSelect); |
| | | |
| | | long itemId = Long.parseLong(packingMap.get("ITEM_ID").toString()); |
| | | String sql = "select * from BUS_WAREHOUSING where item_id =" + itemId + " and IN_STATUS_CODE =2"; |
| | | List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql); |
| | | if (mapList.size() > 0) { |
| | | Map<String, Object> map = mapList.get(0); |
| | | |
| | | |
| | | Date date = new Date(); |
| | | String format = sdf.format(date); |
| | | HashMap<String, Object> mapData = new HashMap<>(); |
| | | mapData.put("IN_STATUS_CODE", 3); |
| | | mapData.put("OUT_STATUS", "已入库"); |
| | | mapData.put("IN_TIME", format); |
| | | iFormData.update(1972515952908148738L, mapData, Long.parseLong(map.get("ID").toString())); |
| | | |
| | | String sqlUpdateBox = "update BUS_PACKING_MANAGE SET BOX_NUMBER='" + boxNum + "', ITEM_STATE='已入库' WHERE ID=" + packingMap.get("ID"); |
| | | jdbcTemplate.update(sqlUpdateBox); |
| | | } |
| | | } |
| | | sql.append(")"); |
| | | jdbcTemplate.update(sql.toString()); |
| | | } |
| | | |
| | | /** |
| | | * @Description 归还 |
| | | * @Date 2020/12/13 |
| | | **/ |
| | | private void returnWarehousing(List<Map<String, Object>> data) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //更新出库状态 |
| | | for (int i = 0; i < data.size(); i++) { |
| | | String archivalCode = (String) data.get(i).get("archival_code"); |
| | | String sqlSelect = "select * from BUS_PACKING_MANAGE where ITEM_NUM = '" + archivalCode + "'"; |
| | | Map<String, Object> packingMap = jdbcTemplate.queryForMap(sqlSelect); |
| | | |
| | | long itemId = Long.parseLong(packingMap.get("ITEM_ID").toString()); |
| | | String sql = "select * from BUS_WAREHOUSING where item_id =" + itemId + " and IN_STATUS_CODE =1"; |
| | | List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql); |
| | | if (mapList.size() > 0) { |
| | | Map<String, Object> map = mapList.get(0); |
| | | Date date = new Date(); |
| | | String format = sdf.format(date); |
| | | String sqlUpdate = "update BUS_WAREHOUSING SET IN_STATUS_CODE=2, OUT_STATUS='待入库', IN_TIME='" + format + "' WHERE ID=" + map.get("ID"); |
| | | jdbcTemplate.update(sqlUpdate); |
| | | |
| | | String sqlUpdateBox = "update BUS_PACKING_MANAGE SET ITEM_STATE='已归还' WHERE ID=" + packingMap.get("ID"); |
| | | jdbcTemplate.update(sqlUpdateBox); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | for (int i = 0; i < data.size(); i++) { |
| | | String archivalCode = (String) data.get(i).get("archival_code"); |
| | | String sqlSelect = "select * from BUS_PACKING_MANAGE where ITEM_NUM = '" + archivalCode + "'"; |
| | | Map<String, Object> packingMap = jdbcTemplate.queryForMap(sqlSelect); |
| | | List<Map<String, Object>> mapList1 = jdbcTemplate.queryForList(sqlSelect); |
| | | Map<String, Object> packingMap = null; |
| | | if (mapList1.size() > 0) { |
| | | packingMap = mapList1.get(0); |
| | | } |
| | | |
| | | long itemId = Long.parseLong(packingMap.get("ITEM_ID").toString()); |
| | | String sql = "select * from BUS_WAREHOUSING where item_id =" + itemId + " and IN_STATUS_CODE =0"; |
| | | List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql); |
| | | if (mapList.size() >= 0) { |
| | | if (mapList.size() > 0) { |
| | | Map<String, Object> map = mapList.get(0); |
| | | |
| | | String boxNumber = packingMap.get("BOX_NUMBER") == null ? "" : packingMap.get("BOX_NUMBER").toString(); |
| | | String storageLocation = packingMap.get("STORAGE_LOCATION") == null ? "" : packingMap.get("STORAGE_LOCATION").toString(); |
| | | Date date = new Date(); |
| | | String format = sdf.format(date); |
| | | String sqlUpdate = "update BUS_WAREHOUSING SET OUT_STATUS_CODE=1, OUT_STATUS='已出库', OUT_TIME='" + format + "' WHERE ID=" + map.get("ID"); |
| | | jdbcTemplate.update(sqlUpdate); |
| | | HashMap<String, Object> mapData = new HashMap<>(); |
| | | mapData.put("IN_STATUS_CODE", 1); |
| | | mapData.put("OUT_STATUS", "已出库"); |
| | | mapData.put("OUT_TIME", format); |
| | | mapData.put("BOX_NUM", boxNumber); |
| | | mapData.put("LOCATION_NUMBER", storageLocation); |
| | | iFormData.update(1972515952908148738L, mapData, Long.parseLong(map.get("ID").toString())); |
| | | |
| | | String sqlUpdateBox = "update BUS_PACKING_MANAGE SET ITEM_STATE='借出' WHERE ID=" + packingMap.get("ID"); |
| | | jdbcTemplate.update(sqlUpdateBox); |