|
@@ -0,0 +1,87 @@
|
|
|
+package com.cnd3b.restcontroller.enterprise.activity;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.cnd3b.common.Controller;
|
|
|
+import com.cnd3b.common.D3bException;
|
|
|
+import com.cnd3b.common.data.Rows;
|
|
|
+import com.cnd3b.common.data.SQLFactory;
|
|
|
+import p2.pao.PaoRemote;
|
|
|
+import p2.pao.PaoSetRemote;
|
|
|
+import p2.util.P2Exception;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 扫码枪管理
|
|
|
+ */
|
|
|
+public class scanning extends Controller {
|
|
|
+ public scanning(JSONObject content) {
|
|
|
+ super(content);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 扫码枪列表查询
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String query_scanninglist() {
|
|
|
+ /**
|
|
|
+ * 过滤条件设置
|
|
|
+ */
|
|
|
+ StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
+ where.append(" and(");
|
|
|
+ where.append("t1.fecid like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.flocation like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t1.fnotes like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append("or t2.ftitle like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "扫码枪列表查询", pageSize, pageNumber, "t1.flocation");
|
|
|
+ sqlFactory.addParameter_SQL("where", where);
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+ return getSucReturnObject().setDataByPaging(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 扫码枪新增修改
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws D3bException
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String insertormodify_scanning() throws D3bException, P2Exception {
|
|
|
+ String fecid = content.getString("fecid", "tscanning.fecid", "设备码");
|
|
|
+ String flocation = content.getString("flocation", "tscanning.flocation", "位置");
|
|
|
+ String fnotes = content.getString("fnotes", "tscanning.fnotes", "设备描述");
|
|
|
+ long tactivityid = content.getLong("tactivityid");
|
|
|
+
|
|
|
+ PaoSetRemote tscanningSet = getP2ServerSystemPaoSet("tscanning", "fecid='" + fecid + "'");
|
|
|
+ PaoRemote tscanning = null;
|
|
|
+ if (tscanningSet.isEmpty()) {
|
|
|
+ tscanning = tscanningSet.addAtEnd();
|
|
|
+ tscanning.setValue("tactivityid", tactivityid, 11L);
|
|
|
+ tscanning.setValue("fecid", fecid, 11L);
|
|
|
+ tscanning.setValue("flocation", flocation, 11L);
|
|
|
+ tscanning.setValue("fnotes", fnotes, 11L);
|
|
|
+ tscanning.setValue("siteid", siteid, 11L);
|
|
|
+ tscanning.setValue("createdate", sysdate, 11L);
|
|
|
+ } else {
|
|
|
+ tscanning = tscanningSet.getPao(0);
|
|
|
+ }
|
|
|
+ tscanning.setValue("flocation", flocation, 11L);
|
|
|
+ tscanning.setValue("fnotes", fnotes, 11L);
|
|
|
+ tscanningSet.save();
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ public String delete_scanning() throws D3bException, P2Exception {
|
|
|
+ String fecid = content.getString("fecid");
|
|
|
+ dbConnect.runSqlUpdate("delete from tscanning where fecid='" + fecid + "' and siteid='" + siteid + "'");
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+}
|