Commit 65130dd9 by 宋祥

Merge branch 'dev-sx' of http://git.pseer.com:8800/platform/hg-smart into dev

parents 8dbfc24d fc8ae48e
...@@ -156,7 +156,7 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -156,7 +156,7 @@ public class ServiceHGKC003 extends ServiceBase {
this.checkSubmitData(dbKc003); this.checkSubmitData(dbKc003);
DaoUtils.update(HGKC003.UPDATE_SUBMIT_STATUS, dbKc003); DaoUtils.update(HGKC003.UPDATE_SUBMIT_STATUS, dbKc003);
// 修改计划生产任务完工数量 // 修改计划生产任务完工数量
HGSCTools.complete(dbKc003.getQualityId(), dbKc003.getInvQty().intValue(), dbKc003.getRectificationId(), HGSCTools.complete(dbKc003.getQualityId(), dbKc003.getInvQty(), dbKc003.getRectificationId(),
HGConstant.StorageType.RK); HGConstant.StorageType.RK);
// 修改库存 // 修改库存
HGKCUtils.HgKc010.updateInv(dbKc003.getCompanyCode(), dbKc003.getWhCode(), dbKc003.getPrdtCode(), HGKCUtils.HgKc010.updateInv(dbKc003.getCompanyCode(), dbKc003.getWhCode(), dbKc003.getPrdtCode(),
...@@ -247,7 +247,7 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -247,7 +247,7 @@ public class ServiceHGKC003 extends ServiceBase {
newKc003.setIsReturn(CommonConstant.YesNo.YES_1); newKc003.setIsReturn(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HGKC003.INSERT, newKc003); DaoUtils.insert(HGKC003.INSERT, newKc003);
//修改计划生产任务完工数量 //修改计划生产任务完工数量
HGSCTools.complete(fKc003.getQualityId(),newKc003.getInvQty().intValue(),fKc003.getRectificationId(), HGConstant.StorageType.TH); HGSCTools.complete(fKc003.getQualityId(),newKc003.getInvQty(),fKc003.getRectificationId(), HGConstant.StorageType.TH);
// 修改库存 // 修改库存
HGKCUtils.HgKc010.updateInv(newKc003.getCompanyCode(), newKc003.getWhCode(), newKc003.getPrdtCode(), HGKCUtils.HgKc010.updateInv(newKc003.getCompanyCode(), newKc003.getWhCode(), newKc003.getPrdtCode(),
newKc003.getInvQty(), newKc003.getInvWeight()); newKc003.getInvQty(), newKc003.getInvWeight());
......
...@@ -290,7 +290,8 @@ public class HGKCTools { ...@@ -290,7 +290,8 @@ public class HGKCTools {
AssertUtils.isEmpty(hgzl002.getProductCode(), "存货编码不能为空!"); AssertUtils.isEmpty(hgzl002.getProductCode(), "存货编码不能为空!");
AssertUtils.isEmpty(hgzl002.getProductName(), "存货名称不能为空!"); AssertUtils.isEmpty(hgzl002.getProductName(), "存货名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgzl002.getId())||hgzl002.getId()<=0, "质检单明细ID不能为空!"); AssertUtils.isTrue(Objects.isNull(hgzl002.getId())||hgzl002.getId()<=0, "质检单明细ID不能为空!");
AssertUtils.isTrue(hgzl002.getPassQuantity().compareTo(0) == 0 && hgzl002.getUnpassQuantity().compareTo(0) == 0, "合格数量与不合格数量不能都为0!"); AssertUtils.isTrue(hgzl002.getPassQuantity().compareTo(BigDecimal.ZERO) == 0
&& hgzl002.getUnpassQuantity().compareTo(BigDecimal.ZERO) == 0, "合格数量与不合格数量不能都为0!");
} }
} }
/** /**
...@@ -310,7 +311,7 @@ public class HGKCTools { ...@@ -310,7 +311,7 @@ public class HGKCTools {
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCodes(inventCodes); List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCodes(inventCodes);
hgkc003List.forEach(hgkc003->{ hgkc003List.forEach(hgkc003->{
//修改计划生产任务完工数量 //修改计划生产任务完工数量
HGSCTools.complete(hgkc003.getQualityId(),hgkc003.getInvQty().intValue(),hgkc003.getRectificationId(),HGConstant.StorageType.RK); HGSCTools.complete(hgkc003.getQualityId(),hgkc003.getInvQty(),hgkc003.getRectificationId(),HGConstant.StorageType.RK);
//查询当前工序 //查询当前工序
HGPZ005A hgpz005A = hgpz005AList.stream().filter(o -> o.getId().equals(hgkc003.getInventProcessId())).findAny().orElse(null); HGPZ005A hgpz005A = hgpz005AList.stream().filter(o -> o.getId().equals(hgkc003.getInventProcessId())).findAny().orElse(null);
AssertUtils.isNull(hgpz005A, "未获取到当前工序信息!"); AssertUtils.isNull(hgpz005A, "未获取到当前工序信息!");
...@@ -345,11 +346,11 @@ public class HGKCTools { ...@@ -345,11 +346,11 @@ public class HGKCTools {
if(Objects.nonNull(code)){ if(Objects.nonNull(code)){
HGZL004 hgzl004 = hgzl004List.stream().filter(h->h.getCheckId().equals(o.getId())).findAny().orElse(null); HGZL004 hgzl004 = hgzl004List.stream().filter(h->h.getCheckId().equals(o.getId())).findAny().orElse(null);
//整改通知单 //整改通知单
hgkc003.setInvQty(new BigDecimal(o.getUnpassQuantity())); hgkc003.setInvQty(o.getUnpassQuantity());
hgkc003.setRectificationId(hgzl004.getId()); hgkc003.setRectificationId(hgzl004.getId());
}else{ }else{
//工序质检单 //工序质检单
hgkc003.setInvQty(new BigDecimal(o.getPassQuantity())); hgkc003.setInvQty(o.getPassQuantity());
} }
if(hgkc003.getInvQty().compareTo(BigDecimal.ZERO) == 0){ if(hgkc003.getInvQty().compareTo(BigDecimal.ZERO) == 0){
return; return;
...@@ -416,9 +417,11 @@ public class HGKCTools { ...@@ -416,9 +417,11 @@ public class HGKCTools {
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCodes(inventCodes); List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCodes(inventCodes);
hgkc003List.forEach(hgkc003->{ hgkc003List.forEach(hgkc003->{
//修改计划生产任务完工数量 //修改计划生产任务完工数量
HGSCTools.complete(hgkc003.getQualityId(),hgkc003.getInvQty().intValue(),hgkc003.getRectificationId(),HGConstant.StorageType.RK); HGSCTools.complete(hgkc003.getQualityId(), hgkc003.getInvQty(), hgkc003.getRectificationId(),
HGConstant.StorageType.RK);
//查询当前工序 //查询当前工序
HGPZ005A hgpz005A = hgpz005AList.stream().filter(o -> o.getInventCode().equals(hgkc003.getPrdtCode())).findAny().orElse(null); HGPZ005A hgpz005A = hgpz005AList.stream()
.filter(o -> o.getInventCode().equals(hgkc003.getPrdtCode())).findAny().orElse(null);
//查询比当前工序靠后的工序是否存在,不存在说明是最后工序,修改实时库存 //查询比当前工序靠后的工序是否存在,不存在说明是最后工序,修改实时库存
List<HGPZ005A> nextHgpz005AList = hgpz005AList.stream().filter(o->o.getProcessOrder().compareTo(hgpz005A.getProcessOrder()) == 1).collect(Collectors.toList()); List<HGPZ005A> nextHgpz005AList = hgpz005AList.stream().filter(o->o.getProcessOrder().compareTo(hgpz005A.getProcessOrder()) == 1).collect(Collectors.toList());
if(CollectionUtils.isEmpty(nextHgpz005AList)){ if(CollectionUtils.isEmpty(nextHgpz005AList)){
......
...@@ -128,9 +128,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -128,9 +128,9 @@ public class HGSC005A extends DaoEPBase {
private String finishDate = " "; /* 完工日期*/ private String finishDate = " "; /* 完工日期*/
private String planStartDate = " "; /* 计划开始日期*/ private String planStartDate = " "; /* 计划开始日期*/
private String planEndDate = " "; /* 计划结束日期*/ private String planEndDate = " "; /* 计划结束日期*/
private Integer quantity = new Integer(0); /* 数量*/ private BigDecimal quantity = new BigDecimal(0); /* 数量*/
private Integer finishQuantity = new Integer(0); /* 完工数量*/ private BigDecimal finishQuantity = new BigDecimal(0); /* 完工数量*/
private Integer unfinishQuantity = new Integer(0); /* 未完工数量*/ private BigDecimal unfinishQuantity = new BigDecimal(0); /* 未完工数量*/
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/ private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/ private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/
private BigDecimal finishWeight = new BigDecimal("0"); /* 完工重量*/ private BigDecimal finishWeight = new BigDecimal("0"); /* 完工重量*/
...@@ -250,14 +250,23 @@ public class HGSC005A extends DaoEPBase { ...@@ -250,14 +250,23 @@ public class HGSC005A extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_quantity); eiColumn = new EiColumn(FIELD_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("数量"); eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_finish_quantity); eiColumn = new EiColumn(FIELD_finish_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("完工数量"); eiColumn.setDescName("完工数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_unfinish_quantity); eiColumn = new EiColumn(FIELD_unfinish_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("未完工数量"); eiColumn.setDescName("未完工数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -683,7 +692,7 @@ public class HGSC005A extends DaoEPBase { ...@@ -683,7 +692,7 @@ public class HGSC005A extends DaoEPBase {
* get the quantity - 数量. * get the quantity - 数量.
* @return the quantity * @return the quantity
*/ */
public Integer getQuantity() { public BigDecimal getQuantity() {
return this.quantity; return this.quantity;
} }
...@@ -692,14 +701,14 @@ public class HGSC005A extends DaoEPBase { ...@@ -692,14 +701,14 @@ public class HGSC005A extends DaoEPBase {
* *
* @param quantity - 数量 * @param quantity - 数量
*/ */
public void setQuantity(Integer quantity) { public void setQuantity(BigDecimal quantity) {
this.quantity = quantity; this.quantity = quantity;
} }
/** /**
* get the finishQuantity - 完工数量. * get the finishQuantity - 完工数量.
* @return the finishQuantity * @return the finishQuantity
*/ */
public Integer getFinishQuantity() { public BigDecimal getFinishQuantity() {
return this.finishQuantity; return this.finishQuantity;
} }
...@@ -708,14 +717,14 @@ public class HGSC005A extends DaoEPBase { ...@@ -708,14 +717,14 @@ public class HGSC005A extends DaoEPBase {
* *
* @param finishQuantity - 完工数量 * @param finishQuantity - 完工数量
*/ */
public void setFinishQuantity(Integer finishQuantity) { public void setFinishQuantity(BigDecimal finishQuantity) {
this.finishQuantity = finishQuantity; this.finishQuantity = finishQuantity;
} }
/** /**
* get the unfinishQuantity - 未完工数量. * get the unfinishQuantity - 未完工数量.
* @return the unfinishQuantity * @return the unfinishQuantity
*/ */
public Integer getUnfinishQuantity() { public BigDecimal getUnfinishQuantity() {
return this.unfinishQuantity; return this.unfinishQuantity;
} }
...@@ -724,7 +733,7 @@ public class HGSC005A extends DaoEPBase { ...@@ -724,7 +733,7 @@ public class HGSC005A extends DaoEPBase {
* *
* @param unfinishQuantity - 未完工数量 * @param unfinishQuantity - 未完工数量
*/ */
public void setUnfinishQuantity(Integer unfinishQuantity) { public void setUnfinishQuantity(BigDecimal unfinishQuantity) {
this.unfinishQuantity = unfinishQuantity; this.unfinishQuantity = unfinishQuantity;
} }
/** /**
...@@ -933,9 +942,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -933,9 +942,9 @@ public class HGSC005A extends DaoEPBase {
setFinishDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_finish_date)), finishDate)); setFinishDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_finish_date)), finishDate));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_start_date)), planStartDate)); setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_start_date)), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_end_date)), planEndDate)); setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_end_date)), planEndDate));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity)); setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_quantity)), quantity));
setFinishQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_finish_quantity)), finishQuantity)); setFinishQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_finish_quantity)), finishQuantity));
setUnfinishQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unfinish_quantity)), unfinishQuantity)); setUnfinishQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unfinish_quantity)), unfinishQuantity));
setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight)); setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight));
setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight)); setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight));
setFinishWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_finish_weight)), finishWeight)); setFinishWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_finish_weight)), finishWeight));
......
...@@ -127,9 +127,9 @@ public class HGSC006A extends DaoEPBase { ...@@ -127,9 +127,9 @@ public class HGSC006A extends DaoEPBase {
private String productName = " "; /* 产品名称*/ private String productName = " "; /* 产品名称*/
private String planStartDate = " "; /* 计划开始日期*/ private String planStartDate = " "; /* 计划开始日期*/
private String planEndDate = " "; /* 计划结束日期*/ private String planEndDate = " "; /* 计划结束日期*/
private Integer quantity = new Integer(0); /* 数量*/ private BigDecimal quantity = new BigDecimal(0); /* 数量*/
private Integer assignQuantity = new Integer(0); /* 派工数量*/ private BigDecimal assignQuantity = new BigDecimal(0); /* 派工数量*/
private Integer unassignQuantity = new Integer(0); /* 未派工数量*/ private BigDecimal unassignQuantity = new BigDecimal(0); /* 未派工数量*/
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/ private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/ private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/
private BigDecimal assignWeight = new BigDecimal("0"); /* 派工重量*/ private BigDecimal assignWeight = new BigDecimal("0"); /* 派工重量*/
...@@ -235,14 +235,23 @@ public class HGSC006A extends DaoEPBase { ...@@ -235,14 +235,23 @@ public class HGSC006A extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_quantity); eiColumn = new EiColumn(FIELD_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("数量"); eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_assign_quantity); eiColumn = new EiColumn(FIELD_assign_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("派工数量"); eiColumn.setDescName("派工数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_unassign_quantity); eiColumn = new EiColumn(FIELD_unassign_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("未派工数量"); eiColumn.setDescName("未派工数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -656,7 +665,7 @@ public class HGSC006A extends DaoEPBase { ...@@ -656,7 +665,7 @@ public class HGSC006A extends DaoEPBase {
* get the quantity - 数量. * get the quantity - 数量.
* @return the quantity * @return the quantity
*/ */
public Integer getQuantity() { public BigDecimal getQuantity() {
return this.quantity; return this.quantity;
} }
...@@ -665,14 +674,14 @@ public class HGSC006A extends DaoEPBase { ...@@ -665,14 +674,14 @@ public class HGSC006A extends DaoEPBase {
* *
* @param quantity - 数量 * @param quantity - 数量
*/ */
public void setQuantity(Integer quantity) { public void setQuantity(BigDecimal quantity) {
this.quantity = quantity; this.quantity = quantity;
} }
/** /**
* get the assignQuantity - 派工数量. * get the assignQuantity - 派工数量.
* @return the assignQuantity * @return the assignQuantity
*/ */
public Integer getAssignQuantity() { public BigDecimal getAssignQuantity() {
return this.assignQuantity; return this.assignQuantity;
} }
...@@ -681,14 +690,14 @@ public class HGSC006A extends DaoEPBase { ...@@ -681,14 +690,14 @@ public class HGSC006A extends DaoEPBase {
* *
* @param assignQuantity - 派工数量 * @param assignQuantity - 派工数量
*/ */
public void setAssignQuantity(Integer assignQuantity) { public void setAssignQuantity(BigDecimal assignQuantity) {
this.assignQuantity = assignQuantity; this.assignQuantity = assignQuantity;
} }
/** /**
* get the unassignQuantity - 未派工数量. * get the unassignQuantity - 未派工数量.
* @return the unassignQuantity * @return the unassignQuantity
*/ */
public Integer getUnassignQuantity() { public BigDecimal getUnassignQuantity() {
return this.unassignQuantity; return this.unassignQuantity;
} }
...@@ -697,7 +706,7 @@ public class HGSC006A extends DaoEPBase { ...@@ -697,7 +706,7 @@ public class HGSC006A extends DaoEPBase {
* *
* @param unassignQuantity - 未派工数量 * @param unassignQuantity - 未派工数量
*/ */
public void setUnassignQuantity(Integer unassignQuantity) { public void setUnassignQuantity(BigDecimal unassignQuantity) {
this.unassignQuantity = unassignQuantity; this.unassignQuantity = unassignQuantity;
} }
/** /**
...@@ -921,9 +930,9 @@ public class HGSC006A extends DaoEPBase { ...@@ -921,9 +930,9 @@ public class HGSC006A extends DaoEPBase {
setProductName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_product_name)), productName)); setProductName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_product_name)), productName));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_start_date)), planStartDate)); setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_start_date)), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_end_date)), planEndDate)); setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_plan_end_date)), planEndDate));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity)); setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_quantity)), quantity));
setAssignQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_assign_quantity)), assignQuantity)); setAssignQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_assign_quantity)), assignQuantity));
setUnassignQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unassign_quantity)), unassignQuantity)); setUnassignQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unassign_quantity)), unassignQuantity));
setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight)); setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight));
setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight)); setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight));
setAssignWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_assign_weight)), assignWeight)); setAssignWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_assign_weight)), assignWeight));
...@@ -984,4 +993,4 @@ public class HGSC006A extends DaoEPBase { ...@@ -984,4 +993,4 @@ public class HGSC006A extends DaoEPBase {
return map; return map;
} }
} }
\ No newline at end of file
...@@ -152,9 +152,9 @@ public class HGSC007 extends DaoEPBase { ...@@ -152,9 +152,9 @@ public class HGSC007 extends DaoEPBase {
private String groupCode = " "; /* 工作组编号*/ private String groupCode = " "; /* 工作组编号*/
private String groupName = " "; /* 工作组名称*/ private String groupName = " "; /* 工作组名称*/
private String completeDate = " "; /* 完工日期*/ private String completeDate = " "; /* 完工日期*/
private Integer quantity = new Integer(0); /* 数量*/ private BigDecimal quantity = new BigDecimal(0); /* 数量*/
private Integer finishQuantity = new Integer(0); /* 完工数量*/ private BigDecimal finishQuantity = new BigDecimal(0); /* 完工数量*/
private Integer unfinishQuantity = new Integer(0); /* 未完工数量*/ private BigDecimal unfinishQuantity = new BigDecimal(0); /* 未完工数量*/
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/ private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/ private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/
private BigDecimal finishWeight = new BigDecimal("0"); /* 完工重量*/ private BigDecimal finishWeight = new BigDecimal("0"); /* 完工重量*/
...@@ -289,14 +289,23 @@ public class HGSC007 extends DaoEPBase { ...@@ -289,14 +289,23 @@ public class HGSC007 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_quantity); eiColumn = new EiColumn(FIELD_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("数量"); eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_finish_quantity); eiColumn = new EiColumn(FIELD_finish_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("完工数量"); eiColumn.setDescName("完工数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_unfinish_quantity); eiColumn = new EiColumn(FIELD_unfinish_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("未完工数量"); eiColumn.setDescName("未完工数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -824,7 +833,7 @@ public class HGSC007 extends DaoEPBase { ...@@ -824,7 +833,7 @@ public class HGSC007 extends DaoEPBase {
* get the quantity - 数量. * get the quantity - 数量.
* @return the quantity * @return the quantity
*/ */
public Integer getQuantity() { public BigDecimal getQuantity() {
return this.quantity; return this.quantity;
} }
...@@ -833,14 +842,14 @@ public class HGSC007 extends DaoEPBase { ...@@ -833,14 +842,14 @@ public class HGSC007 extends DaoEPBase {
* *
* @param quantity - 数量 * @param quantity - 数量
*/ */
public void setQuantity(Integer quantity) { public void setQuantity(BigDecimal quantity) {
this.quantity = quantity; this.quantity = quantity;
} }
/** /**
* get the finishQuantity - 完工数量. * get the finishQuantity - 完工数量.
* @return the finishQuantity * @return the finishQuantity
*/ */
public Integer getFinishQuantity() { public BigDecimal getFinishQuantity() {
return this.finishQuantity; return this.finishQuantity;
} }
...@@ -849,14 +858,14 @@ public class HGSC007 extends DaoEPBase { ...@@ -849,14 +858,14 @@ public class HGSC007 extends DaoEPBase {
* *
* @param finishQuantity - 完工数量 * @param finishQuantity - 完工数量
*/ */
public void setFinishQuantity(Integer finishQuantity) { public void setFinishQuantity(BigDecimal finishQuantity) {
this.finishQuantity = finishQuantity; this.finishQuantity = finishQuantity;
} }
/** /**
* get the unfinishQuantity - 未完工数量. * get the unfinishQuantity - 未完工数量.
* @return the unfinishQuantity * @return the unfinishQuantity
*/ */
public Integer getUnfinishQuantity() { public BigDecimal getUnfinishQuantity() {
return this.unfinishQuantity; return this.unfinishQuantity;
} }
...@@ -865,7 +874,7 @@ public class HGSC007 extends DaoEPBase { ...@@ -865,7 +874,7 @@ public class HGSC007 extends DaoEPBase {
* *
* @param unfinishQuantity - 未完工数量 * @param unfinishQuantity - 未完工数量
*/ */
public void setUnfinishQuantity(Integer unfinishQuantity) { public void setUnfinishQuantity(BigDecimal unfinishQuantity) {
this.unfinishQuantity = unfinishQuantity; this.unfinishQuantity = unfinishQuantity;
} }
/** /**
...@@ -1120,9 +1129,9 @@ public class HGSC007 extends DaoEPBase { ...@@ -1120,9 +1129,9 @@ public class HGSC007 extends DaoEPBase {
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_code)), groupCode)); setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_code)), groupCode));
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName)); setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName));
setCompleteDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_complete_date)), completeDate)); setCompleteDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_complete_date)), completeDate));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity)); setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_quantity)), quantity));
setFinishQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_finish_quantity)), finishQuantity)); setFinishQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_finish_quantity)), finishQuantity));
setUnfinishQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unfinish_quantity)), unfinishQuantity)); setUnfinishQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unfinish_quantity)), unfinishQuantity));
setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight)); setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight));
setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight)); setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight));
setFinishWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_finish_weight)), finishWeight)); setFinishWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_finish_weight)), finishWeight));
...@@ -1198,4 +1207,4 @@ public class HGSC007 extends DaoEPBase { ...@@ -1198,4 +1207,4 @@ public class HGSC007 extends DaoEPBase {
return map; return map;
} }
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -23,7 +23,7 @@ public class HGSC008 extends DaoEPBase {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String FIELD_id = "id"; public static final String FIELD_id = "id";
public static final String FIELD_mat_id = "matId"; /* 物料清单ID*/ public static final String FIELD_mat_id = "matId"; /* 物料清单ID*/
public static final String FIELD_task_id = "taskId"; /* 生产任务ID*/ public static final String FIELD_task_id = "taskId"; /* 生产任务ID*/
public static final String FIELD_tech_flow_id = "techFlowId"; /* 工艺流程ID*/ public static final String FIELD_tech_flow_id = "techFlowId"; /* 工艺流程ID*/
...@@ -71,7 +71,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -71,7 +71,7 @@ public class HGSC008 extends DaoEPBase {
public static final String FIELD_length = "length"; /* 长*/ public static final String FIELD_length = "length"; /* 长*/
public static final String FIELD_exceed_reason = "exceedReason"; public static final String FIELD_exceed_reason = "exceedReason";
public static final String COL_id = "id"; public static final String COL_id = "id";
public static final String COL_mat_id = "mat_id"; /* 物料清单ID*/ public static final String COL_mat_id = "mat_id"; /* 物料清单ID*/
public static final String COL_task_id = "task_id"; /* 生产任务ID*/ public static final String COL_task_id = "task_id"; /* 生产任务ID*/
public static final String COL_tech_flow_id = "tech_flow_id"; /* 工艺流程ID*/ public static final String COL_tech_flow_id = "tech_flow_id"; /* 工艺流程ID*/
...@@ -116,7 +116,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -116,7 +116,7 @@ public class HGSC008 extends DaoEPBase {
public static final String BATCH_DELETE = "HGSC008.batch_delete"; public static final String BATCH_DELETE = "HGSC008.batch_delete";
private Long id = new Long(0); private Long id = new Long(0);
private Long matId = new Long(0); /* 物料清单ID*/ private Long matId = new Long(0); /* 物料清单ID*/
private Long taskId = new Long(0); /* 生产任务ID*/ private Long taskId = new Long(0); /* 生产任务ID*/
private Long techFlowId = new Long(0); /* 工艺流程ID*/ private Long techFlowId = new Long(0); /* 工艺流程ID*/
...@@ -142,7 +142,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -142,7 +142,7 @@ public class HGSC008 extends DaoEPBase {
private String groupCode = " "; /* 工作组编号*/ private String groupCode = " "; /* 工作组编号*/
private String groupName = " "; /* 工作组名称*/ private String groupName = " "; /* 工作组名称*/
private String registerDate = " "; /* 报工日期*/ private String registerDate = " "; /* 报工日期*/
private Integer quantity = new Integer(0); /* 数量*/ private BigDecimal quantity = new BigDecimal(0); /* 数量*/
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/ private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/ private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/
private String accountCode = " "; /* 帐套*/ private String accountCode = " "; /* 帐套*/
...@@ -158,18 +158,18 @@ public class HGSC008 extends DaoEPBase { ...@@ -158,18 +158,18 @@ public class HGSC008 extends DaoEPBase {
//补充字段 //补充字段
private Integer registeredQuantity = new Integer(0); private BigDecimal registeredQuantity = new BigDecimal(0);
private BigDecimal registeredWeight = new BigDecimal(0); private BigDecimal registeredWeight = new BigDecimal(0);
private Integer unregisterQuantity = new Integer(0); private BigDecimal unregisterQuantity = new BigDecimal(0);
private BigDecimal unregisterWeight = new BigDecimal(0); private BigDecimal unregisterWeight = new BigDecimal(0);
private Integer taskQuantity = new Integer(0); private BigDecimal taskQuantity = new BigDecimal(0);
private BigDecimal taskWeight = new BigDecimal(0); private BigDecimal taskWeight = new BigDecimal(0);
public Integer getRegisteredQuantity() { public BigDecimal getRegisteredQuantity() {
return registeredQuantity; return registeredQuantity;
} }
public void setRegisteredQuantity(Integer registeredQuantity) { public void setRegisteredQuantity(BigDecimal registeredQuantity) {
this.registeredQuantity = registeredQuantity; this.registeredQuantity = registeredQuantity;
} }
...@@ -181,11 +181,11 @@ public class HGSC008 extends DaoEPBase { ...@@ -181,11 +181,11 @@ public class HGSC008 extends DaoEPBase {
this.registeredWeight = registeredWeight; this.registeredWeight = registeredWeight;
} }
public Integer getUnregisterQuantity() { public BigDecimal getUnregisterQuantity() {
return unregisterQuantity; return unregisterQuantity;
} }
public void setUnregisterQuantity(Integer unregisterQuantity) { public void setUnregisterQuantity(BigDecimal unregisterQuantity) {
this.unregisterQuantity = unregisterQuantity; this.unregisterQuantity = unregisterQuantity;
} }
...@@ -197,11 +197,11 @@ public class HGSC008 extends DaoEPBase { ...@@ -197,11 +197,11 @@ public class HGSC008 extends DaoEPBase {
this.unregisterWeight = unregisterWeight; this.unregisterWeight = unregisterWeight;
} }
public Integer getTaskQuantity() { public BigDecimal getTaskQuantity() {
return taskQuantity; return taskQuantity;
} }
public void setTaskQuantity(Integer taskQuantity) { public void setTaskQuantity(BigDecimal taskQuantity) {
this.taskQuantity = taskQuantity; this.taskQuantity = taskQuantity;
} }
...@@ -325,6 +325,9 @@ public class HGSC008 extends DaoEPBase { ...@@ -325,6 +325,9 @@ public class HGSC008 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_quantity); eiColumn = new EiColumn(FIELD_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("数量"); eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -393,6 +396,9 @@ public class HGSC008 extends DaoEPBase { ...@@ -393,6 +396,9 @@ public class HGSC008 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_task_quantity); eiColumn = new EiColumn(FIELD_task_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("任务数量"); eiColumn.setDescName("任务数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -443,7 +449,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -443,7 +449,7 @@ public class HGSC008 extends DaoEPBase {
/** /**
* set the id . * set the id .
* *
* @param id * @param id
*/ */
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
...@@ -852,7 +858,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -852,7 +858,7 @@ public class HGSC008 extends DaoEPBase {
* get the quantity - 数量. * get the quantity - 数量.
* @return the quantity * @return the quantity
*/ */
public Integer getQuantity() { public BigDecimal getQuantity() {
return this.quantity; return this.quantity;
} }
...@@ -861,7 +867,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -861,7 +867,7 @@ public class HGSC008 extends DaoEPBase {
* *
* @param quantity - 数量 * @param quantity - 数量
*/ */
public void setQuantity(Integer quantity) { public void setQuantity(BigDecimal quantity) {
this.quantity = quantity; this.quantity = quantity;
} }
/** /**
...@@ -1067,7 +1073,7 @@ public class HGSC008 extends DaoEPBase { ...@@ -1067,7 +1073,7 @@ public class HGSC008 extends DaoEPBase {
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_code)), groupCode)); setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_code)), groupCode));
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName)); setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName));
setRegisterDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_register_date)), registerDate)); setRegisterDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_register_date)), registerDate));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity)); setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_quantity)), quantity));
setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight)); setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight));
setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight)); setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_account_code)), accountCode)); setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_account_code)), accountCode));
...@@ -1078,11 +1084,11 @@ public class HGSC008 extends DaoEPBase { ...@@ -1078,11 +1084,11 @@ public class HGSC008 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_name)), updatedName)); setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_name)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_time)), updatedTime)); setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_time)), updatedTime));
setRegisteredQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_registered_quantity)), registeredQuantity)); setRegisteredQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_registered_quantity)), registeredQuantity));
setRegisteredWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_registered_weight)), registeredWeight)); setRegisteredWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_registered_weight)), registeredWeight));
setUnregisterQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unregister_quantity)), unregisterQuantity)); setUnregisterQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unregister_quantity)), unregisterQuantity));
setUnregisterWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unregister_weight)), unregisterWeight)); setUnregisterWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unregister_weight)), unregisterWeight));
setTaskQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_task_quantity)), taskQuantity)); setTaskQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_task_quantity)), taskQuantity));
setTaskWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_task_weight)), taskWeight)); setTaskWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_task_weight)), taskWeight));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_spec)), spec)); setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_spec)), spec));
setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_length)), length)); setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_length)), length));
......
...@@ -81,7 +81,7 @@ public class ServiceHGSC006A extends ServiceBase { ...@@ -81,7 +81,7 @@ public class ServiceHGSC006A extends ServiceBase {
// 校验主订单是否已分派 // 校验主订单是否已分派
//HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(Long.parseLong(orderDetailId)); //HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(Long.parseLong(orderDetailId));
AssignStatusEnum assignStatusEnum = AssignStatusEnum.getEnumByCode(hgsc006A.getAssignStatus()); AssignStatusEnum assignStatusEnum = AssignStatusEnum.getEnumByCode(hgsc006A.getAssignStatus());
Integer assignQuantity = new Integer(0); BigDecimal assignQuantity = BigDecimal.ZERO;
switch (assignStatusEnum){ switch (assignStatusEnum){
case UNASSIGN: case UNASSIGN:
assignQuantity = hgsc006A.getQuantity(); assignQuantity = hgsc006A.getQuantity();
...@@ -112,7 +112,7 @@ public class ServiceHGSC006A extends ServiceBase { ...@@ -112,7 +112,7 @@ public class ServiceHGSC006A extends ServiceBase {
hgsc007.setOrderDetailId(hgsc006A.getId()); hgsc007.setOrderDetailId(hgsc006A.getId());
hgsc007.setQuantity(assignQuantity); hgsc007.setQuantity(assignQuantity);
hgsc007.setUnfinishQuantity(assignQuantity); hgsc007.setUnfinishQuantity(assignQuantity);
hgsc007.setTotalWeight(hgsc006A.getSingleWeight().multiply(new BigDecimal(assignQuantity))); hgsc007.setTotalWeight(hgsc006A.getSingleWeight().multiply(assignQuantity));
hgsc007.setUnfinishWeight(hgsc007.getTotalWeight()); hgsc007.setUnfinishWeight(hgsc007.getTotalWeight());
hgsc007.setGroupCode(groupCode); hgsc007.setGroupCode(groupCode);
hgsc007.setGroupName(groupName); hgsc007.setGroupName(groupName);
......
...@@ -165,8 +165,8 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -165,8 +165,8 @@ public class ServiceHGSC006B extends ServiceBase {
List<HGSC007> hgsc007s = MapUtils.toDaoEPBases(resultRows, HGSC007.class); List<HGSC007> hgsc007s = MapUtils.toDaoEPBases(resultRows, HGSC007.class);
// 判断数量是否超过订单数量 // 判断数量是否超过订单数量
Integer totalNum = hgsc007s.stream().mapToInt(HGSC007::getQuantity).sum(); BigDecimal totalNum = hgsc007s.stream().map(HGSC007::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
AssertUtils.isGt(new BigDecimal(totalNum), new BigDecimal(hgsc006A.getQuantity()), "拆单的分派数量不能大于生产订单数量!"); AssertUtils.isGt(totalNum, hgsc006A.getQuantity(), "拆单的分派数量不能大于生产订单数量!");
// 查询任务信息 // 查询任务信息
List<HGSC007> hgsc007List = HGSCTools.THGSC007.list(taskIds); List<HGSC007> hgsc007List = HGSCTools.THGSC007.list(taskIds);
//查询生产报工 //查询生产报工
...@@ -219,7 +219,7 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -219,7 +219,7 @@ public class ServiceHGSC006B extends ServiceBase {
add007.setOrderDetailId(hgsc006A.getId()); add007.setOrderDetailId(hgsc006A.getId());
add007.setQuantity(hgsc007.getQuantity()); add007.setQuantity(hgsc007.getQuantity());
add007.setUnfinishQuantity(hgsc007.getQuantity()); add007.setUnfinishQuantity(hgsc007.getQuantity());
add007.setTotalWeight(hgsc006A.getSingleWeight().multiply(new BigDecimal(hgsc007.getQuantity()))); add007.setTotalWeight(hgsc006A.getSingleWeight().multiply(hgsc007.getQuantity()));
add007.setUnfinishWeight(add007.getTotalWeight()); add007.setUnfinishWeight(add007.getTotalWeight());
add007.setGroupCode(hgsc007.getGroupCode()); add007.setGroupCode(hgsc007.getGroupCode());
add007.setGroupName(hgsc007.getGroupName()); add007.setGroupName(hgsc007.getGroupName());
...@@ -271,7 +271,7 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -271,7 +271,7 @@ public class ServiceHGSC006B extends ServiceBase {
sc007.setFactoryName(hgsc007.getFactoryName()); sc007.setFactoryName(hgsc007.getFactoryName());
sc007.setQuantity(hgsc007.getQuantity()); sc007.setQuantity(hgsc007.getQuantity());
sc007.setUnfinishQuantity(hgsc007.getQuantity()); sc007.setUnfinishQuantity(hgsc007.getQuantity());
sc007.setTotalWeight(sc007.getSingleWeight().multiply(new BigDecimal(hgsc007.getQuantity()))); sc007.setTotalWeight(sc007.getSingleWeight().multiply(hgsc007.getQuantity()));
sc007.setUnfinishWeight(sc007.getTotalWeight()); sc007.setUnfinishWeight(sc007.getTotalWeight());
DaoUtils.update(HGSC007.UPDATE, sc007); DaoUtils.update(HGSC007.UPDATE, sc007);
...@@ -296,10 +296,10 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -296,10 +296,10 @@ public class ServiceHGSC006B extends ServiceBase {
HGSC007 hgsc007 = new HGSC007(); HGSC007 hgsc007 = new HGSC007();
hgsc007.fromMap(resultRow); hgsc007.fromMap(resultRow);
HGSC007 dbsc007 = HGSCTools.THGSC007.getById(hgsc007.getId()); HGSC007 dbsc007 = HGSCTools.THGSC007.getById(hgsc007.getId());
AssertUtils.isGt(new BigDecimal(dbsc007.getFinishQuantity()), BigDecimal.ZERO, AssertUtils.isGt(dbsc007.getFinishQuantity(), BigDecimal.ZERO,
String.format("任务[%s]已存在完工数量不能删除", dbsc007.getTaskCode())); String.format("任务[%s]已存在完工数量不能删除", dbsc007.getTaskCode()));
// 更新订单主表数量 // 更新订单主表数量
HGSCTools.checkAssignedNum(orderDetailId, -hgsc007.getQuantity()); HGSCTools.checkAssignedNum(orderDetailId, hgsc007.getQuantity().negate());
// 删除子单 // 删除子单
DaoUtils.update(HGSC007.DELETE, hgsc007); DaoUtils.update(HGSC007.DELETE, hgsc007);
// 清除已经分配的人员信息 // 清除已经分配的人员信息
...@@ -335,24 +335,24 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -335,24 +335,24 @@ public class ServiceHGSC006B extends ServiceBase {
* @param hgsc006A 生产订单明细 * @param hgsc006A 生产订单明细
* @param totalNum 任务数量 * @param totalNum 任务数量
*/ */
public void checkAssignedNum(HGSC006A hgsc006A,Integer totalNum) { public void checkAssignedNum(HGSC006A hgsc006A, BigDecimal totalNum) {
// 生产订单 // 生产订单
//HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(orderDetailId); //HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(orderDetailId);
Integer jhNum = hgsc006A.getQuantity(); BigDecimal jhNum = hgsc006A.getQuantity();
Map updateMap = new HashMap<>(); Map updateMap = new HashMap<>();
updateMap.put(HGSC006A.FIELD_id, hgsc006A.getId()); updateMap.put(HGSC006A.FIELD_id, hgsc006A.getId());
updateMap.put(HGSC006A.FIELD_assign_quantity, totalNum); updateMap.put(HGSC006A.FIELD_assign_quantity, totalNum);
updateMap.put(HGSC006A.FIELD_unassign_quantity, jhNum - totalNum); updateMap.put(HGSC006A.FIELD_unassign_quantity, jhNum.subtract(totalNum));
if(Objects.nonNull(hgsc006A.getSingleWeight())&&hgsc006A.getSingleWeight().compareTo(BigDecimal.ZERO)>0) { if(Objects.nonNull(hgsc006A.getSingleWeight())&&hgsc006A.getSingleWeight().compareTo(BigDecimal.ZERO)>0) {
BigDecimal assignWeight = hgsc006A.getSingleWeight().multiply(new BigDecimal(totalNum)); BigDecimal assignWeight = hgsc006A.getSingleWeight().multiply(totalNum);
updateMap.put(HGSC006A.FIELD_assign_weight, assignWeight); updateMap.put(HGSC006A.FIELD_assign_weight, assignWeight);
updateMap.put(HGSC006A.FIELD_unassign_weight, hgsc006A.getTotalWeight().subtract(assignWeight)); updateMap.put(HGSC006A.FIELD_unassign_weight, hgsc006A.getTotalWeight().subtract(assignWeight));
} }
// 0.未派工,1.部分派工,2.全部派工 // 0.未派工,1.部分派工,2.全部派工
AssignStatusEnum orderDetailAssignStatus ; AssignStatusEnum orderDetailAssignStatus;
if (jhNum - totalNum==0) { if (jhNum.subtract(totalNum).compareTo(BigDecimal.ZERO) == 0) {
orderDetailAssignStatus = AssignStatusEnum.ASSIGNED; orderDetailAssignStatus = AssignStatusEnum.ASSIGNED;
} else if (totalNum>0) { } else if (totalNum.compareTo(BigDecimal.ZERO) > 0) {
orderDetailAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN; orderDetailAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} else { } else {
orderDetailAssignStatus = AssignStatusEnum.UNASSIGN; orderDetailAssignStatus = AssignStatusEnum.UNASSIGN;
...@@ -364,13 +364,16 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -364,13 +364,16 @@ public class ServiceHGSC006B extends ServiceBase {
private void handleOrderAssignStatus(HGSC006A hgsc006A, AssignStatusEnum orderDetailAssignStatus){ private void handleOrderAssignStatus(HGSC006A hgsc006A, AssignStatusEnum orderDetailAssignStatus){
List<HGSC006A> otherSc006AList = HGSCTools.THGSC006A.otherById(hgsc006A.getOrderCode(),hgsc006A.getId()); List<HGSC006A> otherSc006AList = HGSCTools.THGSC006A.otherById(hgsc006A.getOrderCode(),hgsc006A.getId());
int assignQuantity = 0; BigDecimal assignQuantity = BigDecimal.ZERO;
int unassignQuantity = 0; BigDecimal unassignQuantity = BigDecimal.ZERO;
int totalQuantity = 0; BigDecimal totalQuantity = BigDecimal.ZERO;
if(CollectionUtils.isNotEmpty(otherSc006AList)){ if(CollectionUtils.isNotEmpty(otherSc006AList)){
assignQuantity = otherSc006AList.stream().mapToInt(HGSC006A::getAssignQuantity).sum(); assignQuantity = otherSc006AList.stream().map(HGSC006A::getAssignQuantity)
unassignQuantity = otherSc006AList.stream().mapToInt(HGSC006A::getUnassignQuantity).sum(); .reduce(BigDecimal.ZERO, BigDecimal::add);
totalQuantity = otherSc006AList.stream().mapToInt(HGSC006A::getQuantity).sum(); unassignQuantity = otherSc006AList.stream().map(HGSC006A::getUnassignQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
totalQuantity = otherSc006AList.stream().map(HGSC006A::getQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
} }
AssignStatusEnum orderAssignStatus ; AssignStatusEnum orderAssignStatus ;
switch (orderDetailAssignStatus){ switch (orderDetailAssignStatus){
......
...@@ -48,9 +48,11 @@ public class ServiceHGSC007A extends ServiceEPBase { ...@@ -48,9 +48,11 @@ public class ServiceHGSC007A extends ServiceEPBase {
hgsc008.setTaskId(hgsc007.getId()); hgsc008.setTaskId(hgsc007.getId());
hgsc008.setTaskQuantity(hgsc007.getQuantity()); hgsc008.setTaskQuantity(hgsc007.getQuantity());
hgsc008.setTaskWeight(hgsc007.getTotalWeight()); hgsc008.setTaskWeight(hgsc007.getTotalWeight());
hgsc008.setRegisteredQuantity(Optional.ofNullable(old008List).orElse(new ArrayList<>()).stream().mapToInt(HGSC008::getQuantity).sum()); hgsc008.setRegisteredQuantity(Optional.ofNullable(old008List).orElse(new ArrayList<>()).stream()
hgsc008.setRegisteredWeight(Optional.ofNullable(old008List).orElse(new ArrayList<>()).stream().map(HGSC008::getTotalWeight).reduce(BigDecimal.ZERO, BigDecimal::add)); .map(HGSC008::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
hgsc008.setUnregisterQuantity(hgsc007.getQuantity() - hgsc008.getRegisteredQuantity()); hgsc008.setRegisteredWeight(Optional.ofNullable(old008List).orElse(new ArrayList<>()).stream()
.map(HGSC008::getTotalWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
hgsc008.setUnregisterQuantity(hgsc007.getQuantity().subtract(hgsc008.getRegisteredQuantity()));
hgsc008.setUnregisterWeight(hgsc007.getTotalWeight().subtract(hgsc008.getRegisteredWeight())); hgsc008.setUnregisterWeight(hgsc007.getTotalWeight().subtract(hgsc008.getRegisteredWeight()));
hgsc008.setRegisterDate(DateUtil.toDateStr(new Date(),DateUtil.DATE10_PATTERN)); hgsc008.setRegisterDate(DateUtil.toDateStr(new Date(),DateUtil.DATE10_PATTERN));
hgsc008.setQuantity(null); hgsc008.setQuantity(null);
...@@ -67,8 +69,8 @@ public class ServiceHGSC007A extends ServiceEPBase { ...@@ -67,8 +69,8 @@ public class ServiceHGSC007A extends ServiceEPBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try{ try{
Map resultMap = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock); Map resultMap = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
HGSC008 hgsc008 =HGSCTools.THGSC008.add(inInfo); HGSC008 hgsc008 = HGSCTools.THGSC008.add(inInfo);
String docId = org.apache.commons.collections.MapUtils.getString(resultMap, HGSB004A.FIELD_DOC_ID); String docId = MapUtils.getString(resultMap, HGSB004A.FIELD_DOC_ID);
if (StringUtils.isNotEmpty(docId)) { if (StringUtils.isNotEmpty(docId)) {
String [] docIds = docId.split(","); String [] docIds = docId.split(",");
for (String docIdStr : docIds){ for (String docIdStr : docIds){
......
...@@ -44,6 +44,7 @@ import com.baosight.hggp.util.DateUtil; ...@@ -44,6 +44,7 @@ import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.FileUtils; import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ProjectInfo; import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -52,7 +53,6 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -52,7 +53,6 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -90,40 +90,40 @@ public class HGSCTools { ...@@ -90,40 +90,40 @@ public class HGSCTools {
* @param orderDetailId 生产订单编码 * @param orderDetailId 生产订单编码
* @param assignNum 分派数量 * @param assignNum 分派数量
*/ */
public static void checkAssignedNum(Long orderDetailId, Integer assignNum) { public static void checkAssignedNum(Long orderDetailId, BigDecimal assignNum) {
// 生产订单 // 生产订单
HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(orderDetailId); HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(orderDetailId);
Integer jhNum = hgsc006A.getQuantity(); BigDecimal jhNum = hgsc006A.getQuantity();
// 子单 // 子单
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put(HGSC007.FIELD_order_detail_id, orderDetailId); queryMap.put(HGSC007.FIELD_order_detail_id, orderDetailId);
List<HGSC007> hgsc007List = DaoBase.getInstance().query(HGSC007.QUERY, queryMap, 0, -999999); List<HGSC007> hgsc007List = DaoBase.getInstance().query(HGSC007.QUERY, queryMap, 0, -999999);
Integer totalNum = assignNum; BigDecimal totalNum = assignNum;
if(CollectionUtils.isNotEmpty(hgsc007List)){ if(CollectionUtils.isNotEmpty(hgsc007List)){
for(HGSC007 dbsc007 : hgsc007List){ for(HGSC007 dbsc007 : hgsc007List){
totalNum = totalNum + dbsc007.getQuantity(); totalNum = totalNum.add(dbsc007.getQuantity());
} }
} }
// 判断数量是否超过订单数量 // 判断数量是否超过订单数量
AssertUtils.isGt(new BigDecimal(totalNum), new BigDecimal(jhNum), "拆单的分派数量不能大于生产订单数量!"); AssertUtils.isGt(totalNum, jhNum, "拆单的分派数量不能大于生产订单数量!");
Map updateMap = new HashMap(); Map updateMap = new HashMap();
updateMap.put(HGSC006A.FIELD_id, hgsc006A.getId()); updateMap.put(HGSC006A.FIELD_id, hgsc006A.getId());
updateMap.put(HGSC006A.FIELD_assign_quantity, totalNum); updateMap.put(HGSC006A.FIELD_assign_quantity, totalNum);
updateMap.put(HGSC006A.FIELD_unassign_quantity, jhNum - totalNum); updateMap.put(HGSC006A.FIELD_unassign_quantity, jhNum.subtract(totalNum));
if(Objects.nonNull(hgsc006A.getSingleWeight())&&hgsc006A.getSingleWeight().compareTo(BigDecimal.ZERO)>0) { if(Objects.nonNull(hgsc006A.getSingleWeight())&&hgsc006A.getSingleWeight().compareTo(BigDecimal.ZERO)>0) {
BigDecimal assignWeight = hgsc006A.getSingleWeight().multiply(new BigDecimal(totalNum)); BigDecimal assignWeight = hgsc006A.getSingleWeight().multiply(totalNum);
updateMap.put(HGSC006A.FIELD_assign_weight, assignWeight); updateMap.put(HGSC006A.FIELD_assign_weight, assignWeight);
updateMap.put(HGSC006A.FIELD_unassign_weight, hgsc006A.getTotalWeight().subtract(assignWeight)); updateMap.put(HGSC006A.FIELD_unassign_weight, hgsc006A.getTotalWeight().subtract(assignWeight));
} }
// 0.未派工,1.部分派工,2.全部派工 // 0.未派工,1.部分派工,2.全部派工
AssignStatusEnum orderDetailAssignStatus ; AssignStatusEnum orderDetailAssignStatus;
if (jhNum - totalNum==0) { if (jhNum.subtract(totalNum).compareTo(BigDecimal.ZERO) == 0) {
orderDetailAssignStatus = ASSIGNED; orderDetailAssignStatus = ASSIGNED;
} else if (totalNum>0) { } else if (totalNum.compareTo(BigDecimal.ZERO) > 0) {
orderDetailAssignStatus = PARTIAL_ASSIGN; orderDetailAssignStatus = PARTIAL_ASSIGN;
} else { } else {
orderDetailAssignStatus = UNASSIGN; orderDetailAssignStatus = UNASSIGN;
} }
updateMap.put(HGSC006A.FIELD_assign_status, orderDetailAssignStatus.getCode()); updateMap.put(HGSC006A.FIELD_assign_status, orderDetailAssignStatus.getCode());
DaoUtils.update(HGSC006A.UPDATE_ASSIGN_NUM, updateMap); DaoUtils.update(HGSC006A.UPDATE_ASSIGN_NUM, updateMap);
handleOrderAssignStatus(hgsc006A,orderDetailAssignStatus); handleOrderAssignStatus(hgsc006A,orderDetailAssignStatus);
...@@ -131,13 +131,16 @@ public class HGSCTools { ...@@ -131,13 +131,16 @@ public class HGSCTools {
private static void handleOrderAssignStatus(HGSC006A hgsc006A, AssignStatusEnum orderDetailAssignStatus){ private static void handleOrderAssignStatus(HGSC006A hgsc006A, AssignStatusEnum orderDetailAssignStatus){
List<HGSC006A> otherSc006AList = HGSCTools.THGSC006A.otherById(hgsc006A.getOrderCode(),hgsc006A.getId()); List<HGSC006A> otherSc006AList = HGSCTools.THGSC006A.otherById(hgsc006A.getOrderCode(),hgsc006A.getId());
int assignQuantity = 0; BigDecimal assignQuantity = BigDecimal.ZERO;
int unassignQuantity = 0; BigDecimal unassignQuantity = BigDecimal.ZERO;
int totalQuantity = 0; BigDecimal totalQuantity = BigDecimal.ZERO;
if(CollectionUtils.isNotEmpty(otherSc006AList)){ if(CollectionUtils.isNotEmpty(otherSc006AList)){
assignQuantity = otherSc006AList.stream().mapToInt(HGSC006A::getAssignQuantity).sum(); assignQuantity = otherSc006AList.stream().map(HGSC006A::getAssignQuantity)
unassignQuantity = otherSc006AList.stream().mapToInt(HGSC006A::getUnassignQuantity).sum(); .reduce(BigDecimal.ZERO, BigDecimal::add);
totalQuantity = otherSc006AList.stream().mapToInt(HGSC006A::getQuantity).sum(); unassignQuantity = otherSc006AList.stream().map(HGSC006A::getUnassignQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
totalQuantity = otherSc006AList.stream().map(HGSC006A::getQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
} }
AssignStatusEnum orderAssignStatus ; AssignStatusEnum orderAssignStatus ;
switch (orderDetailAssignStatus){ switch (orderDetailAssignStatus){
...@@ -168,7 +171,7 @@ public class HGSCTools { ...@@ -168,7 +171,7 @@ public class HGSCTools {
} }
public static void complete(Long checkId, Integer completeNum, Long rectificationId, Integer storageType){ public static void complete(Long checkId, BigDecimal completeNum, Long rectificationId, Integer storageType){
HGZL002 hgzl002 = HGZLTools.THGZL002.get(checkId); HGZL002 hgzl002 = HGZLTools.THGZL002.get(checkId);
//如果是退回,需要修改整改通知单状态,工序质检单状态 //如果是退回,需要修改整改通知单状态,工序质检单状态
if(storageType.intValue() == HGConstant.StorageType.TH){ if(storageType.intValue() == HGConstant.StorageType.TH){
...@@ -186,27 +189,26 @@ public class HGSCTools { ...@@ -186,27 +189,26 @@ public class HGSCTools {
} }
HGSC008 hgsc008 = THGSC008.getById(hgzl002.getWorkId()); HGSC008 hgsc008 = THGSC008.getById(hgzl002.getWorkId());
HGSC007 hgsc007 = THGSC007.getById(hgsc008.getTaskId()); HGSC007 hgsc007 = THGSC007.getById(hgsc008.getTaskId());
//更新生产任务完工数量 //更新生产任务完工数量
Integer finishQuatity = hgsc007.getFinishQuantity()+completeNum; BigDecimal finishQuatity = hgsc007.getFinishQuantity().add(completeNum);
// AssertUtils.isTrue(hgsc007.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!"); AssertUtils.isTrue(finishQuatity.compareTo(BigDecimal.ZERO) < 0, "扣除完工数量不能大于已完工数量!");
AssertUtils.isTrue(finishQuatity<0,"扣除完工数量不能大于已完工数量!"); hgsc007.setFinishQuantity(finishQuatity);
hgsc007.setFinishQuantity(finishQuatity); hgsc007.setUnfinishQuantity(hgsc007.getQuantity().subtract(finishQuatity));
hgsc007.setUnfinishQuantity(hgsc007.getQuantity() - finishQuatity); hgsc007.setFinishWeight(hgsc007.getSingleWeight().multiply(finishQuatity));
hgsc007.setFinishWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(finishQuatity))); hgsc007.setUnfinishWeight(hgsc007.getSingleWeight().multiply(hgsc007.getUnfinishQuantity()));
hgsc007.setUnfinishWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc007.getUnfinishQuantity()))); if (hgsc007.getUnfinishQuantity().compareTo(BigDecimal.ZERO) == 0) {
if(hgsc007.getUnfinishQuantity()==0){ hgsc007.setCompleteDate(DateUtil.toDateStr(new Date(), DateUtil.DATE10_PATTERN));
hgsc007.setCompleteDate(DateUtil.toDateStr(new Date(),DateUtil.DATE10_PATTERN)); }
}
DaoUtils.update(HGSC007.UPDATE,hgsc007); DaoUtils.update(HGSC007.UPDATE,hgsc007);
HGSC006A hgsc006A = THGSC006A.getById(hgsc007.getOrderDetailId()); HGSC006A hgsc006A = THGSC006A.getById(hgsc007.getOrderDetailId());
HGSC005A hgsc005A = THGSC005A.getById(hgsc006A.getPlanDetailId()); HGSC005A hgsc005A = THGSC005A.getById(hgsc006A.getPlanDetailId());
finishQuatity = hgsc005A.getFinishQuantity()+completeNum; finishQuatity = hgsc005A.getFinishQuantity().add(completeNum);
// AssertUtils.isTrue(hgsc005A.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!"); // AssertUtils.isTrue(hgsc005A.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!");
AssertUtils.isTrue(finishQuatity<0,"扣除完工数量不能大于已完工数量!"); AssertUtils.isTrue(finishQuatity.compareTo(BigDecimal.ZERO) < 0, "扣除完工数量不能大于已完工数量!");
hgsc005A.setFinishQuantity(finishQuatity); hgsc005A.setFinishQuantity(finishQuatity);
hgsc005A.setUnfinishQuantity(hgsc005A.getQuantity() - finishQuatity); hgsc005A.setUnfinishQuantity(hgsc005A.getQuantity().subtract(finishQuatity));
hgsc005A.setFinishWeight(hgsc005A.getSingleWeight().multiply(new BigDecimal(finishQuatity))); hgsc005A.setFinishWeight(hgsc005A.getSingleWeight().multiply(finishQuatity));
hgsc005A.setUnfinishWeight(hgsc005A.getSingleWeight().multiply(new BigDecimal(hgsc007.getUnfinishQuantity()))); hgsc005A.setUnfinishWeight(hgsc005A.getSingleWeight().multiply(hgsc007.getUnfinishQuantity()));
DaoUtils.update(HGSC005A.UPDATE,hgsc005A); DaoUtils.update(HGSC005A.UPDATE,hgsc005A);
} }
...@@ -577,16 +579,23 @@ public class HGSCTools { ...@@ -577,16 +579,23 @@ public class HGSCTools {
public static class THGSC005{ public static class THGSC005{
public static List<HGSC005> buildFinishRate(List<HGSC005> hgsc005List){ public static List<HGSC005> buildFinishRate(List<HGSC005> hgsc005List){
if(CollectionUtils.isNotEmpty(hgsc005List)){ if(CollectionUtils.isNotEmpty(hgsc005List)){
List<HGSC005A> hgsc005AList = THGSC005A.queryByPlanCodes(hgsc005List.stream().map(HGSC005::getPlanCode).collect(Collectors.toList())); List<HGSC005A> hgsc005AList = THGSC005A.queryByPlanCodes(
Map<String,Double> finishRateMap = hgsc005AList.stream().collect(Collectors.groupingBy(HGSC005A::getPlanCode, hgsc005List.stream().map(HGSC005::getPlanCode).collect(Collectors.toList()));
Collectors.collectingAndThen(Collectors.toList(),list->{ Map<String, BigDecimal> finishRateMap = hgsc005AList.stream()
return list.stream().mapToDouble(HGSC005A::getFinishQuantity).sum()/list.stream().mapToDouble(HGSC005A::getQuantity).sum(); .collect(Collectors.groupingBy(HGSC005A::getPlanCode,
}))); Collectors.collectingAndThen(Collectors.toList(), list -> {
hgsc005List.forEach(hgsc005 -> { BigDecimal finishQuantitySum = list.stream().map(HGSC005A::getFinishQuantity)
hgsc005.setFinishRate( .reduce(BigDecimal.ZERO, BigDecimal::add);
MapUtils.isNotEmpty(finishRateMap)&&Objects.nonNull(finishRateMap.get(hgsc005.getPlanCode()))?new BigDecimal(finishRateMap.get(hgsc005.getPlanCode())) BigDecimal quantitySum = list.stream().map(HGSC005A::getQuantity)
.setScale(0, ROUND_DOWN).doubleValue():0); .reduce(BigDecimal.ZERO, BigDecimal::add);
}); return finishQuantitySum.divide(quantitySum, 3, RoundingMode.HALF_UP);
})));
hgsc005List.forEach(hgsc005 -> {
hgsc005.setFinishRate(MapUtils.isNotEmpty(finishRateMap)
&& Objects.nonNull(finishRateMap.get(hgsc005.getPlanCode())) ?
finishRateMap.get(hgsc005.getPlanCode()).setScale(0, ROUND_DOWN).doubleValue()
: 0);
});
} }
return hgsc005List; return hgsc005List;
} }
...@@ -772,7 +781,7 @@ public class HGSCTools { ...@@ -772,7 +781,7 @@ public class HGSCTools {
Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList) Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList)
.orElse(new ArrayList<>()).stream() .orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy( .collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity)))); Comparator.comparing(HGSC005A::getQuantity))));
returnOldObjMap.putAll(oldObjMap); returnOldObjMap.putAll(oldObjMap);
} else { } else {
List<HGSC005A> oldObjFilterList = oldObjList.stream() List<HGSC005A> oldObjFilterList = oldObjList.stream()
...@@ -781,7 +790,7 @@ public class HGSCTools { ...@@ -781,7 +790,7 @@ public class HGSCTools {
Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList) Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList)
.orElse(new ArrayList<>()).stream() .orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy( .collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity)))); Comparator.comparing(HGSC005A::getQuantity))));
returnOldObjMap.putAll(oldObjMap); returnOldObjMap.putAll(oldObjMap);
} }
}); });
...@@ -804,7 +813,7 @@ public class HGSCTools { ...@@ -804,7 +813,7 @@ public class HGSCTools {
return o.getProductCode() + "#" + o.getInventProcessId(); return o.getProductCode() + "#" + o.getInventProcessId();
}, },
Collectors.collectingAndThen(Collectors.maxBy( Collectors.collectingAndThen(Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity)), Optional::get))); Comparator.comparing(HGSC005A::getQuantity)), Optional::get)));
} }
return null; return null;
} }
...@@ -820,7 +829,7 @@ public class HGSCTools { ...@@ -820,7 +829,7 @@ public class HGSCTools {
List<HGSC005A> oldObjList = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap); List<HGSC005A> oldObjList = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjList).orElse(new ArrayList<>()).stream() Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy( .collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity)))); Comparator.comparing(HGSC005A::getQuantity))));
return oldObjMap; return oldObjMap;
} }
...@@ -864,8 +873,8 @@ public class HGSCTools { ...@@ -864,8 +873,8 @@ public class HGSCTools {
Optional<HGSC005A> op = oldObjMap.get(o.getInventProcessId()); Optional<HGSC005A> op = oldObjMap.get(o.getInventProcessId());
if (Objects.nonNull(op)) { if (Objects.nonNull(op)) {
HGSC005A uo = op.get(); HGSC005A uo = op.get();
uo.setQuantity(uo.getQuantity() + o.getQuantity()); uo.setQuantity(uo.getQuantity().add(o.getQuantity()));
uo.setUnfinishQuantity(uo.getUnfinishQuantity() + o.getQuantity()); uo.setUnfinishQuantity(uo.getUnfinishQuantity().add(o.getQuantity()));
handleWeight(hgsc005a, uo); handleWeight(hgsc005a, uo);
updateList.add(uo); updateList.add(uo);
} else { } else {
...@@ -898,7 +907,7 @@ public class HGSCTools { ...@@ -898,7 +907,7 @@ public class HGSCTools {
if (Objects.nonNull(op)) { if (Objects.nonNull(op)) {
HGSC005A uo = op.get(); HGSC005A uo = op.get();
uo.setQuantity(o.getQuantity()); uo.setQuantity(o.getQuantity());
uo.setUnfinishQuantity(o.getQuantity() - uo.getFinishQuantity()); uo.setUnfinishQuantity(o.getQuantity().subtract(uo.getFinishQuantity()));
handleWeight(hgsc005a, uo); handleWeight(hgsc005a, uo);
updateList.add(uo); updateList.add(uo);
} else { } else {
...@@ -926,12 +935,12 @@ public class HGSCTools { ...@@ -926,12 +935,12 @@ public class HGSCTools {
List<HGSC005A> updateList = new ArrayList<>(); List<HGSC005A> updateList = new ArrayList<>();
oldObjMap.forEach((k, v) -> { oldObjMap.forEach((k, v) -> {
HGSC005A oldObj = v.get(); HGSC005A oldObj = v.get();
if (oldObj.getQuantity() - hgsc005a.getQuantity() <= 0) { if (oldObj.getQuantity().subtract(hgsc005a.getQuantity()).compareTo(BigDecimal.ZERO) <= 0) {
handleWeight(hgsc005a, oldObj); handleWeight(hgsc005a, oldObj);
deleteIds.add(oldObj.getId()); deleteIds.add(oldObj.getId());
} else { } else {
oldObj.setQuantity(oldObj.getQuantity() - hgsc005a.getQuantity()); oldObj.setQuantity(oldObj.getQuantity().subtract(hgsc005a.getQuantity()));
oldObj.setUnfinishQuantity(oldObj.getQuantity() - oldObj.getFinishQuantity()); oldObj.setUnfinishQuantity(oldObj.getQuantity().subtract(oldObj.getFinishQuantity()));
handleWeight(hgsc005a, oldObj); handleWeight(hgsc005a, oldObj);
updateList.add(oldObj); updateList.add(oldObj);
} }
...@@ -963,8 +972,8 @@ public class HGSCTools { ...@@ -963,8 +972,8 @@ public class HGSCTools {
if (CollectionUtils.isNotEmpty(hgsc005aList)) { if (CollectionUtils.isNotEmpty(hgsc005aList)) {
Map<String, HGSC005A> hgsc005aMap = hgsc005aList.stream() Map<String, HGSC005A> hgsc005aMap = hgsc005aList.stream()
.collect(Collectors.toMap(HGSC005A::getProductCode, o -> o, (o1, o2) -> { .collect(Collectors.toMap(HGSC005A::getProductCode, o -> o, (o1, o2) -> {
o1.setQuantity(o1.getQuantity() + o2.getQuantity()); o1.setQuantity(o1.getQuantity().add(o2.getQuantity()));
o1.setTotalWeight(o1.getSingleWeight().multiply(new BigDecimal(o1.getQuantity()))); o1.setTotalWeight(o1.getSingleWeight().multiply(o1.getQuantity()));
return o1; return o1;
})); }));
checkUpdateData(hgsc005aList); checkUpdateData(hgsc005aList);
...@@ -973,12 +982,12 @@ public class HGSCTools { ...@@ -973,12 +982,12 @@ public class HGSCTools {
oldObjMap.forEach((k, oldObj) -> { oldObjMap.forEach((k, oldObj) -> {
if (Objects.nonNull(oldObj)) { if (Objects.nonNull(oldObj)) {
HGSC005A hgsc005a = hgsc005aMap.get(k.split("#")[0]); HGSC005A hgsc005a = hgsc005aMap.get(k.split("#")[0]);
if (oldObj.getQuantity() - hgsc005a.getQuantity() <= 0) { if (oldObj.getQuantity().subtract(hgsc005a.getQuantity()).compareTo(BigDecimal.ZERO) <= 0) {
handleWeight(hgsc005a, oldObj); handleWeight(hgsc005a, oldObj);
deleteIds.add(oldObj.getId()); deleteIds.add(oldObj.getId());
} else { } else {
oldObj.setQuantity(oldObj.getQuantity() - hgsc005a.getQuantity()); oldObj.setQuantity(oldObj.getQuantity().subtract(hgsc005a.getQuantity()));
oldObj.setUnfinishQuantity(oldObj.getQuantity() - oldObj.getFinishQuantity()); oldObj.setUnfinishQuantity(oldObj.getQuantity().subtract(oldObj.getFinishQuantity()));
handleWeight(hgsc005a, oldObj); handleWeight(hgsc005a, oldObj);
updateList.add(oldObj); updateList.add(oldObj);
} }
...@@ -1007,10 +1016,9 @@ public class HGSCTools { ...@@ -1007,10 +1016,9 @@ public class HGSCTools {
private static void handleWeight(HGSC005A hgsc005a, HGSC005A target) { private static void handleWeight(HGSC005A hgsc005a, HGSC005A target) {
if (Objects.nonNull(hgsc005a.getSingleWeight())) { if (Objects.nonNull(hgsc005a.getSingleWeight())) {
target.setSingleWeight(hgsc005a.getSingleWeight()); target.setSingleWeight(hgsc005a.getSingleWeight());
target.setTotalWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getQuantity()))); target.setTotalWeight(hgsc005a.getSingleWeight().multiply(target.getQuantity()));
target.setFinishWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getFinishQuantity()))); target.setFinishWeight(hgsc005a.getSingleWeight().multiply(target.getFinishQuantity()));
target.setUnfinishWeight( target.setUnfinishWeight(hgsc005a.getSingleWeight().multiply(target.getUnfinishQuantity()));
hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getUnfinishQuantity())));
} }
} }
...@@ -1039,13 +1047,13 @@ public class HGSCTools { ...@@ -1039,13 +1047,13 @@ public class HGSCTools {
hgsc005a.setProjName(hgsc005.getProjName()); hgsc005a.setProjName(hgsc005.getProjName());
hgsc005a.setFinishDate(hgsc005.getFinishDate()); hgsc005a.setFinishDate(hgsc005.getFinishDate());
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity()); hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setFinishQuantity(0); hgsc005a.setFinishQuantity(BigDecimal.ZERO);
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight()); hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
//零件 //零件
if (hgsc005a.getProductType().compareTo(ProductTypeEnum.PART.getCode()) == 0) { if (hgsc005a.getProductType().compareTo(ProductTypeEnum.PART.getCode()) == 0) {
HGSC005A hisObj = hgsc005AMap.get(hgsc005a.getProductCode()); HGSC005A hisObj = hgsc005AMap.get(hgsc005a.getProductCode());
if (Objects.nonNull(hisObj)) { if (Objects.nonNull(hisObj)) {
hgsc005a.setQuantity(hgsc005a.getQuantity() + hisObj.getQuantity()); hgsc005a.setQuantity(hgsc005a.getQuantity().add(hisObj.getQuantity()));
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity()); hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setTotalWeight(hgsc005a.getTotalWeight().add(hisObj.getTotalWeight())); hgsc005a.setTotalWeight(hgsc005a.getTotalWeight().add(hisObj.getTotalWeight()));
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight()); hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
...@@ -1074,7 +1082,8 @@ public class HGSCTools { ...@@ -1074,7 +1082,8 @@ public class HGSCTools {
AssertUtils.isEmpty(hgsc005a.getProductName(), "产品名称不能为空!"); AssertUtils.isEmpty(hgsc005a.getProductName(), "产品名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getTechFlowId()) || hgsc005a.getTechFlowId() <= 0, AssertUtils.isTrue(Objects.isNull(hgsc005a.getTechFlowId()) || hgsc005a.getTechFlowId() <= 0,
"工艺流程ID不能为空!"); "工艺流程ID不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getQuantity()) || hgsc005a.getQuantity() <= 0, "数量不能为空!"); AssertUtils.isTrue(Objects.isNull(hgsc005a.getQuantity())
|| hgsc005a.getQuantity().compareTo(BigDecimal.ZERO) <= 0, "数量不能为空!");
} }
public static List<HGSC005A> constructObj(List<HGSC005A> hgsc005aList, HGSC005 hgsc005) { public static List<HGSC005A> constructObj(List<HGSC005A> hgsc005aList, HGSC005 hgsc005) {
...@@ -1088,7 +1097,7 @@ public class HGSCTools { ...@@ -1088,7 +1097,7 @@ public class HGSCTools {
hgsc005a.setProjName(hgsc005.getProjName()); hgsc005a.setProjName(hgsc005.getProjName());
hgsc005a.setFinishDate(hgsc005.getFinishDate()); hgsc005a.setFinishDate(hgsc005.getFinishDate());
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity()); hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setFinishQuantity(0); hgsc005a.setFinishQuantity(BigDecimal.ZERO);
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight()); hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
}); });
return hgsc005aList; return hgsc005aList;
...@@ -1105,7 +1114,7 @@ public class HGSCTools { ...@@ -1105,7 +1114,7 @@ public class HGSCTools {
hgsc005a.setProjName(hgsc005.getProjName()); hgsc005a.setProjName(hgsc005.getProjName());
hgsc005a.setFinishDate(hgsc005.getFinishDate()); hgsc005a.setFinishDate(hgsc005.getFinishDate());
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity()); hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setFinishQuantity(0); hgsc005a.setFinishQuantity(BigDecimal.ZERO);
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight()); hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
return hgsc005a; return hgsc005a;
} }
...@@ -1310,13 +1319,13 @@ public class HGSCTools { ...@@ -1310,13 +1319,13 @@ public class HGSCTools {
ComputeTypeEnum computeType = ComputeTypeEnum.getEnumByCode(dbSj001.getComputeType()); ComputeTypeEnum computeType = ComputeTypeEnum.getEnumByCode(dbSj001.getComputeType());
switch (computeType) { switch (computeType) {
case CD: case CD:
workHour.set(dbPz005.getLength().multiply(new BigDecimal(dbSc005A.getQuantity())) workHour.set(dbPz005.getLength().multiply(dbSc005A.getQuantity())
.divide(unitConver, 2, ROUND_DOWN).multiply(composingCoeff) .divide(unitConver, 2, ROUND_DOWN).multiply(composingCoeff)
.divide(timing, 2, ROUND_DOWN) .divide(timing, 2, ROUND_DOWN)
.multiply(baseWorkHour).add(remainder)); .multiply(baseWorkHour).add(remainder));
break; break;
case SL: case SL:
workHour.set(new BigDecimal(dbSc005A.getQuantity()).multiply(composingCoeff) workHour.set(dbSc005A.getQuantity().multiply(composingCoeff)
.divide(timing, 2, ROUND_DOWN) .divide(timing, 2, ROUND_DOWN)
.multiply(baseWorkHour).add(remainder)); .multiply(baseWorkHour).add(remainder));
break; break;
...@@ -1488,7 +1497,7 @@ public class HGSCTools { ...@@ -1488,7 +1497,7 @@ public class HGSCTools {
hgsc006a.setPlanEndDate(o.getPlanEndDate()); hgsc006a.setPlanEndDate(o.getPlanEndDate());
hgsc006a.setQuantity(o.getQuantity()); hgsc006a.setQuantity(o.getQuantity());
hgsc006a.setUnassignQuantity(o.getQuantity()); hgsc006a.setUnassignQuantity(o.getQuantity());
hgsc006a.setAssignQuantity(0); hgsc006a.setAssignQuantity(BigDecimal.ZERO);
hgsc006a.setSingleWeight(o.getSingleWeight()); hgsc006a.setSingleWeight(o.getSingleWeight());
hgsc006a.setTotalWeight(o.getTotalWeight()); hgsc006a.setTotalWeight(o.getTotalWeight());
hgsc006a.setUnassignWeight(hgsc006a.getTotalWeight()); hgsc006a.setUnassignWeight(hgsc006a.getTotalWeight());
...@@ -1642,10 +1651,10 @@ public class HGSCTools { ...@@ -1642,10 +1651,10 @@ public class HGSCTools {
BeanUtils.copyProperties(hgsc007, hgsc008); BeanUtils.copyProperties(hgsc007, hgsc008);
cleanBaseInfo(hgsc008); cleanBaseInfo(hgsc008);
hgsc008.setTaskId(hgsc007.getId()); hgsc008.setTaskId(hgsc007.getId());
hgsc008.setQuantity(NumberUtils.toInteger(resultMap.get(HGSC008.FIELD_quantity))); hgsc008.setQuantity(MapUtils.getBigDecimal(resultMap, HGSC008.FIELD_quantity));
hgsc008.setRegisterDate(String.valueOf(resultMap.get(HGSC008.FIELD_register_date))); hgsc008.setRegisterDate(String.valueOf(resultMap.get(HGSC008.FIELD_register_date)));
hgsc008.setExceedReason(resultMap.get(HGSC008.FIELD_exceed_reason).toString()); hgsc008.setExceedReason(resultMap.get(HGSC008.FIELD_exceed_reason).toString());
hgsc008.setTotalWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc008.getQuantity()))); hgsc008.setTotalWeight(hgsc007.getSingleWeight().multiply(hgsc008.getQuantity()));
checkAddDate(hgsc008); checkAddDate(hgsc008);
hgsc008.setWorkCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC008_WORK_CODE)); hgsc008.setWorkCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC008_WORK_CODE));
DaoUtils.insert(HGSC008.INSERT, hgsc008); DaoUtils.insert(HGSC008.INSERT, hgsc008);
......
...@@ -149,9 +149,9 @@ public class HGZL002 extends DaoEPBase { ...@@ -149,9 +149,9 @@ public class HGZL002 extends DaoEPBase {
private String groupName = " "; /* 工作组名称*/ private String groupName = " "; /* 工作组名称*/
private String workBy = " "; /* 生产人*/ private String workBy = " "; /* 生产人*/
private String workName = " "; /* 生产人名称*/ private String workName = " "; /* 生产人名称*/
private Integer quantity = new Integer(0); /* 数量*/ private BigDecimal quantity = new BigDecimal(0); /* 数量*/
private Integer passQuantity = new Integer(0); /* 合格数量*/ private BigDecimal passQuantity = new BigDecimal(0); /* 合格数量*/
private Integer unpassQuantity = new Integer(0); /* 不合格数量*/ private BigDecimal unpassQuantity = new BigDecimal(0); /* 不合格数量*/
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/ private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/ private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/
private String checkBy = " "; /* 质检人*/ private String checkBy = " "; /* 质检人*/
...@@ -286,14 +286,23 @@ public class HGZL002 extends DaoEPBase { ...@@ -286,14 +286,23 @@ public class HGZL002 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_quantity); eiColumn = new EiColumn(FIELD_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("数量"); eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_pass_quantity); eiColumn = new EiColumn(FIELD_pass_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("合格数量"); eiColumn.setDescName("合格数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_unpass_quantity); eiColumn = new EiColumn(FIELD_unpass_quantity);
eiColumn.setType("N");
eiColumn.setScaleLength(1);
eiColumn.setFieldLength(20);
eiColumn.setDescName("不合格数量"); eiColumn.setDescName("不合格数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -817,7 +826,7 @@ public class HGZL002 extends DaoEPBase { ...@@ -817,7 +826,7 @@ public class HGZL002 extends DaoEPBase {
* get the quantity - 数量. * get the quantity - 数量.
* @return the quantity * @return the quantity
*/ */
public Integer getQuantity() { public BigDecimal getQuantity() {
return this.quantity; return this.quantity;
} }
...@@ -826,14 +835,14 @@ public class HGZL002 extends DaoEPBase { ...@@ -826,14 +835,14 @@ public class HGZL002 extends DaoEPBase {
* *
* @param quantity - 数量 * @param quantity - 数量
*/ */
public void setQuantity(Integer quantity) { public void setQuantity(BigDecimal quantity) {
this.quantity = quantity; this.quantity = quantity;
} }
/** /**
* get the passQuantity - 合格数量. * get the passQuantity - 合格数量.
* @return the passQuantity * @return the passQuantity
*/ */
public Integer getPassQuantity() { public BigDecimal getPassQuantity() {
return this.passQuantity; return this.passQuantity;
} }
...@@ -842,14 +851,14 @@ public class HGZL002 extends DaoEPBase { ...@@ -842,14 +851,14 @@ public class HGZL002 extends DaoEPBase {
* *
* @param passQuantity - 合格数量 * @param passQuantity - 合格数量
*/ */
public void setPassQuantity(Integer passQuantity) { public void setPassQuantity(BigDecimal passQuantity) {
this.passQuantity = passQuantity; this.passQuantity = passQuantity;
} }
/** /**
* get the unpassQuantity - 不合格数量. * get the unpassQuantity - 不合格数量.
* @return the unpassQuantity * @return the unpassQuantity
*/ */
public Integer getUnpassQuantity() { public BigDecimal getUnpassQuantity() {
return this.unpassQuantity; return this.unpassQuantity;
} }
...@@ -858,7 +867,7 @@ public class HGZL002 extends DaoEPBase { ...@@ -858,7 +867,7 @@ public class HGZL002 extends DaoEPBase {
* *
* @param unpassQuantity - 不合格数量 * @param unpassQuantity - 不合格数量
*/ */
public void setUnpassQuantity(Integer unpassQuantity) { public void setUnpassQuantity(BigDecimal unpassQuantity) {
this.unpassQuantity = unpassQuantity; this.unpassQuantity = unpassQuantity;
} }
/** /**
...@@ -1105,9 +1114,9 @@ public class HGZL002 extends DaoEPBase { ...@@ -1105,9 +1114,9 @@ public class HGZL002 extends DaoEPBase {
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName)); setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName));
setWorkBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_work_by)), workBy)); setWorkBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_work_by)), workBy));
setWorkName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_work_name)), workName)); setWorkName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_work_name)), workName));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity)); setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_quantity)), quantity));
setPassQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_pass_quantity)), passQuantity)); setPassQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_pass_quantity)), passQuantity));
setUnpassQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unpass_quantity)), unpassQuantity)); setUnpassQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_unpass_quantity)), unpassQuantity));
setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight)); setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight));
setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight)); setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight));
setCheckBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_check_by)), checkBy)); setCheckBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_check_by)), checkBy));
......
...@@ -16,6 +16,7 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -16,6 +16,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -112,13 +113,16 @@ public class ServiceHGZL002 extends ServiceBase { ...@@ -112,13 +113,16 @@ public class ServiceHGZL002 extends ServiceBase {
resultMap.put("unpassQuantity",0); resultMap.put("unpassQuantity",0);
try { try {
inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002()); inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002());
List<HGZL002> hgzl002s = MapUtils.toDaoEPBases(inInfo,HGZL002.class); List<HGZL002> hgzl002s = MapUtils.toDaoEPBases(inInfo, HGZL002.class);
int quantity = Optional.ofNullable(hgzl002s).orElse(new ArrayList<>()).stream().mapToInt(HGZL002::getQuantity).sum(); BigDecimal quantity = Optional.ofNullable(hgzl002s).orElse(new ArrayList<>()).stream()
int passQuantity = Optional.ofNullable(hgzl002s).orElse(new ArrayList<>()).stream().mapToInt(HGZL002::getPassQuantity).sum(); .map(HGZL002::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
int unpassQuantity = Optional.ofNullable(hgzl002s).orElse(new ArrayList<>()).stream().mapToInt(HGZL002::getUnpassQuantity).sum(); BigDecimal passQuantity = Optional.ofNullable(hgzl002s).orElse(new ArrayList<>()).stream()
resultMap.put("quantity",quantity); .map(HGZL002::getPassQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
resultMap.put("passQuantity",passQuantity); BigDecimal unpassQuantity = Optional.ofNullable(hgzl002s).orElse(new ArrayList<>()).stream()
resultMap.put("unpassQuantity",unpassQuantity); .map(HGZL002::getUnpassQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
resultMap.put("quantity", quantity);
resultMap.put("passQuantity", passQuantity);
resultMap.put("unpassQuantity", unpassQuantity);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -16,6 +16,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator; ...@@ -16,6 +16,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -209,10 +210,10 @@ public class HGZLTools { ...@@ -209,10 +210,10 @@ public class HGZLTools {
queryMap.put(HGZL004.FIELD_id, id); queryMap.put(HGZL004.FIELD_id, id);
DaoBase.getInstance().update(HGSqlConstant.HGZL004.LOCK, queryMap); DaoBase.getInstance().update(HGSqlConstant.HGZL004.LOCK, queryMap);
} }
public static void addByHGZL002(HGZL002 hgzl002) { public static void addByHGZL002(HGZL002 hgzl002) {
List<HGZL004> hgzl004DbList = listByCheckId(hgzl002.getId(),CheckTypeEnum.PROCESS_CHECK.getCode()); List<HGZL004> hgzl004DbList = listByCheckId(hgzl002.getId(), CheckTypeEnum.PROCESS_CHECK.getCode());
if(hgzl002.getUnpassQuantity()>0&&CollectionUtils.isEmpty(hgzl004DbList)) { if (hgzl002.getUnpassQuantity().compareTo(BigDecimal.ZERO) == 1 && CollectionUtils.isEmpty(hgzl004DbList)) {
HGZL004 hgzl004 = new HGZL004(); HGZL004 hgzl004 = new HGZL004();
BeanUtils.copyProperties(hgzl002, hgzl004); BeanUtils.copyProperties(hgzl002, hgzl004);
cleanBaseInfo(hgzl004); cleanBaseInfo(hgzl004);
...@@ -306,4 +307,4 @@ public class HGZLTools { ...@@ -306,4 +307,4 @@ public class HGZLTools {
} }
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/> <EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
......
$(function () { $(function () {
$("#result-0-quantity_textField").on('change',function () { $("#result-0-quantity").on('change', function () {
var quantity = $("#result-0-quantity_textField").val(); var quantity = $("#result-0-quantity").val();
if(!isPositiveInteger(quantity)){ if (!isPositiveNumber(quantity)) {
message("报工数量必须是大于0的正整数") message("报工数量必须是大于0的数字")
} }
var singleWeight = $("#result-0-singleWeight_textField").val(); var singleWeight = $("#result-0-singleWeight_textField").val();
if(isPositiveNumber(singleWeight)) { if (isPositiveNumber(singleWeight)) {
$("#result-0-totalWeight_textField").val((parseInt(singleWeight*quantity*100)/100).toFixed(2)); $("#result-0-totalWeight_textField").val(
} (parseInt(singleWeight * quantity * 100) / 100).toFixed(2));
}) }
})
...@@ -25,9 +26,9 @@ $(function () { ...@@ -25,9 +26,9 @@ $(function () {
* 保存* * 保存*
*/ */
$("#btn_save").on("click",function(){ $("#btn_save").on("click",function(){
var quantity = $("#result-0-quantity_textField").val(); var quantity = $("#result-0-quantity").val();
if(!isPositiveInteger(quantity)){ if(!isPositiveNumber(quantity)){
message("报工数量必须是大于0的正整数"); message("报工数量必须是大于0的数字");
return ; return ;
} }
var registerDate = $("#result-0-registerDate").val(); var registerDate = $("#result-0-registerDate").val();
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<EF:EFInput ename="result-0-groupName" cname="班组" colWidth="4" required="true" readonly="true"/> <EF:EFInput ename="result-0-groupName" cname="班组" colWidth="4" required="true" readonly="true"/>
<EF:EFDatePicker cname="报工日期" ename="result-0-registerDate" colWidth="4" <EF:EFDatePicker cname="报工日期" ename="result-0-registerDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/> format="yyyy-MM-dd" required="true" readonly="false"/>
<EF:EFInput ename="result-0-quantity" cname="报工数量" format="{0:0}" editType="text" colWidth="4" required="true" /> <EF:EFInput ename="result-0-quantity" cname="报工数量" format="{0:0.0}" colWidth="4" required="true"/>
<EF:EFInput ename="result-0-totalWeight" cname="报工重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/> <EF:EFInput ename="result-0-totalWeight" cname="报工重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-exceedReason" cname="超报原因" type="textarea" editType="text" colWidth="8" ratio="2:10"/> <EF:EFInput ename="result-0-exceedReason" cname="超报原因" type="textarea" editType="text" colWidth="8" ratio="2:10"/>
</div> </div>
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/> <EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="180" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="180" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="projName" cname="项目名称" enable="true" width="120" align="center" readOnly="true"/>
......
...@@ -39,15 +39,16 @@ $(function () { ...@@ -39,15 +39,16 @@ $(function () {
// 判断父级节点是否发生变化 // 判断父级节点是否发生变化
if (e.field == "unpassQuantity") { if (e.field == "unpassQuantity") {
// loadChange(grid,e,"passQuantity"); // loadChange(grid,e,"passQuantity");
var passQuantity = e.items[0]['quantity'] - e.items[0]['unpassQuantity']; var passQuantity = parseFloat(e.items[0]['quantity'])
resultGrid.setCellValue(e.items[0],"passQuantity",passQuantity.toFixed(3)); - parseFloat(e.items[0]['unpassQuantity']);
resultGrid.setCellValue(e.items[0], "passQuantity", passQuantity);
} }
// 判断父级节点是否发生变化 // 判断父级节点是否发生变化
if (e.field == "passQuantity") { if (e.field == "passQuantity") {
// loadChange(grid,e,"unpassQuantity"); // loadChange(grid,e,"unpassQuantity");
var unpassQuantity = e.items[0]['quantity'] - e.items[0]['passQuantity']; var unpassQuantity = parseFloat(e.items[0]['quantity'])
resultGrid.setCellValue(e.items[0],"unpassQuantity",unpassQuantity); - parseFloat(e.items[0]['passQuantity']);
resultGrid.setCellValue(e.items[0], "unpassQuantity", unpassQuantity);
} }
}); });
}, },
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="checkBy" cname="质检员" hidden="true"/> <EF:EFColumn ename="checkBy" cname="质检员" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" width="130" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="companyName" cname="公司名称" width="130" enable="false" readonly="true" align="center"/>
...@@ -37,13 +37,14 @@ ...@@ -37,13 +37,14 @@
<EF:EFColumn ename="productCode" cname="存货编码" width="90" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="productCode" cname="存货编码" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productName" cname="存货名称" width="90" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="productName" cname="存货名称" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="quantity" cname="报工数量" width="90" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="quantity" cname="报工数量" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="passQuantity" cname="合格数量" width="90" align="center" required="true"/> <EF:EFColumn ename="passQuantity" cname="合格数量" format="{0:0.0}" width="90" align="center" required="true"/>
<EF:EFColumn ename="unpassQuantity" cname="不合格数量" width="100" align="center" required="true"/> <EF:EFColumn ename="unpassQuantity" cname="不合格数量" format="{0:0.0}" width="100" align="center"
required="true"/>
<EF:EFColumn ename="checkDate" cname="质检日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="checkDate" cname="质检日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/>
<EF:EFColumn ename="checkName" cname="质检员" width="100" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="checkName" cname="质检员" width="100" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="checkStatus" cname="质检状态" width="80" align="center" enable="false" <EF:EFComboColumn ename="checkStatus" cname="质检状态" width="80" align="center" enable="false"
readonly="true"> readonly="true">
<EF:EFCodeOption codeName="hggp.checkStatus"/> <EF:EFCodeOption codeName="hggp.checkStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
</EF:EFGrid> </EF:EFGrid>
......
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