Commit ca0ad71e by 宋祥

1.采购收货逻辑调整

parent 3d819ae6
...@@ -108,17 +108,6 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -108,17 +108,6 @@ public class ServiceHGCG003 extends ServiceBase {
DaoUtils.update(HGCG003.UPDATE, hgcg003); DaoUtils.update(HGCG003.UPDATE, hgcg003);
} }
} }
// 合同过来的数据不让修改
// // 采购收货DB数据
// Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s);
// // 采购合同DB数据
// Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
// ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// // 数据校验
// this.checkEditData(fCg003s, dbCg003Map);
// // 修改数据
// this.editData(fCg003s, dbCg003Map, dbCg002AMap);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!");
...@@ -127,35 +116,21 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -127,35 +116,21 @@ public class ServiceHGCG003 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 保存数据
*
* @param hgcg003
*/
private void saveData(HGCG003 hgcg003) { private void saveData(HGCG003 hgcg003) {
// 新增数据 // 新增数据
hgcg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO)); hgcg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
hgcg003.setStatus(HGConstant.CgReceiveStatus.S_0); hgcg003.setStatus(HGConstant.CgReceiveStatus.S_2);
hgcg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); hgcg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003.setSource(HGConstant.CgSource.SDLR); hgcg003.setSource(HGConstant.CgSource.SDLR);
hgcg003.setReceiveDate(DateUtils.formatShort(hgcg003.getReceiveDate())); hgcg003.setReceiveDate(DateUtils.formatShort(hgcg003.getReceiveDate()));
DaoUtils.insert(HGCG003.INSERT, hgcg003); DaoUtils.insert(HGCG003.INSERT, hgcg003);
} }
/**
* 数据校验
*
* @param fCg003s
* @param dbCg003Map
*/
private void checkEditData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) {
List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO);
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
AssertUtils.isGt(BigDecimal.ZERO, fCg003.getReceiveQty(),
String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003.getReceiveQty()));
}
}
/** /**
* 数据修改,修改合同数据 * 数据修改,修改合同数据
...@@ -218,8 +193,8 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -218,8 +193,8 @@ public class ServiceHGCG003 extends ServiceBase {
String receiveNo = fCg003.getReceiveNo(); String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo); HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
} }
} }
......
...@@ -227,7 +227,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -227,7 +227,7 @@ public class ServiceHGCG003A extends ServiceBase {
.reduce(BigDecimal.ZERO, BigDecimal::add)); .reduce(BigDecimal.ZERO, BigDecimal::add));
// 计算总税额 // 计算总税额
newCg003.setTaxAmount(fCg002Bs.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); newCg003.setTaxAmount(fCg002Bs.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0); newCg003.setStatus(HGConstant.CgReceiveStatus.S_2);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg003.setSource(HGConstant.CgSource.DEFAULT); newCg003.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG003.INSERT, newCg003); DaoUtils.insert(HGCG003.INSERT, newCg003);
...@@ -258,7 +258,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -258,7 +258,7 @@ public class ServiceHGCG003A extends ServiceBase {
cg003B.setContractDetailId(fCg002B.getId()); cg003B.setContractDetailId(fCg002B.getId());
cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount()); cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount());
cg003B.setCalculationMethod(fCg002B.getCalculationMethod()); cg003B.setCalculationMethod(fCg002B.getCalculationMethod());
cg003B.setStatus(HGConstant.CgReceiveStatus.S_0); cg003B.setStatus(HGConstant.CgReceiveStatus.S_2);
cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG003B.INSERT, cg003B); DaoUtils.insert(HGCG003B.INSERT, cg003B);
// 更新合同状态 // 更新合同状态
......
...@@ -143,8 +143,8 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -143,8 +143,8 @@ public class ServiceHGCG003B extends ServiceBase {
String receiveNo = fCg003B.getReceiveNo(); String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003Map.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003Map.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, cg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
AssertUtils.isGt(BigDecimal.ZERO, fCg003B.getReceiveQty(), AssertUtils.isGt(BigDecimal.ZERO, fCg003B.getReceiveQty(),
String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003B.getReceiveQty())); String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003B.getReceiveQty()));
// 校验合同数量 // 校验合同数量
...@@ -198,7 +198,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -198,7 +198,7 @@ public class ServiceHGCG003B extends ServiceBase {
private void addData(HGCG003B hgcg003B, HGCG003 cg003) { private void addData(HGCG003B hgcg003B, HGCG003 cg003) {
hgcg003B.setPrimaryId(cg003.getId()); hgcg003B.setPrimaryId(cg003.getId());
hgcg003B.setReceiveNo(cg003.getReceiveNo()); hgcg003B.setReceiveNo(cg003.getReceiveNo());
hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_0); hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_2);
hgcg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); hgcg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003B.setReceiveDate(DateUtils.formatShort(cg003.getReceiveDate())); hgcg003B.setReceiveDate(DateUtils.formatShort(cg003.getReceiveDate()));
hgcg003B.setCompanyCode(cg003.getCompanyCode()); hgcg003B.setCompanyCode(cg003.getCompanyCode());
...@@ -277,8 +277,8 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -277,8 +277,8 @@ public class ServiceHGCG003B extends ServiceBase {
String receiveNo = fCg003B.getReceiveNo(); String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, cg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
} }
} }
......
...@@ -483,12 +483,12 @@ ...@@ -483,12 +483,12 @@
<isNotEmpty prepend=" AND " property="purUserName"> <isNotEmpty prepend=" AND " property="purUserName">
b.PUR_USER_NAME = #purUserName# b.PUR_USER_NAME = #purUserName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
b.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source"> <isNotEmpty prepend=" AND " property="source">
b.SOURCE = #source# b.SOURCE = #source#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
a.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="cancelAmount"> <isNotEmpty prepend=" AND " property="cancelAmount">
a.CANCEL_AMOUNT = #cancelAmount# a.CANCEL_AMOUNT = #cancelAmount#
</isNotEmpty> </isNotEmpty>
......
...@@ -848,7 +848,7 @@ public class HGCGTools { ...@@ -848,7 +848,7 @@ public class HGCGTools {
zl001s.forEach(zl001->{ zl001s.forEach(zl001->{
Map<String, Object> paramDetailMap = new HashMap<>(); Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003B.FIELD_ID, zl001.getReceiveDetailId()); paramDetailMap.put(HGCG003B.FIELD_ID, zl001.getReceiveDetailId());
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0); paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_STATUS, paramDetailMap); DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_STATUS, paramDetailMap);
}); });
...@@ -861,7 +861,7 @@ public class HGCGTools { ...@@ -861,7 +861,7 @@ public class HGCGTools {
List<HGCG003B> hgcg003BList = HGCGTools.HgCg003B.listByPrimaryIds(hgcg003List.stream().map(o->o.getId()).collect(Collectors.toList())); List<HGCG003B> hgcg003BList = HGCGTools.HgCg003B.listByPrimaryIds(hgcg003List.stream().map(o->o.getId()).collect(Collectors.toList()));
hgcg003List.forEach(cg003->{ hgcg003List.forEach(cg003->{
List<HGCG003B> hgcg003BFilterList = hgcg003BList.stream().filter(o->o.getPrimaryId().compareTo(cg003.getId()) == 0 List<HGCG003B> hgcg003BFilterList = hgcg003BList.stream().filter(o->o.getPrimaryId().compareTo(cg003.getId()) == 0
&& o.getStatus().intValue() != HGConstant.CgReceiveStatus.S_0).collect(Collectors.toList()); && o.getStatus().intValue() != HGConstant.CgReceiveStatus.S_2).collect(Collectors.toList());
//如果存在质检中的收货明细了,则明细存在未删除的,则主表为质检中 //如果存在质检中的收货明细了,则明细存在未删除的,则主表为质检中
if(!CollectionUtils.isEmpty(hgcg003BFilterList)){ if(!CollectionUtils.isEmpty(hgcg003BFilterList)){
Map<String, Object> paramDetailMap = new HashMap<>(); Map<String, Object> paramDetailMap = new HashMap<>();
...@@ -871,7 +871,7 @@ public class HGCGTools { ...@@ -871,7 +871,7 @@ public class HGCGTools {
}else{ }else{
Map<String, Object> paramDetailMap = new HashMap<>(); Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003.FIELD_RECEIVE_NO, cg003.getReceiveNo()); paramDetailMap.put(HGCG003.FIELD_RECEIVE_NO, cg003.getReceiveNo());
paramDetailMap.put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0); paramDetailMap.put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_STATUS, paramDetailMap); DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_STATUS, paramDetailMap);
} }
}); });
......
...@@ -194,8 +194,6 @@ public class HGConstant { ...@@ -194,8 +194,6 @@ public class HGConstant {
*/ */
public static class CgReceiveStatus { public static class CgReceiveStatus {
// 待确认
public static final Integer S_0 = 0;
// 已收货 // 已收货
public static final Integer S_2 = 2; public static final Integer S_2 = 2;
// 质检中 // 质检中
......
...@@ -22,7 +22,9 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -22,7 +22,9 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages; import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.google.common.collect.Lists;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -195,8 +197,8 @@ public class ServiceHGKC001 extends ServiceBase { ...@@ -195,8 +197,8 @@ public class ServiceHGKC001 extends ServiceBase {
dbKc001.getDepositQty().negate(), dbKc001.getDepositWeight().negate()); dbKc001.getDepositQty().negate(), dbKc001.getDepositWeight().negate());
} }
// 更新收货单状态 // 更新收货单状态
HGCGTools.HgCg003.updateStatus(dbKc001.getReceiveNo(), HGConstant.CgReceiveStatus.S_0); HGCGTools.HgCg003B.updateDeposit(dbKc001.getReceiveDetailId(), BigDecimal.ZERO, BigDecimal.ZERO);
HGCGTools.HgCg003B.updateStatus(dbKc001.getReceiveDetailId(), HGConstant.CgReceiveStatus.S_2); HGCGTools.HgCg003.updateReceiveMain(Lists.newArrayList(dbKc001.getReceiveNo()));
} }
} }
......
...@@ -1329,7 +1329,6 @@ public class HGSCTools { ...@@ -1329,7 +1329,6 @@ public class HGSCTools {
} }
} }
} }
System.out.println(workHour.toString());
return workHour.get(); return workHour.get();
} }
......
...@@ -71,7 +71,7 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -71,7 +71,7 @@ public class ServiceHGZL001B extends ServiceEPBase {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGCG003.FIELD_SOURCE, HGConstant.CgSource.DEFAULT); queryMap.put(HGCG003.FIELD_SOURCE, HGConstant.CgSource.DEFAULT);
queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0); queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
inInfo = super.query(inInfo, HgCgSqlConst.HgCg003A.QUERY_BY_QUALITY_TESTING, new HGCG003B1()); inInfo = super.query(inInfo, HgCgSqlConst.HgCg003A.QUERY_BY_QUALITY_TESTING, new HGCG003B1());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -90,11 +90,8 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -90,11 +90,8 @@ public class ServiceHGZL001B extends ServiceEPBase {
try { try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// Map<Long, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
// 数据校验 // 数据校验
this.checkConfirmData(fCg003Bs, dbCg003BMap,cg003); this.checkConfirmData(fCg003Bs, dbCg003BMap);
// 生成巡检单 // 生成巡检单
this.saveConfirmData(fCg003Bs, dbCg003BMap); this.saveConfirmData(fCg003Bs, dbCg003BMap);
} catch (Exception e) { } catch (Exception e) {
...@@ -102,20 +99,19 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -102,20 +99,19 @@ public class ServiceHGZL001B extends ServiceEPBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 校验数据 * 校验数据
* *
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003BMap * @param dbCg003BMap
*/ */
private void checkConfirmData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap,HGCG003 cg003) { private void checkConfirmData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap) {
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(), for (HGCG003B fCg003B : fCg003Bs) {
String.format("采购收货单[%s]状态不是\"待确认\",不允许操作", cg003.getReceiveNo())); HGCG003B dbSc003B = dbCg003BMap.get(fCg003B.getId());
// for (HGCG003B fCg003B : fCg003Bs) { AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, dbSc003B.getStatus(),
// HGCG003B dbSc003B = dbCg003BMap.get(fCg003B.getId()); String.format("采购收货单[%s]的状态不是\"已收货\",不允许操作", dbSc003B.getId()));
// }
// }
} }
/** /**
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/> <EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" <EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#"> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
......
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