Commit c7877de4 by yukang

Merge branch 'dev' of https://gitlab.baocloud.cn/bggf/smart/hp-smart into dev

parents cbb8fdc6 225364ef
......@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC008;
import com.baosight.hpjx.hp.pz.domain.HPPZ002;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
......@@ -76,6 +77,69 @@ public class ServiceHPKC008 extends ServiceBase {
}
return inInfo;
}
/**
* 保存
*
* @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++) {
HPKC008 fKc008 = new HPKC008();
fKc008.fromMap(resultRows.get(i));
if (fKc008.getId() == null || fKc008.getId() == 0) {
this.add(fKc008);
} else {
this.modify(fKc008);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fKc008
* @return
*/
public void add(HPKC008 fKc008) {
// 去除日期字符串中的-
fKc008.setDateMonth(StringUtil.removeHorizontalLine(fKc008.getDateMonth()));
// 存货名称
fKc008.setInventName(HPPZTools.HpPz004.getByCode(fKc008.getInventCode()).getInventName());
// 计算总金额
fKc008.setTotalPrice(fKc008.getAmount().multiply(fKc008.getPrice()));
// 生成单据号
fKc008.setStatNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC008_NUMBER));
DaoUtils.insert(HPKC008.INSERT, fKc008);
}
/**
* 修改操作
*
* @param fKc008
* @return
*/
public void modify(HPKC008 fKc008) {
// 去除日期字符串中的-
fKc008.setDateMonth(StringUtil.removeHorizontalLine(fKc008.getDateMonth()));
// 存货名称
fKc008.setInventName(HPPZTools.HpPz004.getByCode(fKc008.getInventCode()).getInventName());
// 计算总金额
fKc008.setTotalPrice(fKc008.getAmount().multiply(fKc008.getPrice()));
DaoUtils.update(HPKC008.UPDATE, fKc008);
}
/**
* 新增操作
......
......@@ -56,7 +56,7 @@
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"
hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="100" align="right" format="{0:N3}"/>
......
......@@ -35,9 +35,13 @@ $(function() {
refreshSelect(container, inInfo);
}
}],
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update'
||e.eiInfo.extAttr.methodName == 'insert'
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
......@@ -69,3 +73,42 @@ $(window).load(function () {
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['dateMonth'])) {
message("勾选的第" + (i + 1) + "行\"月份\"不能为空");
return;
}
if (isBlank(rows[i]['inventCode'])) {
message("勾选的第" + (i + 1) + "行\"存货名称\"不能为空");
return;
}
if (isBlank(rows[i]['unit'])) {
message("勾选的第" + (i + 1) + "行\"单位\"不能为空");
return;
}
if (!isPositiveInteger(rows[i]['amount'])) {
message("勾选的第" + (i + 1) + "行\"数量\"必须是大于0的整数");
return;
}
if (isBlank(rows[i]['price'])) {
message("勾选的第" + (i + 1) + "行\"单价\"不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC008", "save", true);
}
});
}
\ No newline at end of file
......@@ -89,22 +89,22 @@ function check(id, auditStatus) {
let projName= item.get("projName");
let princ1= item.get("princ1");
let princ2= item.get("princ2");
if(projType===""){
if(isBlank(projType)){
message("选中的第"+(index+1)+"行\"项目类型\",不能为空!");
flag = false;
return false;
}
if(projName===""){
if(isBlank(projName)){
message("选中的第"+(index+1)+"行\"项目名称\",不能为空!");
flag = false;
return false;
}
if(princ1===""){
if(isBlank(princ1)){
message("选中的第"+(index+1)+"行\"项目负责人\",不能为空!");
flag = false;
return false;
}
if(princ2===""){
if(isBlank(princ2)){
message("选中的第"+(index+1)+"行\"客户负责人\",不能为空!");
flag = false;
return false;
......
......@@ -584,22 +584,27 @@ function saveFunc() {
let prdtName= item.get("prdtName");
let num= item.get("num");
let unitWt= item.get("unitWt");
if(prdtType===""){
if(isBlank(prdtType)){
message("选中的第"+(index+1)+"行\"部件类型\",不能为空!");
flag = false;
return false;
}
if(prdtName===""){
if(isBlank(prdtName)){
message("选中的第"+(index+1)+"行\"部件名称\",不能为空!");
flag = false;
return false;
}
if(num===""){
if(isBlank(num)){
message("选中的第"+(index+1)+"行\"数量\",不能为空!");
flag = false;
return false;
}
if(unitWt===""){
if (!isPositiveInteger(num)) {
message("勾选的第" + (index + 1) + "行\"数量\"必须是大于0的整数");
flag = false;
return;
}
if(isBlank(unitWt)){
message("选中的第"+(index+1)+"行\"单重\",不能为空!");
flag = false;
return false;
......
......@@ -92,6 +92,24 @@ let save = function () {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['factoryCode'])) {
message("勾选的第" + (i + 1) + "行\"厂区\",不能为空");
return;
}
if (isBlank(rows[i]['orgNo'])) {
message("勾选的第" + (i + 1) + "行\"生产组\",不能为空");
return;
}
if (isBlank(rows[i]['num'])) {
message("勾选的第" + (i + 1) + "行\"分派数量\",不能为空");
return;
}
if (!isPositiveInteger(rows[i]['num'])) {
message("勾选的第" + (i + 1) + "行\"分派数量\"必须是大于0的整数");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC005A", "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