先写Controller层的数据,然后在快捷方式创建对应的service层和dao层
查询数据并显示要去盘点的信息:
package com.yhyx.fhxhcps.depotcheck.controller.mbl;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.yhyx.fhxhcps.depotcheck.controller.anc.DepotCheckBaseController;
import com.yhyx.fhxhcps.depotcheck.service.mbl.DepotCheckMblService;
import com.yhyx.framework.entity.Constants;
import com.yhyx.framework.entity.ResultMap;
import com.yhyx.framework.utils.RequestUtils;
@Controller
public class DepotCheckMblController extends DepotCheckBaseController{
@Autowired
@Qualifier("depotCheckMblService")
private DepotCheckMblService depotCheckMblService;
/**
*
* <仓库盘点功能管理端-查询收到盘点信息>
* @author lj
* @date 2019年4月19日
* @param request
* @param response
* @param session
* @param model
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("unchecked")
@RequestMapping("/mbl/depotcheck/getDepotChkBill")
public void getDepotTopLst(HttpServletRequest request,
HttpServletResponse response, HttpSession session, Model model) {
ResultMap resMap = new ResultMap();
Map<String, String> params = new HashMap<String, String>();
params = RequestUtils.getParams(request);
try {
resMap = depotCheckMblService.getDepotTopLst(params);
} catch (Exception e) {
resMap.setS_code(Constants.RES_CODE_ERROR);
resMap.setS_msg("仓库盘点查询-查询仓库列表信息异常");
log.error("仓库盘点查询-查询仓库列表信息异常:", e);
}
printWriter(resMap, response);
}
/**
*
* <仓库盘点功能管理端-查询盘点商品的信息>
* @author lj
* @date 2019年4月19日
* @param request
* @param response
* @param session
* @param model
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("unchecked")
@RequestMapping("/mbl/depotcheck/getDepotWaresLst")
public void getDepotWaresLst(HttpServletRequest request,
HttpServletResponse response, HttpSession session, Model model) {
ResultMap resMap = new ResultMap();
Map<String, String> params = new HashMap<String, String>();
params = RequestUtils.getParams(request);
try {
resMap = depotCheckMblService.getDepotWaresLst(params);
} catch (Exception e) {
resMap.setS_code(Constants.RES_CODE_ERROR);
resMap.setS_msg("仓库盘点查询-查询仓库列表信息异常");
log.error("仓库盘点查询-查询仓库列表信息异常:", e);
}
printWriter(resMap, response);
}
/**
*
* <仓库盘点功能管理端-新增仓库盘点明细信息>
* @author lj
* @date 2019年4月19日
* @param request
* @param response
* @param session
* @param model
* @see [类、类#方法、类#成员]
*/
@RequestMapping("/mbl/depotcheck/addDepotChkLst")
public void addDepotChkLst(HttpServletRequest request,
HttpServletResponse response, HttpSession session, Model model) {
ResultMap resMap = new ResultMap();
Map<String, String> params = new HashMap<String, String>();
params = RequestUtils.getParams(request);
try {
resMap = depotCheckMblService.addDepotChkLst(params);
} catch (Exception e) {
resMap.setS_code(Constants.RES_CODE_ERROR);
resMap.setS_msg("仓库盘点查询-新增仓库盘点明细信息异常");
log.error("仓库盘点查询-新增仓库盘点明细信息异常:", e);
}
printWriter(resMap, response);
}
/**
*
* <仓库盘点功能管理端-点击编辑弹层查询有货位的信息>
* @author lj
* @date 2019年4月19日
* @param request
* @param response
* @param session
* @param model
* @see [类、类#方法、类#成员]
*/
@RequestMapping("/mbl/depotcheck/qryDepotChkLst")
public void qryDepotChkLst(HttpServletRequest request,
HttpServletResponse response, HttpSession session, Model model) {
ResultMap resMap = new ResultMap();
Map<String, String> params = new HashMap<String, String>();
params = RequestUtils.getParams(request);
try {
resMap = depotCheckMblService.qryDepotChkLst(params);
} catch (Exception e) {
resMap.setS_code(Constants.RES_CODE_ERROR);
resMap.setS_msg("仓库盘点查询-新增仓库盘点明细信息异常");
log.error("仓库盘点查询-新增仓库盘点明细信息异常:", e);
}
printWriter(resMap, response);
}
}
Service层的接口:
package com.yhyx.fhxhcps.depotcheck.service.mbl;
import java.util.List;
import java.util.Map;
import com.yhyx.framework.entity.ResultMap;
public interface DepotCheckMblService {
/**
*
* <仓库盘点功能管理端-查询收到的盘点信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
public ResultMap getDepotTopLst(Map<String, String> params) throws Exception;
/**
*
* <仓库盘点功能管理端-根据商品编号查询盘点商品信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
public ResultMap getDepotWaresLst(Map<String, String> params) throws Exception;
/**
*
* <仓库盘点功能管理端-新增仓库盘点明细信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
public ResultMap addDepotChkLst(Map<String, String> params) throws Exception;
/**
*
* <仓库盘点功能管理端-点击编辑弹层查询有货位的信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
public ResultMap qryDepotChkLst(Map<String, String> params)throws Exception;
}
Service层的实现:
package com.yhyx.fhxhcps.depotcheck.service.mbl.Impl;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.yhyx.fhxhcps.depotcheck.dao.mbl.DepotCheckMblDao;
import com.yhyx.fhxhcps.depotcheck.service.anc.AncService;
import com.yhyx.fhxhcps.depotcheck.service.mbl.DepotCheckMblService;
import com.yhyx.framework.entity.Constants;
import com.yhyx.framework.entity.ResultMap;
import com.yhyx.framework.service.InterfaceBaseService;
@Service("depotCheckMblService")
public class DeportCheckMblServiceImpl extends AncService implements DepotCheckMblService{
@Autowired
@Qualifier("depotCheckMblDao")
private DepotCheckMblDao depotCheckMblDao;
/**
*
* <仓库盘点功能管理端-查询收到的盘点信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("rawtypes")
@Override
public ResultMap getDepotTopLst(Map<String, String> params) throws Exception {
ResultMap resMap = new ResultMap();
List list = depotCheckMblDao.getDepotTopLst(getPageParm(params), params);
resMap.setO_data(list);
resMap.setS_code(Constants.RES_CODE_SUCCESS);
resMap.setS_msg(Constants.RES_MSG_SUCCESS);
return resMap;
}
/**
*
* <仓库盘点功能管理端-查询盘点商品信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("rawtypes")
@Override
public ResultMap getDepotWaresLst(Map<String, String> params) throws Exception {
ResultMap resMap = new ResultMap();
List list = depotCheckMblDao.getDepotWaresLst(getPageParm(params), params);
resMap.setO_data(list);
resMap.setS_code(Constants.RES_CODE_SUCCESS);
resMap.setS_msg(Constants.RES_MSG_SUCCESS);
return resMap;
}
/**
*
* <仓库盘点功能管理端-新增仓库盘点明细信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@Override
public ResultMap addDepotChkLst(Map<String, String> params)
throws Exception {
ResultMap resMap = new ResultMap();
//data:{"I_BILL":iBill,"I_DEPOT":iDepot,"S_PARAMS":JSON.stringify(dataArr)},
/*String iBill = Str(params.get("I_BILL"), "");
String iDepot = Str(params.get("I_DEPOT"), "");*/
String sParams = Str(params.get("S_PARAMS"), "");
if(sParams.startsWith("\"") && sParams.endsWith("\"")){//解密参数,页面传的参数进行界面,变成json可以识别的参数
sParams = sParams.substring(1,sParams.length() - 1);
}
JSONArray joParams = JSONArray.fromObject(sParams);
for (int i = 0; i < joParams.size(); i++) {
JSONObject joEach = JSONObject.fromObject(joParams.get(i));
/*String sWaresNoExt = Str(joEach.get("S_WARESNOEXT"),"");
String iChkNum = Str(joEach.get("I_CHKNUM"),"0");*/
}
depotCheckMblDao.addDepotChkLst(params);
resMap.setS_code(Constants.RES_CODE_SUCCESS);//ajax中的if(data.s_code == "000000"){这句话
return resMap;
}
/**
*
* <仓库盘点功能管理端-点击编辑弹层查询有货位的信息>
* @author lj
* @date 2019年4月19日
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@Override
public ResultMap qryDepotChkLst(Map<String, String> params)
throws Exception {
ResultMap resMap = new ResultMap();
List list = depotCheckMblDao.qryDepotChkLst(getPageParm(params), params);
resMap.setO_data(list);
resMap.setS_code(Constants.RES_CODE_SUCCESS);
resMap.setS_msg(Constants.RES_MSG_SUCCESS);
return resMap;
}
}
Dao层的实现:
package com.yhyx.fhxhcps.depotcheck.dao.mbl.impl;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.yhyx.fhxhcps.depotcheck.dao.anc.AncDao;
import com.yhyx.fhxhcps.depotcheck.dao.mbl.DepotCheckMblDao;
import com.yhyx.framework.dao.BaseJDBCDao;
import com.yhyx.framework.entity.PageParam;
/**
* <微信端仓库盘点的dao实现类>
* @author Administrator
*
*/
@Repository("depotCheckMblDao")
public class DepotCheckMblDaoImpl extends AncDao implements DepotCheckMblDao{
@Autowired
@Resource(name = "jdbcTemplate")
private JdbcTemplate jdbcTemplate;// 本地数据连接
@Autowired
@Resource(name = "jdbcTemplate_depot")
private JdbcTemplate jdbcTemplate_depot;//仓库数据连接
/**
*
* <仓库盘点功能管理端-查询创建的盘点信息并显示信息>
* @author lj
* @date 2019年4月19日
* @param request
* @param response
* @param session
* @param model
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("rawtypes")
@Override
public List getDepotTopLst(PageParam pageParm, Map<String, String> params) throws Exception {
String sSql = "SELECT * FROM T_DP_BILL_CHK WHERE C_STATE = 'A' AND I_STATUS IN (10,20)";
return this.jdbcTemplate_depot.queryForList(sSql);
}
/**
*
* <仓库盘点功能管理端-根据单号查询创建的盘点信息并显示信息>
* @author lj
* @date 2019年4月19日
* @param request
* @param response
* @param session
* @param model
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("rawtypes")
public List getDepotWaresLst(PageParam pageParm, Map<String, String> params) throws Exception {
String sSql = "SELECT * "
+ "FROM V_DP_WARES "
+ "WHERE 1 = 1 ";
List paramLst = new ArrayList();
String sWaresNoext = Str(params.get("S_WARESNOEXT"), "");
if(!sWaresNoext.equals("")){
sSql += " AND S_WARESNOEXT = ? ";
paramLst.add(sWaresNoext);
}
return this.jdbcTemplate_depot.queryForList(sSql,paramLst.toArray());
}
/**
*
* <仓库盘点功能管理端-提交删除根据单号查询创建的盘点信息并显示信息>
* @author lj
* @date 2019年4月19日
* @param pageParm
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@Override
public void addDepotChkLst(Map mapDepot) throws Exception {
final String iBill = Str(mapDepot.get("I_BILL"), "");//有就几个问号就写几个字段
final String iDepot = Str(mapDepot.get("I_DEPOT"), "");
final String iUser = Str(mapDepot.get("I_USER"), "");
final String sUser = Str(mapDepot.get("S_USER"), "");
final String sDesc = Str(mapDepot.get("S_DESC"), "");
final JSONArray joArr = JSONArray.fromObject(Str(mapDepot.get("S_PARAMS"),"[]"));//将字段放进params中
String sSql="INSERT INTO T_DP_BILL_CHKLST"
+ " (I_BILL, I_DEPOT, I_BILLLST, S_DTCHK, I_WARES, I_STORE, I_NUM, I_USER, S_USER, S_DESC, S_WARES, S_WARESNO, S_WARESMC, I_UNIT, S_UNIT)"
+ " SELECT A.I_BILL,A.I_DEPOT,SEQ_BC_BILLCHKLST.NEXTVAL,TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS'),B.I_WARES,C.I_STORE,?,?,?,?,B.S_WARES,B.S_WARESNO,B.S_WARESMC,B.I_UNIT,B.S_UNIT"
+ " FROM T_DP_BILL_CHK A"
+ " LEFT JOIN V_DP_WARES B ON 1 = 1"
+ " LEFT JOIN (SELECT I_WARES,SUM(I_STORE) I_STORE"
+ " FROM T_WS_STORE"
+ " WHERE I_DEPOT = ?"
+ " GROUP BY I_WARES) C ON B.I_WARES = C.I_WARES"
+ " WHERE A.I_BILL = ? AND B.S_WARESNOEXT = ?";
List list = new ArrayList();
this.jdbcTemplate_depot.batchUpdate(sSql.toString(),//批量更新,一直执行增加数据的语句
new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int i)
throws SQLException {
// PreparedStatement 实例包含已编译的 SQL 语句
Map childMap= (Map) joArr.get(i);//取出List中每个Map
//{I_DEPOT=1, S_PARAMS=[{"S_WARESNOEXT":"1111","I_CHKNUM":"1"}], I_BILL=1}
//前后两个字段不在集合 中,
ps.setString(1, Str(childMap.get("I_CHKNUM"),"0"));
ps.setString(2, iUser);
ps.setString(3, sUser);
ps.setString(4, sDesc);
ps.setString(5, iDepot);
ps.setString(6, iBill);
ps.setString(7, Str(childMap.get("S_WARESNOEXT")));
}
@Override
public int getBatchSize() {
return joArr.size();
}
});
}
/**
*
* <仓库盘点功能管理端-点击编辑弹层查询有货位的信息>
* @author lj
* @date 2019年4月19日
* @param pageParm
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@Override
public List qryDepotChkLst(PageParam pageParm, Map<String, String> params) {
String sSql ="SELECT T1.S_WARESNOEXT,T1.S_WARESMC,t5.S_DEPOTMC,T1.S_BRANDMC "
+ "FROM V_DP_WARES T1,"
+ "(SELECT T1.I_WARES,SUM(I_STORE) I_STORE,WM_CONCAT(T2.S_DEPOTMC || '-' || T3.S_SHELFMC || '-' || T4.S_SHELFLSTMC) S_DEPOTMC FROM T_DP_DEPOT_WARES T1,T_DP_DEPOT T2,"
+ "T_DP_DEPOT_SHELF T3,"
+ "T_DP_DEPOT_SHELFLST T4 "
+ "WHERE T1.I_DEPOT = T2.I_DEPOT_DAD"
+ " AND T2.I_DEPOT = T3.I_DEPOT"
+ " AND T3.I_DEPOT = T4.I_DEPOT AND T3.I_SHELFID = T4.I_SHELFID AND T1.I_SHELFLSTID = T4.I_SHELFLSTID GROUP BY T1.I_WARES) T5 "
+ "WHERE T1.I_WARES = T5.I_WARES";
List paramLst = new ArrayList();
String sWaresNoext = Str(params.get("S_WARESNOEXT"), "");
if(!sWaresNoext.equals("")){
sSql += " AND T1.S_WARESNOEXT = ? ";
paramLst.add(sWaresNoext);
}
return this.jdbcTemplate_depot.queryForList(sSql,paramLst.toArray());
}
}
Da层的接口:
package com.yhyx.fhxhcps.depotcheck.dao.mbl;
import java.util.List;
import java.util.Map;
import com.yhyx.framework.entity.PageParam;
/**
* <微信端仓库的盘点>
* @author Administrator
*
*/
public interface DepotCheckMblDao {
/**
*
* <仓库盘点功能管理端-手机查询获取到需要盘点的信息>
* @author lj
* @date 2019年4月19日
* @param pageParm
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("rawtypes")
public List getDepotTopLst(PageParam pageParm, Map<String, String> params) throws Exception;
/**
*
* <仓库盘点功能管理端-手机盘点商品的信息>
* @author lj
* @date 2019年4月19日
* @param pageParm
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
@SuppressWarnings("rawtypes")
public List getDepotWaresLst(PageParam pageParm, Map<String, String> params) throws Exception;
/**
*
* <仓库盘点功能管理端-手机提交清空盘点商品的信息>
* @author lj
* @date 2019年4月19日
* @param pageParm
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
public void addDepotChkLst(Map<String, String> params) throws Exception;
/**
*
* <仓库盘点功能管理端-点击编辑弹层查询有货位的信息>
* @author lj
* @date 2019年4月19日
* @param pageParm
* @param params
* @return
* @throws Exception
* @see [类、类#方法、类#成员]
*/
public List qryDepotChkLst(PageParam pageParm, Map<String, String> params);
}
页面的js:
去盘点的js:
//微信盘点页面的显示
$(document).ready(function(){
fg();
$(".row_sub").click(function(){
window.location.href="/fhxhcps/wechat/page/check/invenDetial.html?I_BILL='+iBill+'&I_DEPOT='+iDepot+'";
})
})
function fg(){
$.ajax({
url :"/fhxhcps/mbl/depotcheck/getDepotChkBill.do",
type : "post",
dataType : "json",
success : function(data) {
if(data.s_code == "000000"){
var oData = data.o_data ;
$("#sType").empty();
for(var i = 0 ; i<oData.length ; i++){
var sChkDate = oData[i]['S_DTSTART'];
var sBillNo = oData[i]['S_BILLNO'];
var iBill = oData[i]['I_BILL'];
var iDepot=oData[i]['I_DEPOT'];
var sDom = '<li>'+
'<p class="title"><i></i>盘点任务</p>'+
'<div class="s_time">'+
'<p>盘点时间</p>'+
'<p>'+sChkDate+'</p>'+
'</div>'+
'<div class="s_task">'+
'<p>任务单号</p>'+
'<p>'+sBillNo+'</p>'+
'</div>'+
'<div class="s_store">'+
'<p>任务仓库</p>'+
'<p>'+iDepot+'</p>'+
'</div>'+
'</li>';
/*"<div class='row_div'>" +
"<ul>" +
"<li class='row_li'>" +
"<span class='row_span'>盘点时间:</span>" +
"<span>"+sChkDate+"</span>" +
"</li>" +
"<li class='row_li'>" +
"<span class='row_span' >任务单号:</span>" +
"<span>"+sBillNo+"</span>" +
"<a href='/fhxhcps/wechat/page/check/invenDetial.html?I_BILL="+iBill+"&I_DEPOT="+iDepot+"' class='do_check'>去盘点</a>" +
"</li>" +
"<li class='row_li'>" +
"<span class='row_span'>任务仓库:</span>" +
"<span>"+iDepot+"</span>" +
"</li>" +
"</ul>" +
"</div>"*/
$(".date").after(sDom);
}
}
},
error:function(){
layer.closeAll();
//mylayer.info("系统繁忙,获取类别失败",{icon:2,time:1500});
}
});
}
对应的html:
<!DOCTYPE html>
<html>
<head>
<title>invenCmp.html</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<meta charset="UTF-8">
<meta charset="UTF-8" />
<meta name="applicable-device" content="mobile" />
<!-- 移动端 浏览器中页面将以原始大小显示,不允许缩放 -->
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<!-- iphone会把一串数字识别为电话号码,点击的时候会提示是否呼叫,屏蔽这功能则把telephone设置为no -->
<meta content="telephone=no" name="format-detection" />
<!-- iphone的私有标签,默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明) -->
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<!-- iphone设备的是有标签 允许全屏模式浏览,隐藏浏览器导航栏 -->
<meta content="yes" name="apple-mobile-web-app-capable" /> <!-- 屏蔽百度转码 -->
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>盘点任务列表</title>
<link rel="stylesheet" type="text/css" href="../../component/third/swiper/swiper.css">
<link rel="stylesheet" type="text/css" href="../../css/common.css">
<link rel="stylesheet" type="text/css" href="../../component/third/font-awesome-4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../../css/search.css">
<link rel="stylesheet" type="text/css" href="../../component/titlehead/css/head.css">
<link rel="stylesheet" type="text/css" href="../../component/foot/css/foot.css">
<link rel="stylesheet" type="text/css" href="../../component/list/css/list.css">
<link rel="stylesheet" type="text/css" href="../../css/search.css">
<link rel="stylesheet" type="text/css" href="css/return.css">
<!-- <link rel="stylesheet" type="text/css" href="../../css/center.css"> -->
<script src="../../component/third/jquery/jquery-1.8.0.min.js" type="text/javascript"></script>
<!-- <script src="../../component/third/html2canvas.js" type="text/javascript"></script> -->
<script src="../../component/third/fontset/js.js" type="text/javascript"></script>
<script src="../../component/third/swiper/swiper.js" type="text/javascript"></script>
<script src="../../js/layer/layer.js" type="text/javascript"></script>
<script src="../../js/mylayer/mylayer.js" type="text/javascript"></script>
<!-- <script src="../../component/third/mylayer/mylayer.js" type="text/javascript"></script> -->
<script src="../../js/common.js" type="text/javascript"></script>
<script src="js/invenCmp.js" type="text/javascript"></script>
<style type="text/css">
.pdList{
margin:0.92rem 0.17rem 0.9rem 0.17rem;
}
.pdList .title{
height:0.68rem;
line-height:0.68rem;
padding:0 0.17rem;
border-bottom:1px solid #eee;
font-size:0.22rem;
color:#333;
}
.pdList .title i{
display:inline-block;
height:0.1rem;
width:0.1rem;
border-radius:0.05rem;
background:#FF3243;
margin-right:0.1rem;
}
.pdList li{
background:#fff;
border-radius:0.15rem;
}
.pdList li .s_time{
padding-top:0.15rem;
padding-bottom:0.15rem;
}
.pdList li .s_task{
padding-bottom:0.15rem;
}
.pdList li .s_store{
padding-bottom:0.15rem;
}
.pdList li .s_time p,.pdList li .s_task p,.pdList li .s_store p{
height:0.35rem;
line-height:0.35rem;
padding-left:0.38rem;
font-size:0.22rem;
}
.pdList li .s_time p:first-child,.pdList li .s_task p:first-child,.pdList li .s_store p:first-child{
color:#999;
}
.row_sub {
height: 0.68rem;
line-height: 0.68rem;
width: 90%;
margin: 0 auto;
border-radius: 0.34rem;
background: linear-gradient(to right,#FF4932,#FF2E47,#FE0E5E);
color: #fff;
text-align: center;
font-size: 0.23rem;
}
</style>
</head>
<body>
<header>
<div class="head redhead">
<a onclick="history.go(-1)">返回</a>
<span>盘点任务</span>
</div>
</header>
<div class="pdList">
<ul class="date">
</ul>
</div>
<div style="padding:0.2rem 0;position:fixed;left:0;bottom:0;width:100%;">
<div class="row_sub">去盘点</div>
</div>
</body>
</html>
盘点详情的js:
//微信盘点页面的显示
$(document).ready(function(){
var iBill = "1";
var iDepot = "1";
$(".row_button").click(function(){
var sWaresNoExt = $(".row_input").val();
queryWaresNoExt(sWaresNoExt);
});
//编辑键的操作
$("body").on("click",".l_edit",function(){
$(this).closest(".numarea").find("input").prop("disabled",false);
$(this).closest(".numarea").find(".l_confirm").show();
$(this).closest(".numarea").find(".l_edit").hide();
});
//完成键的操作
$("body").on("click",".l_confirm",function(){
$(this).closest(".numarea").find("input").prop("disabled",true);
$(this).closest(".numarea").find(".l_confirm").hide();
$(this).closest(".numarea").find(".l_edit").show();
});
//提交盘点明细纪录
$(".row_sub").click(function(){
mylayer.confirm("您是否确认提交数据", function(){
var dataArr = [];
$(".check_date").each(function(i,item){
var s_waresNoExt = $(this).find(".top_div p>span:last-child").html();
var iChkNum = $(this).find(".i_chknum").val();
var params = {};
params['S_WARESNOEXT'] = s_waresNoExt;
params['I_CHKNUM'] = iChkNum;
dataArr.push(params);
$.ajax({
url:"/fhxhcps/mbl/depotcheck/addDepotChkLst.do",
data:{"I_BILL":iBill,"I_DEPOT":iDepot,"S_PARAMS":JSON.stringify(dataArr)},
type:"post",
dataType:"json",
success:function(data){
if(data.s_code == "000000"){
$(".top_div").remove();
$(".bottom_div").remove();
$(".numarea").remove();
layer.closeAll();
}
},
error:function(){
mylayer.closeAll();
}
});
})
});
});
// l_edit
// l_confirm
// numarea
//删除数据
/* $("body").on("click",".del_btn",function(){
$(".top_div").remove();
$(".bottom_div").remove();
$(".numarea").remove();
});
*/
//点击加入查询数据
function queryWaresNoExt(sWaresNoExt){
$.ajax({
url:"/fhxhcps/mbl/depotcheck/qryDepotChkLst.do",
data:{"S_WARESNOEXT":sWaresNoExt},
type:"post",
dataType:"json",
success:function(data){
layer.closeAll();
if(data.s_code == "000000"){
var oData = data.o_data;
var $dom = "";
for(var i=0;i<oData.length;i++){
$dom += '<li class="check_date">'+
'<div class="top_div">'+
'<p><span class="label">系统系统内编码</span><span>'+oData[i]['S_WARESNOEXT']+'</span></p>'+
'<p><span class="label">货位编码</span><span class="wareCode">'+oData[i]['S_DEPOTMC']+'</span></p>'+
'</div>'+
'<div class="bottom_div">'+
'<p class="waresmc">'+oData[i]['S_WARESMC']+'</p>'+
'<div class="spec">'+
'<span class="info">'+oData[i]['S_BRANDMC']+'</span>'+
'<div class="numarea">'+
'<input type="number" disabled="true" class="i_chknum">'+
'<span class="l_edit">编辑</span>'+
'<span class="l_confirm">完成</span>'+
'</div>'+
'</div>'+
'<div class="del">删除</div>'+
'</div>'+
'</li>';
}
$(".edit_div ul").html($dom);
initDel();
}
}
});
}
function initDel(){
$(".edit_div").find("li").on("touchstart",function(){
var $this = $(this);
var touch = e.originalEvent;
var startX = touch.changedTouches[0].pageX;
var startY = touch.changedTouches[0].pageY;
$("body").on("touchmove",function(e){
touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
if (touch.pageX - startX > 10) {//右滑
showDelete($this,"right");
$('body').off('touchmove');
} else if (touch.pageX - startX < -10) {//左滑
showDelete($this,"left");
$('body').off('touchmove');
};
});
}).on("touchend",function(){
$("body").off("touchmove");
});
}
function showDelete($dom,direct){
var flag = false;
if($dom.hasClass("left")){//已经在滑动删除展示状态
flag = false;
}else{
flag = true;
}
if(direct == "left"){//左滑
if(flag){
$dom.css({
"margin-left":"-0.94rem",
"transition":"0.1s ease;"
});
$dom.addClass("left");
}
}else{//右滑
if(!flag){
$dom.css({
"margin-left":"0",
"transition":"0.1s ease;"
});
$dom.removeClass("left");
}
}
}
});
盘点详情的html:
<!DOCTYPE html>
<html>
<head>
<title>盘点</title>
<meta charset="UTF-8">
<meta charset="UTF-8" />
<meta name="applicable-device" content="mobile" />
<!-- 移动端 浏览器中页面将以原始大小显示,不允许缩放 -->
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<!-- iphone会把一串数字识别为电话号码,点击的时候会提示是否呼叫,屏蔽这功能则把telephone设置为no -->
<meta content="telephone=no" name="format-detection" />
<!-- iphone的私有标签,默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明) -->
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<!-- iphone设备的是有标签 允许全屏模式浏览,隐藏浏览器导航栏 -->
<meta content="yes" name="apple-mobile-web-app-capable" /> <!-- 屏蔽百度转码 -->
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<link rel="stylesheet" type="text/css" href="../../component/third/swiper/swiper.css">
<link rel="stylesheet" type="text/css" href="../../css/common.css">
<link rel="stylesheet" type="text/css" href="../../component/third/font-awesome-4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../../css/search.css">
<link rel="stylesheet" type="text/css" href="../../component/titlehead/css/head.css">
<link rel="stylesheet" type="text/css" href="../../component/foot/css/foot.css">
<link rel="stylesheet" type="text/css" href="../../component/list/css/list.css">
<link rel="stylesheet" type="text/css" href="../../css/search.css">
<link rel="stylesheet" type="text/css" href="css/return.css">
<!-- <link rel="stylesheet" type="text/css" href="../../css/center.css"> -->
<script src="../../component/third/jquery/jquery-1.8.0.min.js" type="text/javascript"></script>
<!-- <script src="../../component/third/html2canvas.js" type="text/javascript"></script> -->
<script src="../../component/third/fontset/js.js" type="text/javascript"></script>
<script src="../../component/third/swiper/swiper.js" type="text/javascript"></script>
<script src="../../js/layer/layer.js" type="text/javascript"></script>
<script src="../../js/mylayer/mylayer.js" type="text/javascript"></script>
<script src="../../js/constant.js" type="text/javascript"></script>
<script src="../../js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="js/invenDetial.js"></script>
<style type="text/css">
input{
-webkit-appearance: none;
border: none;
outline: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.head .scan{
float:right;
margin-right:0.2rem;
font-size:0.22rem;
}
.scan i{
display:inline-block;
height:0.27rem;
width:0.27rem;
background:url(images/sanyi.png);
background-size:100% 100%;
vertical-align: sub;
}
.search_area{
margin-top:0.92rem;
padding:0 0.17rem;
font-size:0.22rem;
}
.row_input{
height:0.51rem;
line-height:0.51rem;
border-radius:0.255rem;
width:5.46rem;
background:#fff;
font-size:0.22rem;
padding-left:0.3rem;
box-sizing: border-box;
}
.row_button{
margin-left: 0.05rem;
color:#E52020;
fonit-size:0.24rem;
}
.edit_div{
margin:0.17rem 0.17rem 0.8rem 0.17rem;
overflow-x:hidden;
}
.edit_div li{
background:#fff;
border-radius:0.1rem;
font-size:0.22rem;
width:7rem;
}
.edit_div li .top_div{
padding:0 0.17rem;
}
.top_div p{
height:0.5rem;
line-height:0.5rem;
color:#333;
}
.top_div p:last-child{
height:auto;
line-height:auto;
}
.top_div p:after{
content:"";
display:block;
clear:both;
}
.top_div p .label{
color:#999;
float:left;
height:0.5rem;
line-height:0.5rem;
width:1.8rem;
}
.top_div p>span:last-child{
float:left;
width:3.92rem
}
.edit_div li .bottom_div{
border-top:1px solid #eee;
position:relative;
}
.bottom_div .del{
position:absolute;
bottom:0.17rem;
right:0.17rem;
width:0.7rem;
height:0.9rem;
line-height:0.9rem;
border-radius:0.08rem;
background: linear-gradient(to right,#FF4832,#FF2F45,#FE115C);
color:#fff;
text-align:center;
}
.bottom_div p{
padding:0 0.17rem;
}
.waresmc{
height:0.5rem;
line-height:0.5rem;
color:#333;
font-size:0.25rem;
font-weight:bold;
}
.spec{
height:0.8rem;
line-height:0.8rem;
padding:0 0.17rem;
}
.info{
height:0.8rem;
line-height:0.8rem;
color:#999;
float:left;
}
.numarea{
height:0.8rem;
line-height:0.8rem;
float:right;
margin-right:0.95rem;
}
.numarea input{
height:0.5rem;
width:1rem;
background:#f5f5f5;
vertical-align: middle;
margin-right:0.05rem;
text-align:center;
font-size: 0.2rem;
}
.numarea input:focus {
border-color: #ff974b;
box-shadow: 0 0 8px rgba(255, 151, 75, 0.5);
}
.l_edit,.l_confirm{
color: #E52020;
}
.l_confirm{
display:none;
}
.row_sub{
height:0.68rem;
line-height:0.68rem;
width:90%;
margin:0 auto;
border-radius:0.34rem;
background: linear-gradient(to right,#FF4932,#FF2E47,#FE0E5E);
color:#fff;
text-align:center;
font-size:0.23rem;
}
</style>
</head>
<body class="row_body">
<header>
<div class="head redhead">
<a onclick="history.go(-1)">返回</a>
<span>盘点</span>
<span class="scan">
<i></i>
扫一扫
</span>
</div>
</header>
<div class="search_area">
<input type="text" placeholder="请输入商品内编码" class="row_input">
<span class="row_button">搜索</span>
</div>
<div class="edit_div">
<ul>
<!-- <li>
<div class="top_div">
<p><span class="label">系统系统内编码</span><span>4245ui3053045834058</span></p>
<p><span class="label">货位编码</span><span>新港库区-新港库区01-xgh01sdf</span></p>
</div>
<div class="bottom_div">
<p class="waresmc">冠生园蜂蜜 蜂蜜制品</p>
<div class="spec">
<span class="info">420克; 精选</span>
<div class="numarea">
<input type="number">
<span class="l_edit">编辑</span>
<span class="l_confirm">完成</span>
</div>
</div>
</div>
</li> -->
</ul>
</div>
<div style="padding:0.2rem 0;position:fixed;left:0;bottom:0;width:100%;">
<div class="row_sub">提交</div>
</div>
</body>
</html>
来源:https://www.cnblogs.com/liu-914/p/10757885.html