Commit e913ded6 by 宋祥
parents 673cbc8d 6d4d3df6
......@@ -98,7 +98,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
AFTER_SALE_DATE ASC
</isEmpty>
</dynamic>
</sql>
......
......@@ -25,7 +25,6 @@ import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.ExcelUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.ObjectUtils;
......@@ -42,11 +41,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author LiuYang
......@@ -307,11 +302,7 @@ public class ServiceHGKC005 extends ServiceEPBase {
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "提交")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setMsg(inInfo, e, "提交失败");
}
return inInfo;
}
......@@ -374,6 +365,9 @@ public class ServiceHGKC005 extends ServiceEPBase {
hgkc006.setSource(InventorySource.INVENTORY.getCode());
hgkc006.setSubmitStatus(HGConstant.ProductStatus.WTJ);
hgkc006.setSourceCode(hgkc005.getCheckNo());
AssertUtils.isTrue(Objects.isNull(hgkc006.getSource()) || hgkc006.getSource() <= 0, "其它入库单数据来源不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(hgkc006.getWhCode()), "其它入库单仓库不能为空!");
DaoUtils.insert(HGKC006.INSERT, hgkc006);
//明细数据处理
HGKC006A hgkc006A = new HGKC006A();
hgkc006A.setPrimaryId(hgkc006.getId());
......@@ -396,9 +390,10 @@ public class ServiceHGKC005 extends ServiceEPBase {
hgkc006A.setPrdtSpec(hgpz005.getSpec());
hgkc006A.setSource(InventorySource.INVENTORY.getCode());
hgkc006A.setInventTypeDetail(hgpz005.getInventTypeDetail());
hgkc006.getDetailList().add(hgkc006A);
HGKCTools.HgKc006.generateHgkc006(hgkc006);
HGKCTools.HgKc006.checkData(hgkc006A);
DaoUtils.insert(HGKC006A.INSERT, hgkc006A);
//hgkc006.getDetailList().add(hgkc006A);
//HGKCTools.HgKc006.generateHgkc006(hgkc006);
}
}
......
......@@ -8,17 +8,21 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.Iplat4jTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.domain.HGKC006;
import com.baosight.hggp.hg.kc.domain.HGKC006A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.hg.yx.domain.HGYX001;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ExcelUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -26,9 +30,13 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 其他入库单
......@@ -177,28 +185,22 @@ public class ServiceHGKC006 extends ServiceBase {
hgkc006 = HGKCTools.HgKc006.getById(hgkc006.getId());
//查看是否能获取到账期,获取不到就提示
HGCWTools.HgCw001.getAccountPeriod(hgkc006.getCompanyCode(),hgkc006.getOtherEnterDate());
HGCWTools.HgCw001.getAccountPeriod(hgkc006.getCompanyCode(), hgkc006.getOtherEnterDate());
hgkc006.setSubmitStatus(HGConstant.SubmitStatus.S1);
DaoUtils.update(HGKC006.CHECK, hgkc006.toMap());
}
List<HGKC006A> hgkc006AList = HGKCTools.HgKc006A.getHgkc006aList(hgkc006.getId());
AssertUtils.isEmpty(hgkc006AList, "没有明细信息无法提交");
if(!CollectionUtils.isEmpty(hgkc006AList)){
for(HGKC006A hgkc006A : hgkc006AList){
for (HGKC006A hgkc006A : hgkc006AList) {
//增加库存
HGKCUtils.HgKc010.updateInv(hgkc006A.getCompanyCode(),hgkc006A.getWhCode(),
hgkc006A.getInventCode(),hgkc006A.getInvQty(),
hgkc006A.getInvUnitWeight(),hgkc006A.getInvWeight());
}
HGKCUtils.HgKc010.updateInv(hgkc006A.getCompanyCode(), hgkc006A.getWhCode(),
hgkc006A.getInventCode(), hgkc006A.getInvQty(),
hgkc006A.getInvUnitWeight(), hgkc006A.getInvWeight());
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("提交成功!");
} catch (PlatException e) {
//eiInfo.setStatus(EiConstant.STATUS_FAILURE);
//eiInfo.setMsg("提交失败,原因参见详细错误描述!");
//eiInfo.setDetailMsg(e.getMessage());
LogUtils.setDetailMsg(eiInfo, e, "提交失败");
//logError("提交失败!", e.getMessage());
return eiInfo;
}
return eiInfo;
}
......
......@@ -268,7 +268,7 @@
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC013A (ID, <!-- ID -->
INSERT INTO ${hggpSchema}.HGKC013A (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
......@@ -296,7 +296,7 @@
PARENT_ID, <!-- 调度单ID -->
INVENT_TYPE_DETAIL
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
VALUES (#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #calloutWhCode#, #calloutWhName#, #callinWhCode#, #callinWhName#, #inventRecordId#,
#inventType#, #inventCode#, #inventName#, #spec#, #length#, #width#, #thick#, #quantity#, #unitWeight#,
#weight#, #parentId#,#inventTypeDetail#)
......
......@@ -818,23 +818,37 @@ public class HGKCTools {
public static void generateHgkc006(HGKC006 hgkc006) {
checkData(hgkc006);
DaoUtils.insert(HGKC006.INSERT, hgkc006);
checkDetailData(hgkc006);
DaoUtils.insertBatch(HGKC006A.INSERT, hgkc006.getDetailList());
}
private static void checkData(HGKC006 hgkc006) {
AssertUtils.isEmpty(hgkc006.getDetailList(), "其它入库单明细不能为空");
AssertUtils.isTrue(Objects.isNull(hgkc006.getId()) || hgkc006.getId() <= 0, "其它入库单ID不能为空!");
AssertUtils.isTrue(Objects.isNull(hgkc006.getSource()) || hgkc006.getSource() <= 0, "其它入库单数据来源不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(hgkc006.getWhCode()), "其它入库单仓库不能为空!");
}
private static void checkDetailData(HGKC006 hgkc006) {
AssertUtils.isTrue(Objects.isNull(hgkc006.getId()) || hgkc006.getId() <= 0, "其它入库单ID不能为空!");
hgkc006.getDetailList().forEach(o -> {
o.setPrimaryId(hgkc006.getId());
AssertUtils.isTrue(StringUtils.isBlank(o.getWhCode()), "其它入库单明细仓库不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(o.getInventCode()), "其它入库单明细存货编码不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(o.getInventName()), "其它入库单明细存货名称不能为空!");
AssertUtils.isTrue(o.getInvQty().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细数量不能小于等于0!");
AssertUtils.isTrue(o.getInvUnitWeight().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细单重小于等于0!");
AssertUtils.isTrue(o.getInvWeight().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细总重小于等于0!");
// AssertUtils.isTrue(o.getInvUnitWeight().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细单重小于等于0!");
// AssertUtils.isTrue(o.getInvWeight().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细总重小于等于0!");
});
}
public static void checkData(HGKC006A hgkc006a) {
AssertUtils.isTrue(StringUtils.isBlank(hgkc006a.getWhCode()), "其它入库单明细仓库不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(hgkc006a.getInventCode()), "其它入库单明细存货编码不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(hgkc006a.getInventName()), "其它入库单明细存货名称不能为空!");
AssertUtils.isTrue(hgkc006a.getInvQty().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细数量不能小于等于0!");
AssertUtils.isTrue(hgkc006a.getInvUnitWeight().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细单重小于等于0!");
AssertUtils.isTrue(hgkc006a.getInvWeight().compareTo(BigDecimal.ZERO) <= 0, "其它入库单明细总重小于等于0!");
}
}
public static class HgKc006A {
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.SbOpenApi;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.sb.domain.HGSB010;
import com.baosight.hggp.hg.xs.domain.User;
......@@ -213,4 +214,16 @@ public class ServiceHGSB010 extends ServiceEPBase {
}
return inInfo;
}
@Override
public EiInfo insert(EiInfo inInfo) {
List<HGSB010> resultRows = MapUtils.toDaoEPBases(inInfo, HGSB010.class);
for (HGSB010 hgsb010: resultRows) {
hgsb010.setEquipmentType("STARUS_TYPE");
hgsb010.setCompanyCode(UserSessionUtils.getAccountCode());
DaoUtils.insert(HGSB010.INSERT, hgsb010);
}
return inInfo;
}
}
......@@ -185,9 +185,11 @@
</isNotEmpty>
left join (
select EQUIPMENT_CODE, LOG_VALUE
from ${hggpSchema}.HGSB010 where EQUIPMENT_TYPE = 'STARUS_TYPE'
and CREATED_TIME =(
select MAX(CREATED_TIME) from ${hggpSchema}.HGSB010
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
and (EQUIPMENT_CODE,CREATED_TIME) IN (
select EQUIPMENT_CODE, MAX(CREATED_TIME)
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
......@@ -195,6 +197,7 @@
<isNotEmpty prepend=" AND " property="date">
left(CREATED_TIME,8) = #date#
</isNotEmpty>
group by EQUIPMENT_CODE
)
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
......
......@@ -163,7 +163,7 @@ public class HGSC004A extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer inventSource; /* 物料来源 1加工 2外购*/
private Integer inventSource = 0; /* 物料来源 1加工 2外购*/
@ExcelAnno(index = 4)
private String material = " "; /* 材质*/
@ExcelAnno(index = 11)
......
......@@ -192,7 +192,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
check_date asc
</isEmpty>
</dynamic>
......
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