/** * 打开修改零售单页面 * * @return */ public String edit() { lsd = (Lsd) lsdService.getLsd(id); lsdProducts = lsdService.getLsdProducts(id); storeList = storeService.getAllStoreList(); userList = userService.getAllEmployeeList(); iscs_flag = sysInitSetService.getQyFlag(); isqzxlh_flag = userService.getQzxlh(); ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); return "success"; }
/** * 已成交零售单列表(退货时选择) * * @return */ public String listCjLsd() { int rowsPerPage = Constant.PAGE_SIZE; String con = " and a.state='已提交'"; if (!creatdate.equals("")) { con += " and a.creatdate>='" + creatdate + "'"; } if (!creatdate2.equals("")) { con += " and a.creatdate<='" + (creatdate2 + " 23:59:59") + "'"; } if (!client_name.equals("")) { con += " and a.client_name like'%" + client_name + "%'"; } if (orderName.equals("")) { orderName = "id"; } if (orderType.equals("")) { orderType = "desc"; } con += " order by " + orderName + " " + orderType; pageLsd = lsdService.getLsdList(con, curPage, rowsPerPage); return "success"; }
/** * 零售单审批 * * @return */ public String doSp() { LoginInfo info = (LoginInfo) getSession().getAttribute("LOGINUSER"); String user_id = info.getUser_id(); lsd = (Lsd) lsdService.getLsd(id); // 零售单 lsdProducts = lsdService.getLsdProducts(id); iscs_flag = sysInitSetService.getQyFlag(); isqzxlh_flag = userService.getQzxlh(); // 只有在审批通过并且完成初始化后再判断库存是否满足 if (sp_state.equals("3") && iscs_flag.equals("1")) { // 审批通过,需要判断库存是否满足 if (!(lsdService.checkKc(lsd, lsdProducts)).equals("")) { this.setMsg(lsdService.checkKc(lsd, lsdProducts)); return "input"; } if (isqzxlh_flag.equals("01")) { if (!(lsdService.checkXlh(lsd, lsdProducts)).equals("")) { this.setMsg(lsdService.checkXlh(lsd, lsdProducts)); return "input"; } } } // 保存审批结果 lsdService.saveSp(id, sp_state, user_id); return "success"; }
/** * 保存提成比例 * * @return */ public String saveTcbl() { try { lsdService.saveTcbl(basic_ratio, out_ratio, ds_ratio); } catch (Exception e) { log.error("保存提成比例,原因:" + e.getMessage()); e.printStackTrace(); return ERROR; } return "success"; }
/** * 编辑提成比例 * * @return */ public String editTcbl() { try { tcblMap = lsdService.getTcbl(); } catch (Exception e) { log.error("编辑提成比例,原因:" + e.getMessage()); e.printStackTrace(); return ERROR; } return "success"; }
/** * 提交审批 * * @return */ public String submitInfo() { LoginInfo info = (LoginInfo) getSession().getAttribute("LOGINUSER"); String user_id = info.getUser_id(); lsdProducts = lsdService.getLsdProducts(lsd.getId()); isqzxlh_flag = userService.getQzxlh(); String msg = lsdService.checkKc(lsd, lsdProducts); if (!msg.equals("")) { this.saveMessage(msg); userList = userService.getAllEmployeeList(); storeList = storeService.getAllStoreList(); ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); return "input"; } if (isqzxlh_flag.equals("01")) { msg = lsdService.checkXlh(lsd, lsdProducts); if (!msg.equals("")) { this.saveMessage(msg); userList = userService.getAllEmployeeList(); storeList = storeService.getAllStoreList(); ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); return "input"; } } lsd.setCzr(user_id); lsd.setSp_state("2"); // 修改零售单为待审批状态 lsd.setState("已保存"); // 修改零售单状态为已保存 lsdService.updateLsd(lsd, lsdProducts); return "success"; }
/** * 打开打印零售单页面 pdf * * @return */ public String printLsd() { try { lsd = (Lsd) lsdService.getLsd(id); client_name = StringUtils.nullToStr(lsd.getClient_name()) + " " + StringUtils.nullToStr(lsd.getLxr()); client_tel = StringUtils.nullToStr(lsd.getLxdh()) + " " + StringUtils.nullToStr(lsd.getMobile()) + " " + StringUtils.nullToStr(lsd.getMail()); dept_name = StaticParamDo.getDeptNameById(((SysUser) userService.getUser(lsd.getXsry())).getDept()); xsry_name = StaticParamDo.getRealNameById(lsd.getXsry()); skfs = StringUtils.nullToStr(lsd.getFkfs()); skzh_name = StaticParamDo.getAccountNameById(lsd.getSkzh()); address = StringUtils.nullToStr(lsd.getAddress()); remark = StringUtils.nullToStr(lsd.getMs()); jexj_dx = MoneyUtil.toChinese(lsd.getLsdje() + ""); creatdate = StringUtils.nullToStr(lsd.getCreatdate()); Map map = sysInitSetService.getReportSet(); if (map != null) { title_name = StringUtils.nullToStr(map.get("title_name")) + "零售单"; foot_name = StringUtils.nullToStr(map.get("foot_name")); } lsdProducts = lsdService.getLsdProducts(id); } catch (Exception e) { log.error("打印零售单出错,原因:" + e.getMessage()); return ERROR; } return "success"; }
/** * 打开添加零售单页面 * * @return */ public String add() { userList = userService.getAllEmployeeList(); // 设置零售单编号 lsd.setId(lsdService.updateLsdId()); storeList = storeService.getAllStoreList(); iscs_flag = sysInitSetService.getQyFlag(); // 是否完成初始标志 isqzxlh_flag = userService.getQzxlh(); ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); return "success"; }
/** * 序列号查看页面 * * @return */ public String serialView() { String id = ParameterUtility.getStringParameter(getRequest(), "id", ""); serialList = lsdService.getSerialList(id); return "success"; }
/** * 保存零售税点 * * @return */ public String saveLssd() { lsdService.saveLssd(sd); return "success"; }
/** * 编辑零售税点 * * @return */ public String editLssd() { sd = lsdService.getLssd() + ""; return "success"; }
/** * 零售单名细 * * @return */ public String descLsd() { lsdProducts = lsdService.getLsdProducts(id); return "success"; }
/** * 打开选择库存商品列表 * * @return */ public String selKcProc() { int rowsPerPage = 15; String con = " and a.state='正常'"; if (!product_name.equals("")) { product_name = ((product_name.replace(" ", " ")).replace(",", "")).replace(",", " "); String[] arryCon = product_name.split(" "); String tempSql = ""; if (arryCon != null && arryCon.length > 0) { con += " and("; for (int i = 0; i < arryCon.length; i++) { if (tempSql.equals("")) { tempSql = "(a.product_id like '%" + arryCon[i] + "%' or a.product_name like '%" + arryCon[i] + "%' or a.product_xh like '%" + arryCon[i] + "%' or a.sp_txm like '%" + arryCon[i] + "%')"; } else { tempSql = tempSql + " and (a.product_id like '%" + arryCon[i] + "%' or a.product_name like '%" + arryCon[i] + "%' or a.product_xh like '%" + arryCon[i] + "%' or a.sp_txm like '%" + arryCon[i] + "%')"; } } con += tempSql + ")"; } } if (!product_kind.equals("")) { con += " and a.product_kind like '" + product_kind + "%'"; } if (!prop.equals("")) { con += " and prop='" + prop + "'"; } productPage = productKcService.getProductKcList(con, curPage, rowsPerPage); storeList = storeService.getAllStoreList(); kindList = productKindService.getAllProductKindList(); sd = JMath.round(lsdService.getLssd()); // 提成比例 Map tcblMap = lsdService.getTcbl(); if (tcblMap != null) { basic_ratio = JMath.round( tcblMap.get("basic_ratio") == null ? 0 : ((Double) tcblMap.get("basic_ratio")).doubleValue()); out_ratio = JMath.round( tcblMap.get("out_ratio") == null ? 0 : ((Double) tcblMap.get("out_ratio")).doubleValue()); } return "success"; }
/** * 删除零售单 * * @return */ public String del() { String id = ParameterUtility.getStringParameter(getRequest(), "id", ""); lsdService.delLsd(id); return "success"; }
/** 更新零售单信息 */ public String update() { LoginInfo info = (LoginInfo) getSession().getAttribute("LOGINUSER"); String user_id = info.getUser_id(); lsd.setCzr(user_id); iscs_flag = sysInitSetService.getQyFlag(); isqzxlh_flag = userService.getQzxlh(); // 只有在完成初始工作后再做库存是否满足需求判断 if (iscs_flag.equals("1")) { // 如果零售单状态为已提交需要判断库存是否满足出库需求 // 如果不满足出库需求,则保存零售单,同时返回输入页面,提示用户 if (lsd.getState().equals("已提交")) { if (!(lsdService.checkKc(lsd, lsdProducts)).equals("")) { this.setMsg(lsdService.checkKc(lsd, lsdProducts)); lsd.setState("已保存"); lsdService.updateLsd(lsd, lsdProducts); userList = userService.getAllEmployeeList(); storeList = storeService.getAllStoreList(); iscs_flag = sysInitSetService.getQyFlag(); // 是否完成初始标志 ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); return INPUT; } if (isqzxlh_flag.equals("01")) { if (!(lsdService.checkXlh(lsd, lsdProducts)).equals("")) { this.setMsg(lsdService.checkXlh(lsd, lsdProducts)); lsd.setState("已保存"); lsdService.updateLsd(lsd, lsdProducts); // 页面初始数据 storeList = storeService.getAllStoreList(); ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); userList = userService.getAllEmployeeList(); return INPUT; } } } } // 判断是否存在超低价商品,如存在则审批状态修改为待审批 if (lsd.getState().equals("已提交") && lsdService.isExistLowLsxj(lsd, lsdProducts)) { if (flag.equals("1")) { // 提交审批 lsd.setState("已保存"); lsd.setSp_state("2"); // 待审批 } else { // 如果不是提交审批,返回录入界面给用户提示 lsd.setState("已保存"); lsd.setSp_state("1"); // 需要审批 lsdService.updateLsd(lsd, lsdProducts); // 页面初始数据 storeList = storeService.getAllStoreList(); ysfs = sjzdService.getSjzdXmxxByZdId("SJZD_FKFS"); posTypeList = posTypeService.getPosTypeList(); userList = userService.getAllEmployeeList(); flag = "1"; return INPUT; } } lsdService.updateLsd(lsd, lsdProducts); return "success"; }