Commit 3125b7e4 by yukang

Merge remote-tracking branch 'origin/dev' into dev

parents 82e42e9e e5e8cbd4
package com.baosight.hggp.common;
import com.baosight.iplat4j.core.ei.EiBlock;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/5/21
*/
public enum ComputeTypeEnum {
CD(1,"长度"),
SL(2,"数量");
private Integer code;
private String value;
ComputeTypeEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static EiBlock generatorEiBlock() {
EiBlock block = new EiBlock("compute_type_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, CD.code + "-" + CD.value);
put(HGConstants.VALUE_FIELD, CD.code);
}});
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, SL.code + "-" + SL.value);
put(HGConstants.VALUE_FIELD, SL.code);
}});
}};
block.setRows(rows);
return block;
}
public static ComputeTypeEnum getEnumByCode(Integer code){
for (ComputeTypeEnum en : ComputeTypeEnum.values()){
if(code.compareTo(en.code)==0){
return en;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.baosight.hggp.hg.sc.tools;
import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
......@@ -393,14 +394,20 @@ public class HGSCTools {
if(StringUtils.equals(product.getInventCode(),planInfo.getProductCode())){
//额定工时
BigDecimal timing = sj.getStandardJob().multiply(sj.getStandardDays()).divide(sj.getStandardNum());
if(StringUtils.equals(sj.getUnit(),"米")) {
workHour.set(product.getLength().multiply(new BigDecimal(planInfo.getQuantity())).multiply(unitConver).multiply(composingCoeff)
.divide(timing)
.multiply(baseWorkHour).add(finalRemainder));
}else{
workHour.set(new BigDecimal(planInfo.getQuantity()).multiply(composingCoeff)
.divide(timing)
.multiply(baseWorkHour).add(finalRemainder));
ComputeTypeEnum computeType = ComputeTypeEnum.getEnumByCode(sj.getComputeType());
switch (computeType){
case CD:
workHour.set(product.getLength().multiply(new BigDecimal(planInfo.getQuantity())).multiply(unitConver).multiply(composingCoeff)
.divide(timing)
.multiply(baseWorkHour).add(finalRemainder));
break;
case SL:
workHour.set(new BigDecimal(planInfo.getQuantity()).multiply(composingCoeff)
.divide(timing)
.multiply(baseWorkHour).add(finalRemainder));
break;
default:
break;
}
}
});
......
......@@ -48,13 +48,13 @@ public class ServiceHGSJ001 extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSJ001 hpsc012 = new HGSJ001();
HGSJ001 hgsj001 = new HGSJ001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc012.fromMap(map);
hpsc012.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ001.DELETE_FLAG, hpsc012.toMap());
hgsj001.fromMap(map);
hgsj001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ001.DELETE_FLAG, hgsj001.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
......@@ -97,17 +97,17 @@ public class ServiceHGSJ001 extends ServiceEPBase {
/**
* 新增操作
*/
public void add(HGSJ001 hpsc012) {
public void add(HGSJ001 hgsj001) {
//生成工序编码
hpsc012.setProcessCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROCESS_CODE));
DaoUtils.insert(HGSJ001.INSERT, hpsc012);
hgsj001.setProcessCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROCESS_CODE));
DaoUtils.insert(HGSJ001.INSERT, hgsj001);
}
/**
* 修改操作
*/
public void modify(HGSJ001 hpsc012) {
DaoUtils.update(HGSJ001.UPDATE, hpsc012);
public void modify(HGSJ001 hgsj001) {
DaoUtils.update(HGSJ001.UPDATE,hgsj001);
}
public EiInfo updateStatus(EiInfo inInfo){
......
......@@ -41,7 +41,7 @@ public class ServiceHGSJ002 extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
return super.query(inInfo, HGSJ002.QUERY);
return super.query(inInfo, HGSJ002.QUERY,new HGSJ002());
}
@OperationLogAnnotation(operModul = "工艺流程",operType = "删除",operDesc = "删除操作")
......@@ -49,13 +49,13 @@ public class ServiceHGSJ002 extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSJ002 hpsc013 = new HGSJ002();
HGSJ002 hgsj002 = new HGSJ002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc013.fromMap(map);
hpsc013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ002.DELETE_FLAG, hpsc013);
hgsj002.fromMap(map);
hgsj002.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ002.DELETE_FLAG, hgsj002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
......@@ -77,13 +77,13 @@ public class ServiceHGSJ002 extends ServiceEPBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGSJ002 hpsc013 = new HGSJ002();
hpsc013.fromMap(resultRows.get(i));
if (hpsc013.getId() == null || hpsc013.getId() == 0) {
this.add(hpsc013);
for (Map resultRow : resultRows) {
HGSJ002 hgsj002 = new HGSJ002();
hgsj002.fromMap(resultRow);
if (hgsj002.getId() == null || hgsj002.getId() == 0) {
this.add(hgsj002);
} else {
this.modify(hpsc013);
this.modify(hgsj002);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -97,17 +97,17 @@ public class ServiceHGSJ002 extends ServiceEPBase {
/**
* 新增操作
*/
public void add(HGSJ002 hpsc013) {
public void add(HGSJ002 hgsj002) {
//生成流程编码
hpsc013.setFlowCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.FLOW_CODE));
DaoUtils.insert(HGSJ002.INSERT, hpsc013);
hgsj002.setFlowCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.FLOW_CODE));
DaoUtils.insert(HGSJ002.INSERT, hgsj002);
}
/**
* 修改操作
*/
public void modify(HGSJ002 hpsc013) {
DaoUtils.update(HGSJ002.UPDATE, hpsc013);
public void modify(HGSJ002 hgsj002) {
DaoUtils.update(HGSJ002.UPDATE, hgsj002);
}
/**
......@@ -117,12 +117,12 @@ public class ServiceHGSJ002 extends ServiceEPBase {
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGSJ002 hpsc013 = new HGSJ002();
HGSJ002 hgsj002 = new HGSJ002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc013.fromMap(map);
DaoUtils.update(HGSJ002.UPDATE_STATUS, hpsc013);
hgsj002.fromMap(map);
DaoUtils.update(HGSJ002.UPDATE_STATUS, hgsj002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
......
......@@ -50,13 +50,13 @@ public class ServiceHGSJ002A extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSJ002A hpsc013a = new HGSJ002A();
HGSJ002A hgsj002a = new HGSJ002A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc013a.fromMap(map);
hpsc013a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ002A.DELETE_FLAG, hpsc013a);
hgsj002a.fromMap(map);
hgsj002a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSJ002A.DELETE_FLAG, hgsj002a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
......@@ -83,16 +83,16 @@ public class ServiceHGSJ002A extends ServiceEPBase {
String flowName = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSJ002A.FIELD_FLOW_NAME);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGSJ002A hpsc013a = new HGSJ002A();
hpsc013a.fromMap(resultRows.get(i));
if (hpsc013a.getId() == null || hpsc013a.getId() == 0) {
hpsc013a.setParendId(parendId);
hpsc013a.setFactoryCode(factoryCode);
hpsc013a.setFlowCode(flowCode);
hpsc013a.setFlowName(flowName);
this.add(hpsc013a);
HGSJ002A hgsj002a = new HGSJ002A();
hgsj002a.fromMap(resultRows.get(i));
if (hgsj002a.getId() == null || hgsj002a.getId() == 0) {
hgsj002a.setParendId(parendId);
hgsj002a.setFactoryCode(factoryCode);
hgsj002a.setFlowCode(flowCode);
hgsj002a.setFlowName(flowName);
this.add(hgsj002a);
} else {
this.modify(hpsc013a);
this.modify(hgsj002a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -106,14 +106,14 @@ public class ServiceHGSJ002A extends ServiceEPBase {
/**
* 新增操作
*/
public void add(HGSJ002A hpsc013a) {
DaoUtils.insert(HGSJ002A.INSERT, hpsc013a);
public void add(HGSJ002A hgsj002a) {
DaoUtils.insert(HGSJ002A.INSERT, hgsj002a);
}
/**
* 修改操作
*/
public void modify(HGSJ002A hpsc013a) {
DaoUtils.update(HGSJ002A.UPDATE, hpsc013a);
public void modify(HGSJ002A hgsj002a) {
DaoUtils.update(HGSJ002A.UPDATE, hgsj002a);
}
}
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