diff --git a/src/main/java/com/zzjee/wm/controller/WmOmQmIController.java b/src/main/java/com/zzjee/wm/controller/WmOmQmIController.java index d07d63d3..4c362a3a 100644 --- a/src/main/java/com/zzjee/wm/controller/WmOmQmIController.java +++ b/src/main/java/com/zzjee/wm/controller/WmOmQmIController.java @@ -448,9 +448,21 @@ public class WmOmQmIController extends BaseController { String message = null; AjaxJson j = new AjaxJson(); message = "下架成功"; + String id = request.getParameter("id").toString(); + boolean isok = todown(id); + if (!isok){ + j.setSuccess(isok); + message = "下架失败"; + } + j.setMsg(message); + return j; + } + + + public boolean todown(String id){ try { WmOmQmIEntity wmOmQmI = systemService.getEntity( - WmOmQmIEntity.class, request.getParameter("id").toString()); + WmOmQmIEntity.class, id); if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("N")) { WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity(); wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘 @@ -473,32 +485,22 @@ public class WmOmQmIController extends BaseController { systemService.save(wmToDownGoods); wmOmQmI.setBinSta("Y"); systemService.saveOrUpdate(wmOmQmI); - try{ + try{ String orderId = wmOmQmI.getOmNoticeId(); String type = "jh"; String username = ResourceUtil.getSessionUserName().getRealName(); updateUser(orderId,type,username); }catch (Exception e){ } - systemService.addLog(message, Globals.Log_Type_DEL, - Globals.Log_Leavel_INFO); + return true; } else { - j.setSuccess(false); - - message = "下架任务找不到"; + return false; } - } catch (Exception e) { - j.setSuccess(false); - e.printStackTrace(); - message = "下架失败"; - throw new BusinessException(e.getMessage()); + return false; } - j.setMsg(message); - return j; } - /** * 批量删除下架任务 * diff --git a/src/main/java/com/zzjee/wm/controller/WmToDownGoodsController.java b/src/main/java/com/zzjee/wm/controller/WmToDownGoodsController.java index 07bf4591..dfd4c0ab 100644 --- a/src/main/java/com/zzjee/wm/controller/WmToDownGoodsController.java +++ b/src/main/java/com/zzjee/wm/controller/WmToDownGoodsController.java @@ -17,6 +17,7 @@ import com.zzjee.wmapi.entity.WvGiNoticeEntity; import org.apache.commons.collections.CollectionUtils; import org.apache.log4j.Logger; import org.jeecgframework.core.util.*; +import org.jeecgframework.web.system.pojo.base.TSBaseUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -751,54 +752,15 @@ public class WmToDownGoodsController extends BaseController { } - try{ - t = systemService.get(WvGiNoticeEntity.class,wmToDownGoods.getOrderIdI()); - if(t!=null&&StringUtil.isEmpty(wmToDownGoods.getBinIdFrom())){ - wmToDownGoods.setGoodsName(t.getShpMingCheng()); - wmToDownGoods.setBinIdFrom(t.getTinId()); - } - }catch (Exception e){ - } // 保存 try { - wmToDownGoods.setCreateDate(DateUtils.getDate()); - if(wmUtil.checkstcokk(wmToDownGoods.getCusCode(),wmToDownGoods.getKuWeiBianMa(),wmToDownGoods.getBinIdFrom(),wmToDownGoods.getGoodsId(),wmToDownGoods.getGoodsProData(),wmToDownGoods.getBaseGoodscount())) - { - WmOmQmIEntity wmOmQmIEntity = systemService.get(WmOmQmIEntity.class,t.getId()); - wmToDownGoods.setImCusCode(wmOmQmIEntity.getImCusCode()); - wmToDownGoods.setOmBeizhu(wmOmQmIEntity.getOmBeizhu()); - - try{ - List wmToDownGoodslist1 = systemService.findByProperty(WmToDownGoodsEntity.class,"orderIdI",wmToDownGoods.getOrderIdI()); - if (wmToDownGoodslist1!=null&&wmToDownGoodslist1.size()>0){ - D0.setOK(false); - D0.setErrorMsg("重复保存"); - - return new ResponseEntity(D0,HttpStatus.OK); - } - }catch (Exception e){ - - } - - - - try{ - String orderId = wmOmQmIEntity.getOmNoticeId(); - String type = "jh"; - String username = wmToDownGoods.getCreateBy(); - updateUser(orderId,type,username); - }catch (Exception e){ - } - - - wmToDownGoodsService.save(wmToDownGoods); - D0.setOK(true); - }else{ - D0.setOK(false); - D0.setErrorMsg("库存不足"); - }; - + //查询create_name + TSBaseUser user = systemService.findUniqueByProperty(TSBaseUser.class, "userName", wmToDownGoods.getCreateBy()); + if (user != null) { + wmToDownGoods.setCreateName(user.getRealName()); + } + todown(wmToDownGoods.getOrderIdI(),wmToDownGoods.getCreateBy(),wmToDownGoods.getCreateName()); } catch (Exception e) { e.printStackTrace(); D0.setOK(false); @@ -809,6 +771,52 @@ public class WmToDownGoodsController extends BaseController { // return new ResponseEntity(headers, HttpStatus.CREATED); } + + + public boolean todown(String id,String username,String realname){ + try { + WmOmQmIEntity wmOmQmI = systemService.getEntity( + WmOmQmIEntity.class, id); + if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("N")) { + WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity(); + wmToDownGoods.setCreateBy(username); + wmToDownGoods.setCreateName(realname); + wmToDownGoods.setCreateDate(now()); + 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("Y"); + systemService.saveOrUpdate(wmOmQmI); + try{ + String orderId = wmOmQmI.getOmNoticeId(); + String type = "jh"; + updateUser(orderId,type,username); + }catch (Exception e){ + } + return true; + } else { + return false; + } + } catch (Exception e) { + return false; + } + } + //装车复核 @RequestMapping(value = "/change", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody