From df59eb0cb24f028040a01a619e4343de6438549d Mon Sep 17 00:00:00 2001 From: e Date: Fri, 3 Jan 2020 08:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A2=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wave/controller/WaveToDownController.java | 87 ++++++++++++------- .../wave/controller/WaveToFjController.java | 54 +++++++----- 2 files changed, 89 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/zzjee/wave/controller/WaveToDownController.java b/src/main/java/com/zzjee/wave/controller/WaveToDownController.java index f6c245b7..6fce97c8 100644 --- a/src/main/java/com/zzjee/wave/controller/WaveToDownController.java +++ b/src/main/java/com/zzjee/wave/controller/WaveToDownController.java @@ -1,4 +1,5 @@ package com.zzjee.wave.controller; +import com.zzjee.api.ResultDO; import com.zzjee.wave.entity.WaveToDownEntity; import com.zzjee.wave.service.WaveToDownServiceI; import java.util.ArrayList; @@ -7,12 +8,14 @@ import java.text.SimpleDateFormat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.zzjee.wm.entity.WmOmQmIEntity; +import com.zzjee.wm.entity.WmToDownGoodsEntity; import org.apache.log4j.Logger; +import org.jeecgframework.core.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import org.jeecgframework.core.common.controller.BaseController; @@ -22,14 +25,12 @@ import org.jeecgframework.core.common.model.common.TreeChildCount; import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.constant.Globals; -import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.web.system.pojo.base.TSDepart; import org.jeecgframework.web.system.service.SystemService; -import org.jeecgframework.core.util.MyBeanUtils; import java.io.OutputStream; -import org.jeecgframework.core.util.BrowserUtils; + import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -38,23 +39,19 @@ import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.jeecgframework.core.util.ResourceUtil; + import java.io.IOException; -import org.springframework.web.bind.annotation.RequestMethod; + import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import java.util.Map; import java.util.HashMap; -import org.jeecgframework.core.util.ExceptionUtil; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.jeecgframework.core.beanvalidator.BeanValidators; @@ -342,29 +339,59 @@ public class WaveToDownController extends BaseController { List listWaveToDowns=waveToDownService.getList(WaveToDownEntity.class); return listWaveToDowns; } - - @RequestMapping(value = "/{id}", method = RequestMethod.GET) - @ResponseBody - public ResponseEntity get(@PathVariable("id") String id) { - WaveToDownEntity task = waveToDownService.get(WaveToDownEntity.class, id); - if (task == null) { - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - return new ResponseEntity(task, HttpStatus.OK); - } - @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public ResponseEntity create(@RequestBody WaveToDownEntity waveToDown, UriComponentsBuilder uriBuilder) { - //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. - Set> failures = validator.validate(waveToDown); - if (!failures.isEmpty()) { - return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); - } + @RequestMapping(value = "/list/todown", method = RequestMethod.GET) + @ResponseBody + public ResponseEntity list(@RequestParam(value="username", required=false) String username, + @RequestParam(value="searchstr", required=false)String searchstr, + @RequestParam(value="searchstr2", required=false)String searchstr2) { + ResultDO D0 = new ResultDO(); + D0.setOK(true); + + List listWaveToDowns=waveToDownService.getList(WaveToDownEntity.class); + D0.setObj(listWaveToDowns); + return new ResponseEntity(D0, HttpStatus.OK); + } + + @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public ResponseEntity create(@RequestParam String waveToDownstr ,UriComponentsBuilder uriBuilder) { + //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + + ResultDO D0 = new ResultDO(); + + //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + WaveToDownEntity waveToDown = (WaveToDownEntity)JSONHelper.json2Object(waveToDownstr,WaveToDownEntity.class); //保存 try{ - waveToDownService.save(waveToDown); + String hql = "from WmOmQmIEntity where waveId = ? and goodsId = ? and proData = ? and tinId = ? and binId = ? and binSta = ?"; + List listwavedown = systemService.findHql(hql,waveToDown.getWaveId(),waveToDown.getGoodsId(),waveToDown.getProData(),waveToDown.getTinId(),waveToDown.getBinId(),"N"); + + for(WmOmQmIEntity wmOmQmI: listwavedown){ + WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity(); + wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘 + wmToDownGoods.setKuWeiBianMa(wmOmQmI.getBinId());//储位 + wmToDownGoods.setBinIdTo(wmOmQmI.getOmNoticeId());//到托盘 + wmToDownGoods.setCusCode(wmOmQmI.getCusCode());//货主 + wmToDownGoods.setGoodsId(wmOmQmI.getGoodsId());// + wmToDownGoods.setGoodsProData(wmOmQmI.getProData());//生产日期 + wmToDownGoods.setOrderId(wmOmQmI.getOmNoticeId());//出货通知单 + wmToDownGoods.setOrderIdI(wmOmQmI.getId());//出货通知项目 + wmToDownGoods.setBaseUnit(wmOmQmI.getBaseUnit());//基本单位 + wmToDownGoods.setBaseGoodscount(wmOmQmI.getBaseGoodscount());//基本单位数量 + wmToDownGoods.setGoodsUnit(wmOmQmI.getGoodsUnit());//出货单位 + wmToDownGoods.setGoodsQua(wmOmQmI.getQmOkQuat());//出货数量 + wmToDownGoods.setGoodsQuaok(wmOmQmI.getQmOkQuat());//出货数量 + wmToDownGoods.setGoodsName(wmOmQmI.getGoodsName());//商品名称 + wmToDownGoods.setOmBeizhu(wmOmQmI.getOmBeizhu());//备注 + wmToDownGoods.setImCusCode(wmOmQmI.getImCusCode());//客户单号 + wmToDownGoods.setOrderType("01");//默认为01 + systemService.save(wmToDownGoods); + wmOmQmI.setBinSta("H"); + systemService.saveOrUpdate(wmOmQmI); + } + } catch (Exception e) { e.printStackTrace(); return new ResponseEntity(HttpStatus.NO_CONTENT); diff --git a/src/main/java/com/zzjee/wave/controller/WaveToFjController.java b/src/main/java/com/zzjee/wave/controller/WaveToFjController.java index 3ad49f3c..e805b9e0 100644 --- a/src/main/java/com/zzjee/wave/controller/WaveToFjController.java +++ b/src/main/java/com/zzjee/wave/controller/WaveToFjController.java @@ -1,4 +1,5 @@ package com.zzjee.wave.controller; +import com.zzjee.api.ResultDO; import com.zzjee.wave.entity.WaveToFjEntity; import com.zzjee.wave.service.WaveToFjServiceI; import java.util.ArrayList; @@ -7,12 +8,14 @@ import java.text.SimpleDateFormat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.zzjee.wm.entity.WmOmQmIEntity; +import com.zzjee.wm.entity.WmToDownGoodsEntity; import org.apache.log4j.Logger; +import org.jeecgframework.core.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import org.jeecgframework.core.common.controller.BaseController; @@ -22,14 +25,12 @@ import org.jeecgframework.core.common.model.common.TreeChildCount; import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.constant.Globals; -import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.web.system.pojo.base.TSDepart; import org.jeecgframework.web.system.service.SystemService; -import org.jeecgframework.core.util.MyBeanUtils; import java.io.OutputStream; -import org.jeecgframework.core.util.BrowserUtils; + import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -38,23 +39,19 @@ import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.jeecgframework.core.util.ResourceUtil; + import java.io.IOException; -import org.springframework.web.bind.annotation.RequestMethod; + import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import java.util.Map; import java.util.HashMap; -import org.jeecgframework.core.util.ExceptionUtil; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.jeecgframework.core.beanvalidator.BeanValidators; @@ -342,7 +339,19 @@ public class WaveToFjController extends BaseController { List listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class); return listWaveToFjs; } - + @RequestMapping(value = "/list/tofj", method = RequestMethod.GET) + @ResponseBody + public ResponseEntity list(@RequestParam(value="username", required=false) String username, + @RequestParam(value="searchstr", required=false)String searchstr, + @RequestParam(value="searchstr2", required=false)String searchstr2) { + ResultDO D0 = new ResultDO(); + D0.setOK(true); + + List listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class); + + D0.setObj(listWaveToFjs); + return new ResponseEntity(D0, HttpStatus.OK); + } @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public ResponseEntity get(@PathVariable("id") String id) { @@ -353,24 +362,25 @@ public class WaveToFjController extends BaseController { return new ResponseEntity(task, HttpStatus.OK); } + @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - public ResponseEntity create(@RequestBody WaveToFjEntity waveToFj, UriComponentsBuilder uriBuilder) { + public ResponseEntity create(@RequestParam String waveToFjstr , UriComponentsBuilder uriBuilder) { + ResultDO D0 = new ResultDO(); //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. - Set> failures = validator.validate(waveToFj); - if (!failures.isEmpty()) { - return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); - } - + WaveToFjEntity waveToFj = (WaveToFjEntity)JSONHelper.json2Object(waveToFjstr,WaveToFjEntity.class); //保存 try{ - waveToFjService.save(waveToFj); - } catch (Exception e) { + WmOmQmIEntity wmOmQmI = systemService.getEntity( + WmOmQmIEntity.class, waveToFj.getId()); + if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("H")) { + wmOmQmI.setBinSta("Y"); + systemService.saveOrUpdate(wmOmQmI); + } + } catch (Exception e) { e.printStackTrace(); return new ResponseEntity(HttpStatus.NO_CONTENT); } - - return new ResponseEntity(waveToFj, HttpStatus.OK); }