Commit afb75909 by wancheng

配置管理,必填项改成前台校验

parent e7740ae1
...@@ -72,6 +72,57 @@ public class ServiceHPPZ002 extends ServiceBase { ...@@ -72,6 +72,57 @@ public class ServiceHPPZ002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "供应商档案",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ002 fPz002 = new HPPZ002();
fPz002.fromMap(resultRows.get(i));
if (fPz002.getId() == null || fPz002.getId() == 0) {
this.add(fPz002);
} else {
this.modify(fPz002);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fPz002
* @return
*/
public void add(HPPZ002 fPz002) {
// 生成供应商编码
fPz002.setCustCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPPZ002_CUST_CODE));
DaoUtils.insert("HPPZ002.insert", fPz002);
}
/**
* 修改操作
*
* @param fPz002
* @return
*/
public void modify(HPPZ002 fPz002) {
DaoUtils.update("HPPZ002.update", fPz002);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "供应商档案",operType = "新增",operDesc = "新增") @OperationLogAnnotation(operModul = "供应商档案",operType = "新增",operDesc = "新增")
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
......
...@@ -69,6 +69,57 @@ public class ServiceHPPZ003 extends ServiceBase { ...@@ -69,6 +69,57 @@ public class ServiceHPPZ003 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "客户档案",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ003 fPz003 = new HPPZ003();
fPz003.fromMap(resultRows.get(i));
if (fPz003.getId() == null || fPz003.getId() == 0) {
this.add(fPz003);
} else {
this.modify(fPz003);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fPz003
* @return
*/
public void add(HPPZ003 fPz003) {
// 生成客户编码
fPz003.setCustCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPPZ003_CUST_CODE));
DaoUtils.insert("HPPZ003.insert", fPz003);
}
/**
* 修改操作
*
* @param fPz003
* @return
*/
public void modify(HPPZ003 fPz003) {
DaoUtils.update("HPPZ003.update", fPz003);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户档案",operType = "新增",operDesc = "新增") @OperationLogAnnotation(operModul = "客户档案",operType = "新增",operDesc = "新增")
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
......
...@@ -5,6 +5,7 @@ import com.baosight.hpjx.common.DdynamicEnum; ...@@ -5,6 +5,7 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InitiateModeEnum; import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ003;
import com.baosight.hpjx.hp.pz.domain.HPPZ004; import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -69,6 +70,58 @@ public class ServiceHPPZ004 extends ServiceBase { ...@@ -69,6 +70,58 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "存货类型",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ004 fPz004 = new HPPZ004();
fPz004.fromMap(resultRows.get(i));
if (fPz004.getId() == null || fPz004.getId() == 0) {
this.add(fPz004);
} else {
this.modify(fPz004);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fPz004
* @return
*/
public void add(HPPZ004 fPz004) {
// 生成编码
fPz004.setInventCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INVENT_CODE));
DaoUtils.insert(HPPZ004.INSERT, fPz004);
}
/**
* 修改操作
*
* @param fPz004
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "修改",operDesc = "修改")
public void modify(HPPZ004 fPz004) {
DaoUtils.update(HPPZ004.UPDATE, fPz004);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "新增",operDesc = "新增") @OperationLogAnnotation(operModul = "存货类型",operType = "新增",operDesc = "新增")
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
......
...@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.tools.HPKCTools; import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -72,6 +73,78 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -72,6 +73,78 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "存货档案",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
//this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
if (fPz006.getId() == null || fPz006.getId() == 0) {
this.add(fPz006);
} else {
this.modify(fPz006);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fPz006
* @return
*/
public void add(HPPZ006 fPz006) {
AssertUtils.isNull(fPz006.getInventType(), "存货类型不能为空");
AssertUtils.isEmpty(fPz006.getInventCode(), "存货名称不能为空");
// 去除空格
fPz006.setSpec(StringUtils.trimToEmpty(fPz006.getSpec()));
// 重复校验
Map queryParam = new HashMap();
queryParam.put("inventCode", fPz006.getInventCode());
queryParam.put("spec", fPz006.getSpec());
List<HPPZ006> dbPz006 = dao.query(HPPZ006.QUERY, queryParam);
AssertUtils.isNotEmpty(dbPz006, String.format("存货编码[%s]已存在规格[%s],请勿重复添加!", fPz006.getInventCode(),
fPz006.getSpec()));
// 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
DaoUtils.insert(HPPZ006.INSERT, fPz006);
}
/**
* 修改操作
*
* @param fPz006
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "修改",operDesc = "修改")
public void modify(HPPZ006 fPz006) {
// 校验是否存在库存
List<HPKC010> dbKc010s = HPKCTools.HpKc010.listBySpec(fPz006.getId());
AssertUtils.isEmpty(dbKc010s, String.format("档案[%s]已存在库存数量,不能进行修改", fPz006.getId()));
// 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(), fPz006.getWidth(), fPz006.getThick()));
DaoUtils.update(HPPZ006.UPDATE, fPz006);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "新增",operDesc = "新增") @OperationLogAnnotation(operModul = "存货档案",operType = "新增",operDesc = "新增")
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
......
...@@ -4,6 +4,7 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; ...@@ -4,6 +4,7 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
...@@ -62,6 +63,54 @@ public class ServiceHPPZ007 extends ServiceBase { ...@@ -62,6 +63,54 @@ public class ServiceHPPZ007 extends ServiceBase {
} }
/** /**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ007 fPz007 = new HPPZ007();
fPz007.fromMap(resultRows.get(i));
if (fPz007.getId() == null || fPz007.getId() == 0) {
this.add(fPz007);
} else {
this.modify(fPz007);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作.
*/
public void add(HPPZ007 fPz007) {
// 仓库编码
fPz007.setWhCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.WH_CODE));
DaoUtils.insert(HPPZ007.INSERT, fPz007);
}
/**
* 修改操作
*
* @param fPz007
*
*/
public void modify(HPPZ007 fPz007) {
DaoUtils.update(HPPZ007.UPDATE, fPz007);
}
/**
* 新增操作. * 新增操作.
*/ */
@OperationLogAnnotation(operModul = "仓库档案",operType = "新增",operDesc = "新增") @OperationLogAnnotation(operModul = "仓库档案",operType = "新增",operDesc = "新增")
......
...@@ -20,11 +20,20 @@ $(function() { ...@@ -20,11 +20,20 @@ $(function() {
} }
}], }],
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
} }
} }
...@@ -44,3 +53,82 @@ $(window).load(function () { ...@@ -44,3 +53,82 @@ $(window).load(function () {
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let custType= item.get("custType");
let custName= item.get("custName");
let companyName= item.get("companyName");
let headName= item.get("headName");
let phoneName= item.get("phoneName");
let address= item.get("address");
let status= item.get("status");
if(custType===""){
message("选中的第"+(index+1)+"行\"供应商类型\",不能为空!");
flag = false;
return false;
}
if(custName===""){
message("选中的第"+(index+1)+"行\"供应商名称\",不能为空!");
flag = false;
return false;
}
if(companyName===""){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false;
return false;
}
if(headName===""){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false;
return false;
}
if(phoneName===""){
message("选中的第"+(index+1)+"行\"负责人联系方式\",不能为空!");
flag = false;
return false;
}
if(address===""){
message("选中的第"+(index+1)+"行\"地址\",不能为空!");
flag = false;
return false;
}
if(status===""){
message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ002", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ002", "delete", true);
}
});
}
...@@ -20,11 +20,20 @@ $(function() { ...@@ -20,11 +20,20 @@ $(function() {
} }
}], }],
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
} }
} }
...@@ -44,3 +53,83 @@ $(window).load(function () { ...@@ -44,3 +53,83 @@ $(window).load(function () {
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let custType= item.get("custType");
let custName= item.get("custName");
let companyName= item.get("companyName");
let headName= item.get("headName");
let phoneName= item.get("phoneName");
let address= item.get("address");
let status= item.get("status");
if(custType===""){
message("选中的第"+(index+1)+"行\"客户类型\",不能为空!");
flag = false;
return false;
}
if(custName===""){
message("选中的第"+(index+1)+"行\"公司简称\",不能为空!");
flag = false;
return false;
}
if(companyName===""){
message("选中的第"+(index+1)+"行\"公司全称\",不能为空!");
flag = false;
return false;
}
if(headName===""){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false;
return false;
}
if(phoneName===""){
message("选中的第"+(index+1)+"行\"负责人联系方式\",不能为空!");
flag = false;
return false;
}
if(address===""){
message("选中的第"+(index+1)+"行\"地址\",不能为空!");
flag = false;
return false;
}
if(status===""){
message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ003", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ003", "delete", true);
}
});
}
...@@ -20,11 +20,20 @@ $(function() { ...@@ -20,11 +20,20 @@ $(function() {
} }
}], }],
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
} }
} }
...@@ -44,3 +53,59 @@ $(window).load(function () { ...@@ -44,3 +53,59 @@ $(window).load(function () {
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let inventType= item.get("inventType");
let inventName= item.get("inventName");
let status= item.get("status");
if(inventType===""){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false;
return false;
}
if(inventName===""){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false;
return false;
}
if(status===""){
message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ004", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ004", "delete", true);
}
});
}
...@@ -71,11 +71,20 @@ $(function() { ...@@ -71,11 +71,20 @@ $(function() {
} }
}], }],
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
} }
} }
...@@ -104,3 +113,71 @@ $(window).load(function () { ...@@ -104,3 +113,71 @@ $(window).load(function () {
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let inventType= item.get("inventType");
let inventCode= item.get("inventCode");
let material= item.get("material");
let unit= item.get("unit");
let status= item.get("status");
if(inventType===""){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false;
return false;
}
if(inventCode===""){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false;
return false;
}
if(material===""){
message("选中的第"+(index+1)+"行\"材质\",不能为空!");
flag = false;
return false;
}
if(unit===""){
message("选中的第"+(index+1)+"行\"单位\",不能为空!");
flag = false;
return false;
}
if(status===""){
message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ006", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ006", "delete", true);
}
});
}
...@@ -20,11 +20,20 @@ $(function() { ...@@ -20,11 +20,20 @@ $(function() {
} }
}], }],
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
} }
} }
...@@ -44,3 +53,65 @@ $(window).load(function () { ...@@ -44,3 +53,65 @@ $(window).load(function () {
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let whName= item.get("whName");
let whType= item.get("whType");
let princ= item.get("princ");
let status= item.get("status");
if(whName===""){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(whType===""){
message("选中的第"+(index+1)+"行\"仓库类型\",不能为空!");
flag = false;
return false;
}
if(princ===""){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false;
return false;
}
if(status===""){
message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ007", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ007", "delete", true);
}
});
}
...@@ -36,8 +36,7 @@ $(function () { ...@@ -36,8 +36,7 @@ $(function () {
deleteFunc(); deleteFunc();
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
...@@ -82,11 +81,34 @@ let save = function () { ...@@ -82,11 +81,34 @@ let save = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
let flag = true;
$.each(rows, function(index, item) {
let factoryName= item.get("factoryName");
let groupCode= item.get("groupCode");
let groupType= item.get("groupType");
if(factoryName===""){
message("选中的第"+(index+1)+"行\"厂区名称\",不能为空!");
flag = false;
return false;
}
if(groupCode===""){
message("选中的第"+(index+1)+"行\"生产组名称\",不能为空!");
flag = false;
return false;
}
if(groupType===""){
message("选中的第"+(index+1)+"行\"组类型\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HPPZ011", "save", true); JSUtils.submitGridsData("result", "HPPZ011", "save", true);
} }
}); });
}
} }
/** /**
......
...@@ -118,8 +118,7 @@ $(function () { ...@@ -118,8 +118,7 @@ $(function () {
deleteFunc(); deleteFunc();
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
...@@ -208,11 +207,46 @@ let save = function () { ...@@ -208,11 +207,46 @@ let save = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
let flag = true;
$.each(rows, function(index, item) {
let whCode= item.get("whCode");
let inventCode= item.get("inventCode");
let inventRecordId= item.get("inventRecordId");
let inventType= item.get("inventType");
let warnNum= item.get("warnNum");
if(inventType===""){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false;
return false;
}
if(whCode===""){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(inventCode===""){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false;
return false;
}
if(inventRecordId===""){
message("选中的第"+(index+1)+"行\"规格\",不能为空!");
flag = false;
return false;
}
if(warnNum===""){
message("选中的第"+(index+1)+"行\"预警值\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HPPZ012", "save", true); JSUtils.submitGridsData("result", "HPPZ012", "save", true);
} }
}); });
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment