Commit 32d282a6 by 宋祥

Merge branch 'dev' of http://129.211.46.84:8800/platform/hp-smart into dev-sx

parents eee3540b b90a3719
package com.baosight.hpjx.common;
/**
* @author LiuYang
* @version 1.0 2024/8/27
* @description 开票状态
*/
public enum BillStatusEnum {
/**
* 0:未开票
*/
UNBILL(1, "未开票"),
/**
* 1:已开票
*/
BILL(2, "已开票")
;
private Integer code;
private String desc;
BillStatusEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static String getDesc(Integer code) {
for (BillStatusEnum billStatusEnum : BillStatusEnum.values()) {
if (billStatusEnum.getCode().equals(code)) {
return billStatusEnum.getDesc();
}
}
return null;
}
public static Integer getCode(String desc) {
for (BillStatusEnum billStatusEnum : BillStatusEnum.values()) {
if (billStatusEnum.getDesc().equals(desc)) {
return billStatusEnum.getCode();
}
}
return null;
}
}
...@@ -2,11 +2,13 @@ package com.baosight.hpjx.hp.cw.service; ...@@ -2,11 +2,13 @@ package com.baosight.hpjx.hp.cw.service;
import com.baosight.eplat.utils.StringUtils; import com.baosight.eplat.utils.StringUtils;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.BillStatusEnum;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum; import com.baosight.hpjx.common.ReviewStatusEnum;
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.cw.domain.HPCW001; import com.baosight.hpjx.hp.cw.domain.HPCW001;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -131,12 +133,10 @@ public class ServiceHPCW001 extends ServiceEPBase { ...@@ -131,12 +133,10 @@ public class ServiceHPCW001 extends ServiceEPBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPCW001 hpcw001 = new HPCW001(); HPCW001 hpcw001 = new HPCW001();
hpcw001.fromMap(resultRows.get(i)); hpcw001.fromMap(resultRows.get(i));
if (hpcw001.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode())) { AssertUtils.isTrue(hpcw001.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode()),"该数据已审核,不能删除!");
throw new PlatException("该数据已审核,不能删除!"); AssertUtils.isTrue(hpcw001.getBillState().equals(BillStatusEnum.BILL.getCode()),"该数据已开票,不能删除!");
}
DaoUtils.update(HPCW001.DELETE, hpcw001); DaoUtils.update(HPCW001.DELETE, hpcw001);
} }
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -176,7 +176,7 @@ public class ServiceHPCW001 extends ServiceEPBase { ...@@ -176,7 +176,7 @@ public class ServiceHPCW001 extends ServiceEPBase {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPCW001 hpcw001 = new HPCW001(); HPCW001 hpcw001 = new HPCW001();
hpcw001.fromMap(resultRow); hpcw001.fromMap(resultRow);
hpcw001.setBillState(2); //1未开票2已开票 hpcw001.setBillState(BillStatusEnum.BILL.getCode()); //1未开票2已开票
DaoUtils.update(HPCW001.BILLING, hpcw001); DaoUtils.update(HPCW001.BILLING, hpcw001);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -7,9 +7,7 @@ import com.baosight.hpjx.common.ReviewStatusEnum; ...@@ -7,9 +7,7 @@ import com.baosight.hpjx.common.ReviewStatusEnum;
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.cw.domain.HPCW002; import com.baosight.hpjx.hp.cw.domain.HPCW002;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -125,18 +123,14 @@ public class ServiceHPCW002 extends ServiceEPBase { ...@@ -125,18 +123,14 @@ public class ServiceHPCW002 extends ServiceEPBase {
@Override @Override
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<HPCW002> hpcw002List = MapUtils.toDaoEPBases(inInfo, HPCW002.class);
for (Map resultRow : resultRows) { for (HPCW002 hpcw002 : hpcw002List) {
HPCW002 hpcw002 = new HPCW002(); AssertUtils.isTrue(hpcw002.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode()),"该数据已审核,不能删除!");
hpcw002.fromMap(resultRow);
if (hpcw002.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode())) {
throw new PlatException("该数据已审核,不能删除!");
}
DaoUtils.update(HPCW002.DELETE, hpcw002); DaoUtils.update(HPCW002.DELETE, hpcw002);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + hpcw002List.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败"); LogUtils.setDetailMsg(inInfo, e, "删除失败");
} }
......
...@@ -7,13 +7,11 @@ import com.baosight.hpjx.common.DdynamicEnum; ...@@ -7,13 +7,11 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum; import com.baosight.hpjx.common.ReviewStatusEnum;
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.cw.domain.HPCW001;
import com.baosight.hpjx.hp.cw.domain.HPCW003; import com.baosight.hpjx.hp.cw.domain.HPCW003;
import com.baosight.hpjx.hp.cw.domain.HPCW003A; import com.baosight.hpjx.hp.cw.domain.HPCW003A;
import com.baosight.hpjx.hp.cw.domain.HPCW004;
import com.baosight.hpjx.hp.cw.tools.HPCWTools; import com.baosight.hpjx.hp.cw.tools.HPCWTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
...@@ -129,11 +127,11 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -129,11 +127,11 @@ public class ServiceHPCW003 extends ServiceEPBase {
@Override @Override
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<HPCW003> hpcw003List = MapUtils.toDaoEPBases(inInfo, HPCW003.class);
for (Map resultRow : resultRows) { for (HPCW003 hpcw003 : hpcw003List) {
HPCW003 hpcw003 = new HPCW003(); AssertUtils.isTrue(hpcw003.getCancelStatus().equals(CancelStatusEnum.CANCEL.getCode()), "付款单[" + hpcw003.getIncomeNumber() + "]已核销,不能删除!");
hpcw003.fromMap(resultRow); AssertUtils.isTrue(hpcw003.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode()), "付款单[" + hpcw003.getIncomeNumber() + "]已审核,不能删除!");
List<HPCW003A> hpcw003AList = HPCWTools.HpCw003a.getMainId(hpcw003.getId()); List<HPCW003A> hpcw003AList = HPCWTools.Hpcw003a.getMainId(hpcw003.getId());
if (CollectionUtils.isNotEmpty(hpcw003AList)) { if (CollectionUtils.isNotEmpty(hpcw003AList)) {
for (HPCW003A hpcw003A : hpcw003AList) { for (HPCW003A hpcw003A : hpcw003AList) {
HPCWTools.Hpcw001.cutAmount(hpcw003A.getContractNumber(), HPCWTools.Hpcw001.cutAmount(hpcw003A.getContractNumber(),
...@@ -144,7 +142,7 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -144,7 +142,7 @@ public class ServiceHPCW003 extends ServiceEPBase {
DaoUtils.update(HPCW003.DELETE, hpcw003); DaoUtils.update(HPCW003.DELETE, hpcw003);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + hpcw003List.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败"); LogUtils.setDetailMsg(inInfo, e, "删除失败");
} }
...@@ -161,7 +159,7 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -161,7 +159,7 @@ public class ServiceHPCW003 extends ServiceEPBase {
mainId = queryRows.get(0).get("mainId").toString(); mainId = queryRows.get(0).get("mainId").toString();
} }
//获取相应的数据 //获取相应的数据
List<HPCW003A> hpcw003AList = HPCWTools.HpCw003a.mapToList(resultRows, NumberUtils.toLong(mainId)); List<HPCW003A> hpcw003AList = HPCWTools.Hpcw003a.mapToList(resultRows, NumberUtils.toLong(mainId));
DecimalFormat decimalFormat = new DecimalFormat("#.000"); DecimalFormat decimalFormat = new DecimalFormat("#.000");
if (CollectionUtils.isNotEmpty(hpcw003AList)) { if (CollectionUtils.isNotEmpty(hpcw003AList)) {
if (StringUtils.isEmpty(mainId)) { if (StringUtils.isEmpty(mainId)) {
...@@ -202,7 +200,7 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -202,7 +200,7 @@ public class ServiceHPCW003 extends ServiceEPBase {
DaoUtils.insert(HPCW003A.INSERT, hpcw003A); DaoUtils.insert(HPCW003A.INSERT, hpcw003A);
} }
}else { }else {
HPCW003 hpcw003 = HPCWTools.Hpcw003.getId(mainId); HPCW003 hpcw003 = HPCWTools.Hpcw003.getId(NumberUtils.toLong(mainId));
//Map<String, BigDecimal> rowMap = hpcw003AList.stream().collect(Collectors.toMap(HPCW003A::getContractNumber, HPCW003A::getTotalContractPriceIncluding)); //Map<String, BigDecimal> rowMap = hpcw003AList.stream().collect(Collectors.toMap(HPCW003A::getContractNumber, HPCW003A::getTotalContractPriceIncluding));
/*for (Map m : resultRows) { /*for (Map m : resultRows) {
...@@ -217,7 +215,7 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -217,7 +215,7 @@ public class ServiceHPCW003 extends ServiceEPBase {
HPCWTools.Hpcw001.cutAmount(hpcw003A.getContractNumber(), hpcw003A.getTotalContractPriceIncluding()); HPCWTools.Hpcw001.cutAmount(hpcw003A.getContractNumber(), hpcw003A.getTotalContractPriceIncluding());
DaoUtils.insert(HPCW003A.INSERT, hpcw003A); DaoUtils.insert(HPCW003A.INSERT, hpcw003A);
} }
List<HPCW003A> hpcw003s = HPCWTools.HpCw003a.getMainId(hpcw003.getId()); List<HPCW003A> hpcw003s = HPCWTools.Hpcw003a.getMainId(hpcw003.getId());
if (CollectionUtils.isNotEmpty(hpcw003s)) { if (CollectionUtils.isNotEmpty(hpcw003s)) {
// 更新主表 // 更新主表
BigDecimal totalContractPriceIncluding = hpcw003AList.stream().map(HPCW003A::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal totalContractPriceIncluding = hpcw003AList.stream().map(HPCW003A::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add);
...@@ -256,7 +254,7 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -256,7 +254,7 @@ public class ServiceHPCW003 extends ServiceEPBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPCW003 hpcw003 = new HPCW003(); HPCW003 hpcw003 = new HPCW003();
hpcw003.fromMap(resultRows.get(i)); hpcw003.fromMap(resultRows.get(i));
hpcw003.setReviewStatus(1); hpcw003.setReviewStatus(ReviewStatusEnum.REVIEWED.getCode());
DaoUtils.update(HPCW003.SUBMIT, hpcw003); DaoUtils.update(HPCW003.SUBMIT, hpcw003);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -273,7 +271,7 @@ public class ServiceHPCW003 extends ServiceEPBase { ...@@ -273,7 +271,7 @@ public class ServiceHPCW003 extends ServiceEPBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPCW003 hpcw003 = new HPCW003(); HPCW003 hpcw003 = new HPCW003();
hpcw003.fromMap(resultRows.get(i)); hpcw003.fromMap(resultRows.get(i));
hpcw003.setCancelStatus(2); hpcw003.setCancelStatus(CancelStatusEnum.CANCEL.getCode());
DaoUtils.update("HPCW003.writeoff", hpcw003); DaoUtils.update("HPCW003.writeoff", hpcw003);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -2,15 +2,20 @@ package com.baosight.hpjx.hp.cw.service; ...@@ -2,15 +2,20 @@ package com.baosight.hpjx.hp.cw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.cw.domain.HPCW001; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.cw.domain.HPCW003A; import com.baosight.hpjx.hp.cw.domain.HPCW003A;
import com.baosight.hpjx.hp.cw.tools.HPCWTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map;
/** /**
* @author LiuYang * @author LiuYang
...@@ -56,4 +61,92 @@ public class ServiceHPCW003A extends ServiceEPBase { ...@@ -56,4 +61,92 @@ public class ServiceHPCW003A extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "收款单",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HPCW003A> hpcw003AList = MapUtils.toDaoEPBases(inInfo, HPCW003A.class);
// 写入数据
Long parentId = null;
for (HPCW003A hpcw003A: hpcw003AList) {
parentId = hpcw003A.getParentId();
if (hpcw003A.getId() == null || hpcw003A.getId() == 0) {
this.add(hpcw003A);
} else {
// 回写数据
HPCW003A oldHGCW015 = HPCWTools.Hpcw003a.getId(hpcw003A.getId());
//先加再扣
HPCWTools.Hpcw001.cutAmount(
oldHGCW015.getContractNumber(),
oldHGCW015.getTotalContractPriceIncluding().multiply(new BigDecimal(-1))
);
this.modify(hpcw003A);
HPCWTools.Hpcw001.cutAmount(hpcw003A.getContractNumber(), hpcw003A.getTotalContractPriceIncluding());
}
}
// 更新主表
HPCWTools.Hpcw003.updateAmount(parentId);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hpcw003AList.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param hpcw003A
* @return
*/
public void add(HPCW003A hpcw003A) {
DaoUtils.insert(HPCW003A.INSERT, hpcw003A);
}
/**
* 修改操作
*
* @param hpcw003A
* @return
*/
public void modify(HPCW003A hpcw003A) {
DaoUtils.update(HPCW003A.UPDATE, hpcw003A);
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "收款单",operType = "删除",operDesc = "删除")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<HPCW003A> hpcw003AList = MapUtils.toDaoEPBases(inInfo, HPCW003A.class);
Long parentId = null;
for (HPCW003A hpcw003A:hpcw003AList) {
parentId = hpcw003A.getParentId();
DaoUtils.update(HPCW003A.DELETE, hpcw003A);
HPCWTools.Hpcw001.cutAmount(
hpcw003A.getContractNumber(),
hpcw003A.getTotalContractPriceIncluding().multiply(new BigDecimal(-1))
);
}
// 更新主表
HPCWTools.Hpcw003.updateAmount(parentId);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hpcw003AList.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
} }
...@@ -11,9 +11,7 @@ import com.baosight.hpjx.hp.cw.domain.HPCW002; ...@@ -11,9 +11,7 @@ import com.baosight.hpjx.hp.cw.domain.HPCW002;
import com.baosight.hpjx.hp.cw.domain.HPCW004; import com.baosight.hpjx.hp.cw.domain.HPCW004;
import com.baosight.hpjx.hp.cw.domain.HPCW004A; import com.baosight.hpjx.hp.cw.domain.HPCW004A;
import com.baosight.hpjx.hp.cw.tools.HPCWTools; import com.baosight.hpjx.hp.cw.tools.HPCWTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -129,11 +127,11 @@ public class ServiceHPCW004 extends ServiceEPBase { ...@@ -129,11 +127,11 @@ public class ServiceHPCW004 extends ServiceEPBase {
@Override @Override
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<HPCW004> hpcw004List = MapUtils.toDaoEPBases(inInfo, HPCW004.class);
for (Map resultRow : resultRows) { for (HPCW004 hpcw004 : hpcw004List) {
HPCW004 hgcw016 = new HPCW004(); AssertUtils.isTrue(hpcw004.getCancelStatus().equals(CancelStatusEnum.CANCEL.getCode()), "付款单[" + hpcw004.getIncomeNumber() + "]已核销,不能删除!");
hgcw016.fromMap(resultRow); AssertUtils.isTrue(hpcw004.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode()), "付款单[" + hpcw004.getIncomeNumber() + "]已审核,不能删除!");
List<HPCW004A> hpcw004AList = HPCWTools.Hpcw004a.getMainId(hgcw016.getId()); List<HPCW004A> hpcw004AList = HPCWTools.Hpcw004a.getMainId(hpcw004.getId());
if (CollectionUtils.isNotEmpty(hpcw004AList)) { if (CollectionUtils.isNotEmpty(hpcw004AList)) {
for (HPCW004A hpcw004A : hpcw004AList) { for (HPCW004A hpcw004A : hpcw004AList) {
HPCWTools.Hpcw002.cutAmount(hpcw004A.getContractNumber(), HPCWTools.Hpcw002.cutAmount(hpcw004A.getContractNumber(),
...@@ -141,10 +139,10 @@ public class ServiceHPCW004 extends ServiceEPBase { ...@@ -141,10 +139,10 @@ public class ServiceHPCW004 extends ServiceEPBase {
DaoUtils.update(HPCW004A.DELETE, hpcw004A); DaoUtils.update(HPCW004A.DELETE, hpcw004A);
} }
} }
DaoUtils.update(HPCW004.DELETE, hgcw016); DaoUtils.update(HPCW004.DELETE, hpcw004);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + hpcw004List.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败"); LogUtils.setDetailMsg(inInfo, e, "删除失败");
} }
...@@ -194,7 +192,7 @@ public class ServiceHPCW004 extends ServiceEPBase { ...@@ -194,7 +192,7 @@ public class ServiceHPCW004 extends ServiceEPBase {
DaoUtils.insert(HPCW004A.INSERT, hpcw004A); DaoUtils.insert(HPCW004A.INSERT, hpcw004A);
} }
}else { }else {
HPCW004 hpcw004 = HPCWTools.Hpcw004.getId(mainId); HPCW004 hpcw004 = HPCWTools.Hpcw004.getId(NumberUtils.toLong(mainId));
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
/*for (Map m : resultRows) { /*for (Map m : resultRows) {
...@@ -208,7 +206,6 @@ public class ServiceHPCW004 extends ServiceEPBase { ...@@ -208,7 +206,6 @@ public class ServiceHPCW004 extends ServiceEPBase {
// 反写金额 // 反写金额
HPCWTools.Hpcw002.cutAmount(hpcw004A.getContractNumber(),hpcw004A.getTotalContractPriceIncluding()); HPCWTools.Hpcw002.cutAmount(hpcw004A.getContractNumber(),hpcw004A.getTotalContractPriceIncluding());
DaoUtils.insert(HPCW004A.INSERT, hpcw004A); DaoUtils.insert(HPCW004A.INSERT, hpcw004A);
//this.addHGCW017(hgcw017);
} }
List<HPCW004A> hpcw004AS = HPCWTools.Hpcw004a.getMainId(hpcw004.getId()); List<HPCW004A> hpcw004AS = HPCWTools.Hpcw004a.getMainId(hpcw004.getId());
if (CollectionUtils.isNotEmpty(hpcw004AS)) { if (CollectionUtils.isNotEmpty(hpcw004AS)) {
...@@ -247,7 +244,7 @@ public class ServiceHPCW004 extends ServiceEPBase { ...@@ -247,7 +244,7 @@ public class ServiceHPCW004 extends ServiceEPBase {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPCW004 hpcw004 = new HPCW004(); HPCW004 hpcw004 = new HPCW004();
hpcw004.fromMap(resultRow); hpcw004.fromMap(resultRow);
hpcw004.setReviewStatus(1); hpcw004.setReviewStatus(ReviewStatusEnum.REVIEWED.getCode());
DaoUtils.update(HPCW004.SUBMIT, hpcw004); DaoUtils.update(HPCW004.SUBMIT, hpcw004);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -258,21 +255,24 @@ public class ServiceHPCW004 extends ServiceEPBase { ...@@ -258,21 +255,24 @@ public class ServiceHPCW004 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 核销操作
* @param inInfo
* @return
*/
public EiInfo writeoff(EiInfo inInfo){ public EiInfo writeoff(EiInfo inInfo){
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPCW004 hpcw004 = new HPCW004(); HPCW004 hpcw004 = new HPCW004();
hpcw004.fromMap(resultRow); hpcw004.fromMap(resultRow);
hpcw004.setCancelStatus(2); hpcw004.setCancelStatus(CancelStatusEnum.CANCEL.getCode());
if (hpcw004.getReviewStatus() == 0) { AssertUtils.isTrue(hpcw004.getCancelStatus() == 0, "请先审批!");
throw new PlatException("请先审核!");
}
DaoUtils.update("HPCW004.writeoff", hpcw004); DaoUtils.update("HPCW004.writeoff", hpcw004);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据核销成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据核销成功!");
} catch (Exception e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
return inInfo; return inInfo;
......
...@@ -2,18 +2,20 @@ package com.baosight.hpjx.hp.cw.service; ...@@ -2,18 +2,20 @@ package com.baosight.hpjx.hp.cw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.cw.domain.HPCW002;
import com.baosight.hpjx.hp.cw.domain.HPCW004;
import com.baosight.hpjx.hp.cw.domain.HPCW004A; import com.baosight.hpjx.hp.cw.domain.HPCW004A;
import com.baosight.hpjx.hp.cw.tools.HPCWTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants; import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map;
/** /**
* @author LiuYang * @author LiuYang
...@@ -58,4 +60,93 @@ public class ServiceHPCW004A extends ServiceEPBase { ...@@ -58,4 +60,93 @@ public class ServiceHPCW004A extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "付款单",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
Long parentId = null;
for (Map resultRow : resultRows) {
HPCW004A hpcw004A = new HPCW004A();
hpcw004A.fromMap(resultRow);
parentId = hpcw004A.getParentId();
if (hpcw004A.getId() == null || hpcw004A.getId() == 0) {
this.add(hpcw004A);
} else {
// 回写数据
HPCW004A oldHgcw017 = HPCWTools.Hpcw004a.getId(hpcw004A.getId());
//先加再扣
HPCWTools.Hpcw002.cutAmount(oldHgcw017.getContractNumber(),
oldHgcw017.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
this.modify(hpcw004A);
HPCWTools.Hpcw002.cutAmount(hpcw004A.getContractNumber(),
hpcw004A.getTotalContractPriceIncluding());
}
}
// 更新主表
HPCWTools.Hpcw004.updateAmount(parentId);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param hgcw017
* @return
*/
public void add(HPCW004A hgcw017) {
DaoUtils.insert(HPCW004A.INSERT, hgcw017);
}
/**
* 修改操作
*
* @param hgcw017
* @return
*/
public void modify(HPCW004A hgcw017) {
DaoUtils.update(HPCW004A.UPDATE, hgcw017);
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "付款单",operType = "删除",operDesc = "删除")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HPCW004A> hpcw004As = MapUtils.toDaoEPBases(resultRows, HPCW004A.class);
Long parentId = null;
for (HPCW004A hpcw004A:hpcw004As) {
parentId = hpcw004A.getParentId();
DaoUtils.update(HPCW004A.UPDATE, hpcw004A);
HPCWTools.Hpcw002.cutAmount(
hpcw004A.getContractNumber(),
hpcw004A.getTotalContractPriceIncluding().multiply(new BigDecimal(-1))
);
}
// 更新主表
HPCWTools.Hpcw004.updateAmount(parentId);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
} }
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
) )
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #factoryCode#, #factoryName#, #contractNumber#, #incomeNumber#, #signingDate#, #partyA#, #cancelStatus#, #reviewStatus#, #totalContractPriceIncluding#) VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #factoryCode#, #factoryName#, #contractNumber#, #incomeNumber#, #signingDate#, #partyA#, #cancelStatus#, #reviewStatus#, #totalContractPriceIncluding#)
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hpjxSchema}.T_HPCW003 SELECT MAX(ID) AS "id" FROM ${hpjxSchema}.T_HPCW004
</selectKey> </selectKey>
</insert> </insert>
......
...@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.dao.DaoUtils; ...@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.cw.domain.*; import com.baosight.hpjx.hp.cw.domain.*;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.iplat4j.core.ProjectInfo; import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -33,18 +34,23 @@ public class HPCWTools { ...@@ -33,18 +34,23 @@ public class HPCWTools {
public static HPCW001 getId(String id) { public static HPCW001 getId(String id) {
AssertUtils.isNull(id, "销售开票单ID不能为空!"); AssertUtils.isNull(id, "销售开票单ID不能为空!");
List<HPCW001> results = DaoBase.getInstance().query(HPCW001.QUERY,new HashMap<String,Object>(){ List<HPCW001> results = DaoBase.getInstance().query(HPCW001.QUERY, new HashMap<String, Object>() {
{put("id",id);} {
put("id", id);
}
}); });
return results.get(0); return results.get(0);
} }
public static void cutAmount(String billNumber, BigDecimal cutAmount) { public static void cutAmount(String billNumber, BigDecimal cutAmount) {
AssertUtils.isNull(billNumber, "来源单号不能为空!"); AssertUtils.isNull(billNumber, "发票号不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!"); // throw new PlatException("扣款金额不能小于等于0!");
// } // }
List<HPCW001> results = DaoBase.getInstance().query(HPCW001.QUERY,new HashMap<String,Object>(){ List<HPCW001> results = DaoBase.getInstance().query(HPCW001.QUERY, new HashMap<String, Object>() {
{put(HPCW001.FIELD_BILL_NUMBER,billNumber);} {
put(HPCW001.FIELD_BILL_NUMBER, billNumber);
}
}); });
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的销售开票记录!"); throw new PlatException("找不到对应的销售开票记录!");
...@@ -64,8 +70,10 @@ public class HPCWTools { ...@@ -64,8 +70,10 @@ public class HPCWTools {
public static class Hpcw002 { public static class Hpcw002 {
public static HPCW002 getId(String id) { public static HPCW002 getId(String id) {
AssertUtils.isNull(id, "采购收票单ID不能为空!"); AssertUtils.isNull(id, "采购收票单ID不能为空!");
List<HPCW002> results = DaoBase.getInstance().query(HPCW002.QUERY,new HashMap<String,Object>(){ List<HPCW002> results = DaoBase.getInstance().query(HPCW002.QUERY, new HashMap<String, Object>() {
{put("id",id);} {
put("id", id);
}
}); });
return results.get(0); return results.get(0);
} }
...@@ -75,8 +83,10 @@ public class HPCWTools { ...@@ -75,8 +83,10 @@ public class HPCWTools {
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!"); // throw new PlatException("扣款金额不能小于等于0!");
// } // }
List<HPCW002> results = DaoBase.getInstance().query(HPCW002.QUERY,new HashMap<String,Object>(){ List<HPCW002> results = DaoBase.getInstance().query(HPCW002.QUERY, new HashMap<String, Object>() {
{put(HPCW002.FIELD_BILL_NUMBER,billNumber);} {
put(HPCW002.FIELD_BILL_NUMBER, billNumber);
}
}); });
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的采购收票记录!"); throw new PlatException("找不到对应的采购收票记录!");
...@@ -91,6 +101,7 @@ public class HPCWTools { ...@@ -91,6 +101,7 @@ public class HPCWTools {
DaoUtils.update("HPCW002.updateDeductionAmount", hpcw002); DaoUtils.update("HPCW002.updateDeductionAmount", hpcw002);
} }
public static List<HPCW002> checkList(Map paramMap) { public static List<HPCW002> checkList(Map paramMap) {
AssertUtils.isEmpty(paramMap, "数据检查参数不能为空"); AssertUtils.isEmpty(paramMap, "数据检查参数不能为空");
return DaoBase.getInstance().query("HGCW012.queryCheckList", paramMap); return DaoBase.getInstance().query("HGCW012.queryCheckList", paramMap);
...@@ -98,13 +109,14 @@ public class HPCWTools { ...@@ -98,13 +109,14 @@ public class HPCWTools {
/** /**
* 根据收货号查询 * 根据收货号查询
*
* @param receiveNo 收货单号 * @param receiveNo 收货单号
* @return Map * @return Map
*/ */
public static Map getReceiveNo(String receiveNo){ public static Map getReceiveNo(String receiveNo) {
AssertUtils.isEmpty(receiveNo, "发票号不能为空"); AssertUtils.isEmpty(receiveNo, "发票号不能为空");
Map queryMap = new HashMap<>(); Map queryMap = new HashMap<>();
queryMap.put(HPCW002.FIELD_SETTLEMENT_NUMBER,receiveNo); queryMap.put(HPCW002.FIELD_SETTLEMENT_NUMBER, receiveNo);
List<Map> list = DaoBase.getInstance().query("HPCW002.queryInvoicing", queryMap); List<Map> list = DaoBase.getInstance().query("HPCW002.queryInvoicing", queryMap);
return list.size() > 0 ? list.get(0) : null; return list.size() > 0 ? list.get(0) : null;
} }
...@@ -112,16 +124,41 @@ public class HPCWTools { ...@@ -112,16 +124,41 @@ public class HPCWTools {
public static class Hpcw003 { public static class Hpcw003 {
public static HPCW003 getId(String id) { public static HPCW003 getId(Long id) {
AssertUtils.isNull(id, "收款单ID不能为空!"); AssertUtils.isNull(id, "收款单ID不能为空!");
List<HPCW003> results = DaoBase.getInstance().query(HPCW003.QUERY,new HashMap<String,Object>(){ List<HPCW003> results = DaoBase.getInstance().query(HPCW003.QUERY, new HashMap<String, Object>() {
{put("id",id);} {
put("id", id);
}
}); });
return results.get(0); return results.get(0);
} }
public static void updateAmount(Long id) {
AssertUtils.isNull(id, "收款单ID不能为空!");
HPCW003 hpcw003 = getId(id);
List<HPCW003A> hgcw015s = Hpcw003a.getMainId(hpcw003.getId());
if (CollectionUtils.isNotEmpty(hgcw015s)) {
// 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer contractNumber = new StringBuffer();
for (HPCW003A hgcw015 : hgcw015s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw015.getTotalContractPriceIncluding());
contractNumber.append(hgcw015.getContractNumber()).append(",");
}
hpcw003.setTotalContractPriceIncluding(totalContractPriceIncluding);
hpcw003.setPartyA(hgcw015s.get(0).getPartyA());
hpcw003.setProjCode(hgcw015s.get(0).getProjCode());
hpcw003.setProjName(hgcw015s.get(0).getProjName());
hpcw003.setContractNumber(contractNumber.toString().substring(0, contractNumber.length() - 1));
DaoUtils.update(HPCW003.UPDATE, hpcw003);
}
}
} }
public static class HpCw003a { public static class Hpcw003a {
public static HPCW003A getId(Long id) { public static HPCW003A getId(Long id) {
AssertUtils.isNull(id, "收款单ID不能为空!"); AssertUtils.isNull(id, "收款单ID不能为空!");
List<HPCW003A> results = DaoBase.getInstance().query(HPCW003A.QUERY,new HashMap<String,Object>(){ List<HPCW003A> results = DaoBase.getInstance().query(HPCW003A.QUERY,new HashMap<String,Object>(){
...@@ -137,6 +174,7 @@ public class HPCWTools { ...@@ -137,6 +174,7 @@ public class HPCWTools {
HPCW003A hpcw003A = new HPCW003A(); HPCW003A hpcw003A = new HPCW003A();
hpcw003A.fromMap(row); hpcw003A.fromMap(row);
hpcw003A.setId(null); hpcw003A.setId(null);
hpcw003A.setCompanyCode(null);
hpcw003A.setDepCode(null); hpcw003A.setDepCode(null);
hpcw003A.setCreatedBy(null); hpcw003A.setCreatedBy(null);
hpcw003A.setCreatedName(null); hpcw003A.setCreatedName(null);
...@@ -167,13 +205,32 @@ public class HPCWTools { ...@@ -167,13 +205,32 @@ public class HPCWTools {
} }
public static class Hpcw004 { public static class Hpcw004 {
public static HPCW004 getId(String id) { public static HPCW004 getId(Long id) {
AssertUtils.isNull(id, "付款单ID不能为空!"); AssertUtils.isNull(id, "付款单ID不能为空!");
List<HPCW004> results = DaoBase.getInstance().query(HPCW004.QUERY,new HashMap<String,Object>(){ List<HPCW004> results = DaoBase.getInstance().query(HPCW004.QUERY,new HashMap<String,Object>(){
{put("id",id);} {put("id",id);}
}); });
return results.get(0); return results.get(0);
} }
public static void updateAmount(Long id) {
AssertUtils.isNull(id, "收款单ID不能为空!");
HPCW004 hpcw004 = getId(id);
List<HPCW004A> hpcw004AS = HPCWTools.Hpcw004a.getMainId(hpcw004.getId());
if (CollectionUtils.isNotEmpty(hpcw004AS)) {
// 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer contractNumber = new StringBuffer();
for (HPCW004A hgcw017 : hpcw004AS) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw017.getTotalContractPriceIncluding());
contractNumber.append(hgcw017.getContractNumber()).append(",");
}
hpcw004.setTotalContractPriceIncluding(totalContractPriceIncluding);
hpcw004.setPartyA(hpcw004AS.get(0).getPartyA());
hpcw004.setContractNumber(contractNumber.toString().substring(0, contractNumber.length() - 1));
DaoUtils.update(HPCW004.UPDATE, hpcw004);
}
}
} }
public static class Hpcw004a { public static class Hpcw004a {
...@@ -192,6 +249,7 @@ public class HPCWTools { ...@@ -192,6 +249,7 @@ public class HPCWTools {
HPCW004A hpcw004A = new HPCW004A(); HPCW004A hpcw004A = new HPCW004A();
hpcw004A.fromMap(row); hpcw004A.fromMap(row);
hpcw004A.setId(null); hpcw004A.setId(null);
hpcw004A.setCompanyCode(null);
hpcw004A.setDepCode(null); hpcw004A.setDepCode(null);
hpcw004A.setCreatedBy(null); hpcw004A.setCreatedBy(null);
hpcw004A.setCreatedName(null); hpcw004A.setCreatedName(null);
......
...@@ -157,7 +157,7 @@ public class HPSC004 extends DaoEPBase { ...@@ -157,7 +157,7 @@ public class HPSC004 extends DaoEPBase {
private BigDecimal actualCompletionNum = new BigDecimal("0"); /* 实际完工数量*/ private BigDecimal actualCompletionNum = new BigDecimal("0"); /* 实际完工数量*/
private BigDecimal actualCompletionUnitWt = new BigDecimal("0"); /* 实际完工重量*/ private BigDecimal actualCompletionUnitWt = new BigDecimal("0"); /* 实际完工重量*/
private Long inventRecordId; /* 项目档案ID*/ private Long inventRecordId; /* 项目档案ID*/
private Integer status; /* 状态 0-未审核,1-已审核*/ private Integer status = 0; /* 状态 0-未审核,1-已审核*/
private String remark = " "; /* 备注*/ private String remark = " "; /* 备注*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/ private String createdName = " "; /* 创建人名称*/
...@@ -165,7 +165,7 @@ public class HPSC004 extends DaoEPBase { ...@@ -165,7 +165,7 @@ public class HPSC004 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/ private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/ private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private Integer delStatus; /* 状态:0未删除,1已删除*/ private Integer delStatus = 0; /* 状态:0未删除,1已删除*/
private String deliveryDate = " "; private String deliveryDate = " ";
private String factoryCode = " "; /* 工厂代码*/ private String factoryCode = " "; /* 工厂代码*/
......
...@@ -54,6 +54,7 @@ public class ServiceHPSC003 extends ServiceBase { ...@@ -54,6 +54,7 @@ public class ServiceHPSC003 extends ServiceBase {
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "生产计划",operType = "查询",operDesc = "初始化") @OperationLogAnnotation(operModul = "生产计划",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID,DdynamicEnum.INVENT_NAME_BLOCK_ID), CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID,DdynamicEnum.INVENT_NAME_BLOCK_ID),
new HashMap<String,Object>(){{put("inventType",4);}}); new HashMap<String,Object>(){{put("inventType",4);}});
...@@ -119,6 +120,7 @@ public class ServiceHPSC003 extends ServiceBase { ...@@ -119,6 +120,7 @@ public class ServiceHPSC003 extends ServiceBase {
* 修改操作. * 修改操作.
*/ */
@OperationLogAnnotation(operModul = "生产计划",operType = "修改",operDesc = "修改") @OperationLogAnnotation(operModul = "生产计划",operType = "修改",operDesc = "修改")
@Override
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
HPSC003 hpsc003 = new HPSC003(); HPSC003 hpsc003 = new HPSC003();
...@@ -392,5 +394,38 @@ public class ServiceHPSC003 extends ServiceBase { ...@@ -392,5 +394,38 @@ public class ServiceHPSC003 extends ServiceBase {
} }
} }
@OperationLogAnnotation(operModul = "生产计划", operType = "排产", operDesc = "提交排产")
public EiInfo submitProduc(EiInfo inInfo) {
try {
List<HPSC003> hpsc003s = MapUtils.toDaoEPBases(inInfo, HPSC003.class);
for (HPSC003 hpsc003 : hpsc003s) {
List<HPSC004> hpsc004s = HPSCTools.HpSc004.queryByParent(hpsc003.getPlanInfoNo());
for (HPSC004 hpsc004:hpsc004s) {
String startDate =handleEndDate(hpsc004.getPlanCommentDate());
String endDate =handleEndDate(hpsc004.getPlanCompletionDate());
hpsc004.setPlanCommentDate(startDate);
hpsc004.setPlanCompletionDate(endDate);
DaoUtils.update(HPSC004.UPDATE, hpsc004);
}
String planCompletionDate =handleEndDate(hpsc003.getPlanCompletionDate());
hpsc003.setPlanCompletionDate(planCompletionDate);
DaoUtils.update(HPSC003.UPDATE, hpsc003);
}
}catch (PlatException e){
LogUtils.setMsg(inInfo,e,"提交排产失败");
}
return inInfo;
}
/**
* 处理计划完成日期
* @param endDate 计划完成日期
* @return 处理后的计划完成日期减3天
*/
private static String handleEndDate(String endDate){
if(StringUtils.isNotBlank(endDate)){
endDate = DateUtils.toDateStr(DateUtils.addDays(DateUtils.toDate(endDate,DateUtils.DATE8_PATTERN),-3),DateUtils.DATE8_PATTERN);
}
return endDate;
}
} }
...@@ -11,6 +11,8 @@ import com.baosight.hpjx.hp.sc.domain.HPSC005; ...@@ -11,6 +11,8 @@ import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A; import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
...@@ -21,12 +23,11 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -21,12 +23,11 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
/** /**
* 生产任务 * 生产任务
...@@ -276,6 +277,70 @@ public class ServiceHPSC005A extends ServiceBase { ...@@ -276,6 +277,70 @@ public class ServiceHPSC005A extends ServiceBase {
} }
/** /**
* 分派
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "拆单派工",operType = "改派",operDesc = "生产订单-拆单派工A-改派")
public EiInfo assignChange(EiInfo inInfo) {
try {
String[] prodOrderNos = inInfo.getString("prodOrderNos").split(","); //生产订单号
String factoryCode = inInfo.getString("factoryCode");
String factoryName = inInfo.getString("factoryName");
String groupCode = inInfo.getString("groupCode");
String groupName = inInfo.getString("groupName");
// 校验主订单是否已分派
List<HPSC005> hgsc005List = HPSCTools.HpSc005.get(Arrays.asList(prodOrderNos));
AssertUtils.isTrue(CollectionUtils.isEmpty(hgsc005List), "未找到生产订单信息");
//List<String> prodOrderNos = hgsc005List.stream().map(HPSC005::getProdOrderNo).collect(Collectors.toList());
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(Arrays.asList(prodOrderNos));
List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(Arrays.asList(prodOrderNos));
AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法改派");
// 锁主单号
HPSCTools.HpSc005a.lock(Arrays.asList(prodOrderNos));
for (HPSC005A hgsc005A : hgsc005AList) {
hgsc005A.setOrgNo(groupCode);
hgsc005A.setOrgName(groupName);
hgsc005A.setFactoryCode(factoryCode);
hgsc005A.setFactoryName(factoryName);
DaoUtils.update("HPSC005A.updateFactoryCode", hgsc005A);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + prodOrderNos.length + "]条数据改派成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "改派失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "拆单派工",operType = "撤销",operDesc = "生产订单-拆单派工A-撤销")
public EiInfo revocation(EiInfo inInfo) {
try {
List<HPSC005> hgsc005List =MapUtils.toDaoEPBases(inInfo, HPSC005.class);
List<String> prodOrderNos =hgsc005List.stream().map(HPSC005::getProdOrderNo).collect(Collectors.toList());
List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(prodOrderNos);
AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法撤销");
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(prodOrderNos);
for (HPSC005 hgsc005:hgsc005List) {
hgsc005.setStatus(ProdOrderStatusEnum.NOT_ASSIGN.getCode());
hgsc005.setAssignedNum(BigDecimal.ZERO);
hgsc005.setUnassignedNum(hgsc005.getNum());
DaoUtils.update(HPSC005.UPDATE, hgsc005);
}
hgsc005AList.forEach(hgsc005A -> DaoUtils.update(HPSC005A.DELETE, hgsc005A));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + 1 + "]条数据撤销成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "撤销失败");
}
return inInfo;
}
/**
* 设置基础信息 * 设置基础信息
* *
* @param fSc005a * @param fSc005a
......
...@@ -129,6 +129,9 @@ ...@@ -129,6 +129,9 @@
<isNotEmpty prepend=" AND " property="matIds"> <isNotEmpty prepend=" AND " property="matIds">
MAT_ID IN <iterate close=")" open="(" conjunction="," property="matIds">#matIds[]#</iterate> MAT_ID IN <iterate close=")" open="(" conjunction="," property="matIds">#matIds[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNos">
PROD_ORDER_NO IN <iterate close=")" open="(" conjunction="," property="prodOrderNos">#prodOrderNos[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="authCondition"> <sql id="authCondition">
......
...@@ -92,6 +92,9 @@ ...@@ -92,6 +92,9 @@
<isNotEmpty prepend=" AND " property="prodTaskNos"> <isNotEmpty prepend=" AND " property="prodTaskNos">
PROD_TASK_NO IN <iterate close=")" open="(" conjunction="," property="prodTaskNos">#prodTaskNos[]#</iterate> PROD_TASK_NO IN <iterate close=")" open="(" conjunction="," property="prodTaskNos">#prodTaskNos[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNos">
PROD_ORDER_NO IN <iterate close=")" open="(" conjunction="," property="prodOrderNos">#prodOrderNos[]#</iterate>
</isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
...@@ -179,6 +182,18 @@ ...@@ -179,6 +182,18 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<!-- 工厂生产班组 -->
<update id="updateFactoryCode">
UPDATE ${hpjxSchema}.T_HPSC005A
SET
FACTORY_CODE = #factoryCode#,
FACTORY_NAME = #factoryName#,
ORG_NO = #orgNo#,
ORG_NAME = #orgName#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<!-- 已完成数量 --> <!-- 已完成数量 -->
<update id="updateCompleteNum"> <update id="updateCompleteNum">
UPDATE ${hpjxSchema}.T_HPSC005A UPDATE ${hpjxSchema}.T_HPSC005A
......
...@@ -723,6 +723,20 @@ public class HPSCTools { ...@@ -723,6 +723,20 @@ public class HPSCTools {
AssertUtils.isEmpty(results, String.format("生产任务ID[%s]信息不存在", id)); AssertUtils.isEmpty(results, String.format("生产任务ID[%s]信息不存在", id));
return results.get(0); return results.get(0);
} }
/**
* 查询
*
* @param ids
* @return
*/
public static List<HPSC005> getById(List<String> ids) {
AssertUtils.isNull(ids, "生产任务ID不能为空");
Map queryMap = new HashMap();
queryMap.put("ids", ids);
List<HPSC005> results = DaoBase.getInstance().query(HPSC005.QUERY, queryMap);
AssertUtils.isEmpty(results, String.format("生产任务ID[%s]信息不存在", ids));
return CollectionUtils.isEmpty(results)?null:results;
}
/** /**
* 查询 * 查询
...@@ -798,6 +812,20 @@ public class HPSCTools { ...@@ -798,6 +812,20 @@ public class HPSCTools {
} }
/** /**
* 批量查询订单号
*
* @param prodOrderNos
* @return
*/
public static List<HPSC005> get(List<String> prodOrderNos) {
AssertUtils.isEmpty(prodOrderNos, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("prodOrderNos", prodOrderNos);
List<HPSC005> results = DaoBase.getInstance().query(HPSC005.QUERY, queryMap);
return CollectionUtils.isEmpty(results)?null:results;
}
/**
* 查询 * 查询
* *
* @param matId 物料ID * @param matId 物料ID
...@@ -951,7 +979,7 @@ public class HPSCTools { ...@@ -951,7 +979,7 @@ public class HPSCTools {
/** /**
* 查询信息 * 查询信息
* *
* @param prodTaskNo * @param prodTaskNo 生产任务单号
* @return * @return
*/ */
public static HPSC005A get(String prodTaskNo) { public static HPSC005A get(String prodTaskNo) {
...@@ -966,7 +994,7 @@ public class HPSCTools { ...@@ -966,7 +994,7 @@ public class HPSCTools {
/** /**
* 查询信息 * 查询信息
* *
* @param prodTaskNos * @param prodTaskNos 生产任务单号
* @return * @return
*/ */
public static List<HPSC005A> list(List<String> prodTaskNos) { public static List<HPSC005A> list(List<String> prodTaskNos) {
...@@ -1005,6 +1033,19 @@ public class HPSCTools { ...@@ -1005,6 +1033,19 @@ public class HPSCTools {
return DaoBase.getInstance().query(HPSC005A.QUERY, queryMap); return DaoBase.getInstance().query(HPSC005A.QUERY, queryMap);
} }
/**
* 查询信息
*
* @param prodOrderNos 生产订单号
* @return
*/
public static List<HPSC005A> getByProdOrderNo(List<String> prodOrderNos) {
AssertUtils.isEmpty(prodOrderNos, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("prodOrderNos", prodOrderNos);
return DaoBase.getInstance().query(HPSC005A.QUERY, queryMap);
}
} }
/** /**
......
...@@ -106,6 +106,9 @@ ...@@ -106,6 +106,9 @@
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNos">
PROD_ORDER_NO IN <iterate close=")" open="(" conjunction="," property="prodOrderNos">#prodOrderNos[]#</iterate>
</isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
......
...@@ -50,6 +50,23 @@ public class HPZLTools { ...@@ -50,6 +50,23 @@ public class HPZLTools {
return results.get(0); return results.get(0);
} }
/**
* 查询质检生产订单
*
* @param prodOrderNos
* @return
*/
public static List<HPZL001> getByprodOrderNos(List<String> prodOrderNos) {
if (CollectionUtils.isEmpty(prodOrderNos)){
return null;
}
Map queryMap = new HashMap();
queryMap.put("prodOrderNos", prodOrderNos);
queryMap.put("deleteFlag", 0);
List<HPZL001> results = DaoBase.getInstance().query(HPZL001.QUERY, queryMap);
return CollectionUtils.isEmpty(results)? null:results;
}
/** /**
* 整改通知单 * 整改通知单
......
...@@ -40,6 +40,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -40,6 +40,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM"); public static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM");
public static final DateTimeFormatter CHINA_DATE = DateTimeFormatter.ofPattern("yyyy年MM月dd月"); public static final DateTimeFormatter CHINA_DATE = DateTimeFormatter.ofPattern("yyyy年MM月dd月");
public static final String DATE8_PATTERN = "yyyyMMdd"; public static final String DATE8_PATTERN = "yyyyMMdd";
public static final String DATE10_PATTERN = "yyyy-MM-dd";
/** /**
* 获取上个月的1号日期 * 获取上个月的1号日期
......
...@@ -185,7 +185,7 @@ function saveFunc(btn) { ...@@ -185,7 +185,7 @@ function saveFunc(btn) {
JSUtils.submitGridsData("result", "HPCW001", "save", true, JSUtils.submitGridsData("result", "HPCW001", "save", true,
function (e) { function (e) {
//detailGrid.setEiInfo(e); //detailGrid.setEiInfo(e);
//query(); query();
}); });
//释放禁用按钮 //释放禁用按钮
btn.attr("disabled", false); btn.attr("disabled", false);
...@@ -211,6 +211,9 @@ function fileDetailFunc(id) { ...@@ -211,6 +211,9 @@ function fileDetailFunc(id) {
}); });
} }
/**
* 审核
*/
function submitFunc() { function submitFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length != 1) { if (rows.length != 1) {
...@@ -245,6 +248,9 @@ function submitFunc() { ...@@ -245,6 +248,9 @@ function submitFunc() {
} }
} }
/**
* 开票
*/
function billFunc() { function billFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length != 1) { if (rows.length != 1) {
...@@ -257,12 +263,11 @@ function billFunc() { ...@@ -257,12 +263,11 @@ function billFunc() {
message("勾选的数据中有已经开票的票据!"); message("勾选的数据中有已经开票的票据!");
flag = false; flag = false;
} }
if (row.billNumber == " ") { if (isBlank(row.billNumber)) {
message("勾选的数据中发票号为空"); message("勾选的数据中发票号为空");
flag = false; flag = false;
} }
} })
)
if (flag) { if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"开票\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"开票\"操作? ", {
......
...@@ -112,11 +112,15 @@ function updateFunc() { ...@@ -112,11 +112,15 @@ function updateFunc() {
message("已经核销的单据不能修改"); message("已经核销的单据不能修改");
return; return;
} }
if (rows[0].reviewStatus == "1") {
message("已经审批的单据不能修改");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HPCW001B?methodName=initLoad&inqu_status-0-mainId=" + rows[0].id + "&efParentFormEname=HPCW003", href: "HPCW003A?methodName=initLoad&inqu_status-0-operType=update&inqu_status-0-parentId=" + rows[0].id + "&efParentFormEname=HPCW003",
title: "<div style='text-align: center;'>收款清单</div>", title: "<div style='text-align: center;'>收款清单</div>",
width: "90%", width: "80%",
height: "90%", height: "80%",
callbackName: windowCallback callbackName: windowCallback
}); });
} }
...@@ -132,13 +136,14 @@ function saveResult1Func() { ...@@ -132,13 +136,14 @@ function saveResult1Func() {
JSUtils.submitGridsData("result", "HPCW003", "save", true, JSUtils.submitGridsData("result", "HPCW003", "save", true,
function (e) { function (e) {
//detailGrid.setEiInfo(e); //detailGrid.setEiInfo(e);
//query(); query();
}); });
} }
}); });
} }
function windowCallback() { function windowCallback() {
// 刷新列表 // 刷新列表
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
...@@ -154,13 +159,13 @@ function submitFunc() { ...@@ -154,13 +159,13 @@ function submitFunc() {
} }
var flag = true; var flag = true;
rows.forEach(function (row) { rows.forEach(function (row) {
if (row.cancelStatus == "1") { if (row.cancelStatus == "0") {
message("勾选的数据中有未核销的单据!"); message("勾选的数据中有未核销的单据!");
flag = false; flag = false;
return; return;
} }
if (row.reviewStatus == "3") { if (row.reviewStatus == "1") {
message("勾选的数据中有已经提交的单据!"); message("勾选的数据中有已经审批的单据!");
flag = false; flag = false;
return; return;
} }
...@@ -172,7 +177,7 @@ function submitFunc() { ...@@ -172,7 +177,7 @@ function submitFunc() {
JSUtils.submitGridsData("result", "HPCW003", "submit", true, JSUtils.submitGridsData("result", "HPCW003", "submit", true,
function (e) { function (e) {
//detailGrid.setEiInfo(e); //detailGrid.setEiInfo(e);
//query(); query();
}); });
} }
}); });
...@@ -188,7 +193,7 @@ function writeoffFunc() { ...@@ -188,7 +193,7 @@ function writeoffFunc() {
} }
var flag = true; var flag = true;
rows.forEach(function (row) { rows.forEach(function (row) {
if (row.cancelStatus == "1") { if (row.get("cancelStatus") == "1") {
message("勾选的数据中有已经核销的单据!"); message("勾选的数据中有已经核销的单据!");
flag = false; flag = false;
return; return;
...@@ -201,7 +206,7 @@ function writeoffFunc() { ...@@ -201,7 +206,7 @@ function writeoffFunc() {
JSUtils.submitGridsData("result", "HPCW003", "writeoff", true, JSUtils.submitGridsData("result", "HPCW003", "writeoff", true,
function (e) { function (e) {
//detailGrid.setEiInfo(e); //detailGrid.setEiInfo(e);
//query(); query();
}); });
/*var info = new EiInfo(); /*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
...@@ -242,8 +247,14 @@ function deleteFunc() { ...@@ -242,8 +247,14 @@ function deleteFunc() {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let cancelStatus= item.get("cancelStatus"); let cancelStatus= item.get("cancelStatus");
if(cancelStatus === "2"){ let reviewStatus= item.get("reviewStatus");
message("选中的第"+(index+1)+"行记录为核销状态,不能删除!"); if(cancelStatus == "1"){
message("选中的第"+(index+1)+"行记录为已核销,不能删除!");
flag = false;
return;
}
if (reviewStatus == "1") {
message("选中的第"+(index+1)+"行记录为已审批,不能删除!");
flag = false; flag = false;
return; return;
} }
...@@ -259,7 +270,7 @@ function deleteFunc() { ...@@ -259,7 +270,7 @@ function deleteFunc() {
function contractDetailFunc(id) { function contractDetailFunc(id) {
JSColorbox.open({ JSColorbox.open({
href: "HPCW003A?methodName=initLoad&inqu_status-0-parentId=" + id + "&efParentFormEname=HPCW003", href: "HPCW003A?methodName=initLoad&inqu_status-0-operType=query&inqu_status-0-parentId=" + id + "&efParentFormEname=HPCW003",
title: "<div style='text-align: center;'>收款详情</div>", title: "<div style='text-align: center;'>收款详情</div>",
width: "80%", width: "80%",
height: "80%", height: "80%",
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.cancelStatus"/> <EF:EFCodeOption codeName="hggp.cw.cancelStatus"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="审批状态" ename="inqu_status-0-reviewStatus" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('1', '0')"/>
</EF:EFSelect>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -70,7 +74,7 @@ ...@@ -70,7 +74,7 @@
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" readonly="true" <EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" readonly="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0"> columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0">
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus"/> <EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('1', '0')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -9,6 +9,11 @@ $(function() { ...@@ -9,6 +9,11 @@ $(function() {
pageSize: 20, pageSize: 20,
pageSizes: [10,20,30,50,100,200], pageSizes: [10,20,30,50,100,200],
}, },
loadComplete: function (grid) {
if ($("#inqu_status-0-operType").val()==="query"){
$("#save-changes").hide();
}
},
onSave: function (e) { onSave: function (e) {
// 阻止默认请求,使用自定义保存 // 阻止默认请求,使用自定义保存
e.preventDefault(); e.preventDefault();
...@@ -20,16 +25,7 @@ $(function() { ...@@ -20,16 +25,7 @@ $(function() {
deleteFunc(); deleteFunc();
} }
} }
downKeyUp();
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
}); });
$(window).load(function () { $(window).load(function () {
...@@ -56,7 +52,12 @@ function saveFunc() { ...@@ -56,7 +52,12 @@ function saveFunc() {
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGridsData("result", "HPCW003A", "save", true,
function (e) {
//detailGrid.setEiInfo(e);
query();
});
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HPCW003A", "save", info, { EiCommunicator.send("HPCW003A", "save", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -79,7 +80,7 @@ function saveFunc() { ...@@ -79,7 +80,7 @@ function saveFunc() {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
}); });*/
//JSUtils.submitGridsData("result", "HPSC001", "save", true); //JSUtils.submitGridsData("result", "HPSC001", "save", true);
} }
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="收款清单"> <EF:EFPage title="收款清单">
<EF:EFInput cname="隐藏条件" ename="parentId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="隐藏条件" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="operType" cname="隐藏条件" type="hidden"/>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
......
...@@ -84,7 +84,7 @@ let query = function () { ...@@ -84,7 +84,7 @@ let query = function () {
} }
/** /**
* 结算单选择 * 采购发票选择
*/ */
function choiceFunc() { function choiceFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
...@@ -119,15 +119,19 @@ function updateFunc() { ...@@ -119,15 +119,19 @@ function updateFunc() {
message("请选择一条数据"); message("请选择一条数据");
return; return;
} }
if (rows[0].cancelStatus == "2") { if (rows[0].cancelStatus == "1") {
message("已经核销的单据不能修改"); message("已经核销的单据不能修改");
return; return;
} }
if (rows[0].reviewStatus == "1") {
message("已经审批的单据不能修改");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HPCW002B?methodName=initLoad&inqu_status-0-mainId=" + rows[0].id + "&efParentFormEname=HPCW002", href: "HPCW004A?methodName=initLoad&inqu_status-0-operType=update&inqu_status-0-parentId=" + rows[0].id + "&efParentFormEname=HPCW004",
title: "<div style='text-align: center;'>付款清单</div>", title: "<div style='text-align: center;'>付款清单</div>",
width: "90%", width: "70%",
height: "90%", height: "70%",
callbackName: windowCallback callbackName: windowCallback
}); });
} }
...@@ -140,7 +144,12 @@ function saveResult1Func() { ...@@ -140,7 +144,12 @@ function saveResult1Func() {
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGridsData("result", "HPCW004", "save", true,
function (e) {
//detailGrid.setEiInfo(e);
//query();
});
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HPCW004", "save", info, { EiCommunicator.send("HPCW004", "save", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -163,12 +172,13 @@ function saveResult1Func() { ...@@ -163,12 +172,13 @@ function saveResult1Func() {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
}); });*/
//JSUtils.submitGridsData("result", "HPSC001", "save", true); //JSUtils.submitGridsData("result", "HPSC001", "save", true);
} }
}); });
} }
function windowCallback() { function windowCallback() {
// 刷新列表 // 刷新列表
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
...@@ -176,6 +186,9 @@ function windowCallback() { ...@@ -176,6 +186,9 @@ function windowCallback() {
JSColorbox.close(); JSColorbox.close();
} }
/**
* 审批
*/
function submitFunc() { function submitFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length < 1) { if (rows.length < 1) {
...@@ -184,13 +197,13 @@ function submitFunc() { ...@@ -184,13 +197,13 @@ function submitFunc() {
} }
var flag = true; var flag = true;
rows.forEach(function (row) { rows.forEach(function (row) {
/* if (row.cancelStatus == "1") { if (row.cancelStatus == "0") {
message("勾选的数据中有未核销的单据!"); message("勾选的数据中有未核销的单据!");
flag = false; flag = false;
return; return;
}*/ }
if (row.reviewStatus == "1") { if (row.reviewStatus == "1") {
message("勾选的数据中有已经提交的单据!"); message("勾选的数据中有已经审核的单据!");
flag = false; flag = false;
return; return;
} }
...@@ -199,7 +212,12 @@ function submitFunc() { ...@@ -199,7 +212,12 @@ function submitFunc() {
if (flag) { if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGridsData("result", "HPCW004", "submit", true,
function (e) {
//detailGrid.setEiInfo(e);
query();
});
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HPCW004", "submit", info, { EiCommunicator.send("HPCW004", "submit", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -222,13 +240,15 @@ function submitFunc() { ...@@ -222,13 +240,15 @@ function submitFunc() {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
}); });*/
} }
}); });
} }
} }
/**
* 核销
*/
function writeoffFunc() { function writeoffFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length < 1) { if (rows.length < 1) {
...@@ -237,7 +257,7 @@ function writeoffFunc() { ...@@ -237,7 +257,7 @@ function writeoffFunc() {
} }
var flag = true; var flag = true;
rows.forEach(function (row) { rows.forEach(function (row) {
if (row.cancelStatus == "2") { if (row.cancelStatus == "1") {
message("勾选的数据中有已经核销的单据!"); message("勾选的数据中有已经核销的单据!");
flag = false; flag = false;
return; return;
...@@ -247,7 +267,12 @@ function writeoffFunc() { ...@@ -247,7 +267,12 @@ function writeoffFunc() {
if (flag) { if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"核销\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"核销\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGridsData("result", "HPCW004", "writeoff", true,
function (e) {
//detailGrid.setEiInfo(e);
query();
});
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HPCW004", "writeoff", info, { EiCommunicator.send("HPCW004", "writeoff", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -270,7 +295,7 @@ function writeoffFunc() { ...@@ -270,7 +295,7 @@ function writeoffFunc() {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
}); });*/
} }
}); });
...@@ -303,7 +328,7 @@ function deleteFunc() { ...@@ -303,7 +328,7 @@ function deleteFunc() {
function contractDetailFunc(id) { function contractDetailFunc(id) {
JSColorbox.open({ JSColorbox.open({
href: "HPCW004A?methodName=initLoad&inqu_status-0-parentId=" + id + "&efParentFormEname=HPCW002", href: "HPCW004A?methodName=initLoad&inqu_status-0-operType=query&inqu_status-0-parentId=" + id + "&efParentFormEname=HPCW004",
title: "<div style='text-align: center;'>付款详情</div>", title: "<div style='text-align: center;'>付款详情</div>",
width: "70%", width: "70%",
height: "70%", height: "70%",
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpcw.cancelStatus"/> <EF:EFCodeOption codeName="hpjx.hpcw.cancelStatus"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="审批状态" ename="inqu_status-0-reviewStatus" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('1', '0')"/>
</EF:EFSelect>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -65,7 +69,7 @@ ...@@ -65,7 +69,7 @@
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="reviewStatus" cname="审核状态" width="100" align="center" readonly="true" <EF:EFComboColumn ename="reviewStatus" cname="审核状态" width="100" align="center" readonly="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0"> columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0">
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus"/> <EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('1', '0')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -10,6 +10,11 @@ $(function() { ...@@ -10,6 +10,11 @@ $(function() {
pageSize: 20, pageSize: 20,
pageSizes: [10,20,30,50,100,200], pageSizes: [10,20,30,50,100,200],
}, },
loadComplete: function (grid) {
if ($("#inqu_status-0-operType").val()==="query"){
$("#save-changes").hide();
}
},
onSave: function (e) { onSave: function (e) {
// 阻止默认请求,使用自定义保存 // 阻止默认请求,使用自定义保存
e.preventDefault(); e.preventDefault();
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="付款清单"> <EF:EFPage title="付款清单">
<EF:EFInput cname="隐藏条件" ename="mainId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="隐藏条件" ename="parentId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="operType" cname="隐藏条件" type="hidden"/>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
......
...@@ -66,6 +66,10 @@ $(function () { ...@@ -66,6 +66,10 @@ $(function () {
pageOffset = e.page; pageOffset = e.page;
console.log(e.page); console.log(e.page);
}, },
loadComplete: function (grid) {
//此grid对象
$("#SUBMIT_PRODUC").on("click",submitProduc);
},
onSave: function (e) { onSave: function (e) {
// 阻止默认请求,使用自定义保存 // 阻止默认请求,使用自定义保存
e.preventDefault(); e.preventDefault();
...@@ -462,3 +466,40 @@ let imgClick = function (docId) { ...@@ -462,3 +466,40 @@ let imgClick = function (docId) {
$(this).fadeOut("fast"); $(this).fadeOut("fast");
}); });
} }
/*排产*/
let submitProduc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(status == "1"){
message("选中的第"+(index+1)+"行\"任务已提交\",不能排产!");
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"排产\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC003", "submitProduc", true,
function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
query();
} else {
NotificationUtil(ei, "error");
}
})
}
});
}
}
let ids = []; let ids = [];
var prodOrderNos = [];
$(function () { $(function () {
// 查询 // 查询
...@@ -9,6 +10,8 @@ $(function () { ...@@ -9,6 +10,8 @@ $(function () {
// 批量分派 // 批量分派
$("#ASSIGN").on("click", assign); $("#ASSIGN").on("click", assign);
// 批量改派
$("#BNT_ASSIGN_CHANGE").on("click", assignChange);
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
...@@ -48,8 +51,11 @@ $(function () { ...@@ -48,8 +51,11 @@ $(function () {
} }
} }
],
loadComplete: function(grid) {
$("#BNT_REVOCA").on("click", revocation)
}
]
} }
}); });
...@@ -167,6 +173,100 @@ function assign() { ...@@ -167,6 +173,100 @@ function assign() {
} }
} }
function assignChange() {
//重置全局变量
prodOrderNos = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要改派的数据");
return;
}
let factoryCodes = rows[0].get("factoryCode");
let flag = true;
$.each(rows, function(index, item) {
prodOrderNos.push(item.prodOrderNo)
let factoryCode= item.get("factoryCode");
if(factoryCode != factoryCodes){
message(`选中第${index+1}选中的生产订单不上同一个工厂,无法改派!`)
flag = false;
return false;
}
if(item.status == 0){
message(`选中第${index+1}行的生产订单未派工,无法改派!`)
flag = false;
return false;
}
});
if(flag) {
// groupType=1:仅查询生产组
JSColorbox.open({
href: "HPSC098?methodName=initLoad&inqu_status-0-orgType=prodGroup&inqu_status-0-factoryCode="+factoryCodes,
title: "<div style='text-align: center;'>选择组织</div>",
width: "70%",
height: "70%",
callbackName: function (row) {
var info = new EiInfo()
info.set("prodOrderNos",prodOrderNos.join(','));
info.set("factoryCode",row.factoryCode);
info.set("factoryName",row.factoryName);
info.set("groupCode",row.groupCode);
info.set("groupName",row.groupName);
EiCommunicator.send("HPSC005A", "assignChange", info, {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: ei.msg
});
// 刷新列表
query();
// 关闭弹窗
JSColorbox.close();
}
}, onFail: function (ei) {
}
}, {async: false});
}
});
}
}
function revocation() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要撤销的数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
if(item.status == 0){
message(`选中第${index+1}行的生产订单未派工,无法撤销!`)
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm(" 确定要撤销派工吗?", {
ok: function () {
JSUtils.submitGrid("result", "HPSC005A", "revocation",
{onSuccessCallback: function(ei){
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({msg: ei.msg}, "success");
query();
}
}
}
)
}
});
}
}
/** /**
* 附件清单 * 附件清单
* *
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="170" locked="true" align="center"/> <EF:EFColumn ename="operator" cname="操作" enable="false" width="210" locked="true" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/> <EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="90" align="center"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="90" align="center">
<EF:EFOption label="未派工" value="0"/> <EF:EFOption label="未派工" value="0"/>
......
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