对接吉客云代码
This commit is contained in:
parent
31f9aa0f3d
commit
f7abab248c
|
@ -195,8 +195,9 @@
|
||||||
|
|
||||||
<select id="entity_list_base_all" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity">
|
<select id="entity_list_base_all" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity">
|
||||||
select
|
select
|
||||||
|
top 100
|
||||||
*
|
*
|
||||||
from jeck_goodsdocin where state is null
|
from jeck_goodsdocin where state is null and inouttype = '105'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -198,6 +199,10 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
|
||||||
JSONObject jsonObject = bdingParm(goodsdocInEntity,goodsdocInDetailEntityList);
|
JSONObject jsonObject = bdingParm(goodsdocInEntity,goodsdocInDetailEntityList);
|
||||||
//调用U8接口生成退货单
|
//调用U8接口生成退货单
|
||||||
U8ResultEntity u8ResultEntity = deliveryOrderService.addDeliveryT(jsonObject);
|
U8ResultEntity u8ResultEntity = deliveryOrderService.addDeliveryT(jsonObject);
|
||||||
|
// U8ResultEntity u8ResultEntity = new U8ResultEntity();
|
||||||
|
// if(1==1){
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
String state = "";
|
String state = "";
|
||||||
if(!u8ResultEntity.issuccess()){
|
if(!u8ResultEntity.issuccess()){
|
||||||
goodsdocInEntity.setState("N");
|
goodsdocInEntity.setState("N");
|
||||||
|
@ -228,31 +233,35 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
|
||||||
|
|
||||||
private JSONObject bdingParmOut(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList) {
|
private JSONObject bdingParmOut(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("AccId", "201");
|
jsonObject.put("AccId", "005");
|
||||||
jsonObject.put("billid", "123");
|
jsonObject.put("billid", "123");
|
||||||
JSONObject head = new JSONObject();
|
JSONObject head = new JSONObject();
|
||||||
head.put("cbuscode", goodsdocInEntity.getU8BillCode());//发货单号
|
head.put("cbuscode", goodsdocInEntity.getU8BillCode());//发货单号
|
||||||
head.put("cdepcode", "00702");//todo 部门编码
|
head.put("cdepcode", "00702");//todo 部门编码
|
||||||
head.put("cmaker", "吉客云入库单自动生成");//创建人
|
head.put("cmaker", "吉客云入库单自动生成");//创建人
|
||||||
|
head.put("cbustype", "普通销售");//创建人
|
||||||
head.put("crdcode", "203");//入库类别编码
|
head.put("crdcode", "203");//入库类别编码
|
||||||
head.put("cwhcode", "01001");//仓库编码 todo 正式需要切换为04009
|
head.put("cwhcode", "04009");//仓库编码 todo 正式需要切换为04009
|
||||||
head.put("ddate", "2024-12-31");//销售类型
|
head.put("ddate", DateUtil.format(new Date(),"yyyy-MM-dd"));//销售类型
|
||||||
// head.put("ccuscode", "99999994");//todo 正式需要切换未这个客户
|
head.put("ccuscode", "99999994");//todo 正式需要切换未这个客户
|
||||||
head.put("ccuscode", "01010918");//客户
|
head.put("cDefine1", "多组织-红字采购入库");//
|
||||||
|
// head.put("ccuscode", "01010918");//客户
|
||||||
|
head.put("csource","发货单");
|
||||||
jsonObject.put("head",head);
|
jsonObject.put("head",head);
|
||||||
JSONArray body = new JSONArray();
|
JSONArray body = new JSONArray();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if(CollectionUtils.isNotEmpty(goodsdocInDetailEntityList)){
|
if(CollectionUtils.isNotEmpty(goodsdocInDetailEntityList)){
|
||||||
for(GoodsdocInDetailEntity item : goodsdocInDetailEntityList){
|
for(GoodsdocInDetailEntity item : goodsdocInDetailEntityList){
|
||||||
i++;
|
i++;
|
||||||
if("501010323".equals(item.getGoodsNo())){
|
// if("501010323".equals(item.getGoodsNo())){
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
JSONObject details = new JSONObject();
|
JSONObject details = new JSONObject();
|
||||||
details.put("cbdlcode",goodsdocInEntity.getU8BillCode());//发货单号
|
details.put("cbdlcode",goodsdocInEntity.getU8BillCode());//发货单号
|
||||||
details.put("cdblrowno", i);//行号
|
details.put("cdblrowno", i);//行号
|
||||||
details.put("cinvcode", item.getGoodsNo());//存货编码
|
details.put("cinvcode", item.getGoodsNo());//存货编码
|
||||||
details.put("iquantity", item.getQuantity());//数量
|
details.put("iquantity",new BigDecimal(item.getQuantity()).subtract(new BigDecimal(item.getQuantity()).add(new BigDecimal(item.getQuantity()))));
|
||||||
|
// details.put("iquantity", item.getQuantity());//数量
|
||||||
body.add(details);
|
body.add(details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +271,7 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
|
||||||
|
|
||||||
private JSONObject bdingParm(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList) {
|
private JSONObject bdingParm(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("AccId", "201");
|
jsonObject.put("AccId", "005");
|
||||||
jsonObject.put("billid", "123");
|
jsonObject.put("billid", "123");
|
||||||
JSONObject head = new JSONObject();
|
JSONObject head = new JSONObject();
|
||||||
head.put("brdflag", "1");//发货0,退货1
|
head.put("brdflag", "1");//发货0,退货1
|
||||||
|
@ -270,16 +279,17 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
|
||||||
head.put("cbustype", "普通销售");//
|
head.put("cbustype", "普通销售");//
|
||||||
head.put("cdepcode", "00702");//销售部门
|
head.put("cdepcode", "00702");//销售部门
|
||||||
head.put("cmaker", "吉客云入库单自动生成");//创建人
|
head.put("cmaker", "吉客云入库单自动生成");//创建人
|
||||||
// head.put("ccuscode", "99999994");//todo 正式需要切换未这个客户
|
head.put("cDefine1", "多组织-红字采购入库");//
|
||||||
head.put("ccuscode", "01010918");//客户
|
head.put("ccuscode", "99999994");//todo 正式需要切换未这个客户
|
||||||
|
// head.put("ccuscode", "01010918");//客户
|
||||||
head.put("cstcode", "11");//销售类型
|
head.put("cstcode", "11");//销售类型
|
||||||
head.put("ddate", "2024-12-31");//销售类型
|
head.put("ddate", DateUtil.format(new Date(),"yyyy-MM-dd"));//创建时间
|
||||||
jsonObject.put("head",head);
|
jsonObject.put("head",head);
|
||||||
JSONArray body = new JSONArray();
|
JSONArray body = new JSONArray();
|
||||||
if(CollectionUtils.isNotEmpty(goodsdocInDetailEntityList)){
|
if(CollectionUtils.isNotEmpty(goodsdocInDetailEntityList)){
|
||||||
goodsdocInDetailEntityList.forEach(item -> {
|
goodsdocInDetailEntityList.forEach(item -> {
|
||||||
JSONObject details = new JSONObject();
|
JSONObject details = new JSONObject();
|
||||||
details.put("cwhcode","01001");//todo 正式需要切换为04009
|
details.put("cwhcode","04009");//todo 正式需要切换为04009
|
||||||
details.put("cinvcode",item.getGoodsNo());
|
details.put("cinvcode",item.getGoodsNo());
|
||||||
//计量单位编码需要按照名称去U8查询
|
//计量单位编码需要按照名称去U8查询
|
||||||
String unitName = item.getUnitName();
|
String unitName = item.getUnitName();
|
||||||
|
@ -288,7 +298,7 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
|
||||||
}
|
}
|
||||||
//todo idiscount原币折扣金额没有 看看是否需要调整代码
|
//todo idiscount原币折扣金额没有 看看是否需要调整代码
|
||||||
details.put("isum",item.getTransHasTaxAmount());
|
details.put("isum",item.getTransHasTaxAmount());
|
||||||
details.put("iquantity",item.getQuantity());
|
details.put("iquantity",new BigDecimal(item.getQuantity()).subtract(new BigDecimal(item.getQuantity()).add(new BigDecimal(item.getQuantity()))));
|
||||||
details.put("itaxrate",item.getTaxRate());
|
details.put("itaxrate",item.getTaxRate());
|
||||||
body.add(details);
|
body.add(details);
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -505,12 +506,12 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public U8ResultEntity addDeliveryT(JSONObject parm) {
|
public U8ResultEntity addDeliveryT(JSONObject jsonObject) {
|
||||||
String billCode = "";
|
String billCode = "";
|
||||||
String dlId = "";
|
String dlId = "";
|
||||||
String AccId = "";
|
String AccId = "";
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = parm.getJSONObject("jsonStr");
|
// JSONObject jsonObject = parm.getJSONObject("jsonStr");
|
||||||
logger.info("接收到的参数"+jsonObject.toString());
|
logger.info("接收到的参数"+jsonObject.toString());
|
||||||
StringBuffer resultStr = new StringBuffer();//回传json
|
StringBuffer resultStr = new StringBuffer();//回传json
|
||||||
String billid = jsonObject.getString("billid");
|
String billid = jsonObject.getString("billid");
|
||||||
|
@ -519,9 +520,11 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
}
|
}
|
||||||
AccId = jsonObject.getString("AccId");
|
AccId = jsonObject.getString("AccId");
|
||||||
String cmemo = jsonObject.getString("cmemo");
|
String cmemo = jsonObject.getString("cmemo");
|
||||||
|
if(StrUtil.isNotEmpty(cmemo)){
|
||||||
if(cmemo.length()>255){
|
if(cmemo.length()>255){
|
||||||
jsonObject.put("cmemo", cmemo.substring(0,254));
|
jsonObject.put("cmemo", cmemo.substring(0,254));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(StrUtil.isEmpty(AccId)){
|
if(StrUtil.isEmpty(AccId)){
|
||||||
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
|
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
|
||||||
}
|
}
|
||||||
|
@ -623,7 +626,9 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
//todo 发货单表体
|
//todo 发货单表体
|
||||||
JSONArray body = new JSONArray();
|
JSONArray body = new JSONArray();
|
||||||
JSONArray jBody = jsonObject.getJSONArray("body");
|
JSONArray jBody = jsonObject.getJSONArray("body");
|
||||||
|
int t=0;
|
||||||
for (int i = 0; i < jBody.size(); i++) {
|
for (int i = 0; i < jBody.size(); i++) {
|
||||||
|
System.out.println("错误的位置"+t++);
|
||||||
JSONObject jBodyObj = jBody.getJSONObject(i);
|
JSONObject jBodyObj = jBody.getJSONObject(i);
|
||||||
//验证数据,如果为空则返回报错信息
|
//验证数据,如果为空则返回报错信息
|
||||||
String[] MustInputCodes = new String[] { "iquantity", "cinvcode","inum" };
|
String[] MustInputCodes = new String[] { "iquantity", "cinvcode","inum" };
|
||||||
|
@ -635,13 +640,18 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取计量单位组信息
|
//获取计量单位组信息
|
||||||
String sqlUnit = "select b.cInvCName,a.* from "+AccCode+".dbo.Inventory a left join "+AccCode+".dbo.InventoryClass b on b.cInvCCode = a.cInvCCode " +
|
String sqlUnit = "select b.cInvCName,c.ichangrate,a.* " +
|
||||||
"where cInvCode='"+jBodyObj.getString("cinvcode")+"'";
|
"from "+AccCode+".dbo.Inventory a " +
|
||||||
|
"left join "+AccCode+".dbo.InventoryClass b on b.cInvCCode = a.cInvCCode " +
|
||||||
|
"left join " +AccCode+".dbo.tc_unit c on a.cSAComUnitCode = c.unit_id "+
|
||||||
|
" where cInvCode='"+jBodyObj.getString("cinvcode")+"'";
|
||||||
SaleInvEntity U8Body = new SaleInvEntity();
|
SaleInvEntity U8Body = new SaleInvEntity();
|
||||||
U8Body.setDataSourceCode("YONYOUU8NEW");
|
U8Body.setDataSourceCode("YONYOUU8NEW");
|
||||||
List<HashMap<String, Object>> U8BodyHashMaps = saleInvDao.getU8BillData(sqlUnit,U8Body);
|
List<HashMap<String, Object>> U8BodyHashMaps = saleInvDao.getU8BillData(sqlUnit,U8Body);
|
||||||
if(CollectionUtils.isEmpty(U8BodyHashMaps)){
|
if(CollectionUtils.isEmpty(U8BodyHashMaps) && U8BodyHashMaps.size()==0){
|
||||||
resultStr.append("存货编码不存在[" + jBodyObj.getString("cinvcode")+ "],行:"+i + 1+"" );
|
continue;
|
||||||
|
// todo 匹配不上的自行跳过,等待对照表
|
||||||
|
// resultStr.append("存货编码不存在[" + jBodyObj.getString("cinvcode")+ "],行:"+i + 1+"" );
|
||||||
}
|
}
|
||||||
//存货信息
|
//存货信息
|
||||||
HashMap<String, Object> inv= U8BodyHashMaps.get(0);
|
HashMap<String, Object> inv= U8BodyHashMaps.get(0);
|
||||||
|
@ -649,8 +659,13 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
jBodyObj.put("cgroupcode",inv.get("cGroupCode"));
|
jBodyObj.put("cgroupcode",inv.get("cGroupCode"));
|
||||||
jBodyObj.put("igrouptype",inv.get("iGroupType"));
|
jBodyObj.put("igrouptype",inv.get("iGroupType"));
|
||||||
jBodyObj.put("ccomunitcode",inv.get("cComUnitCode"));
|
jBodyObj.put("ccomunitcode",inv.get("cComUnitCode"));
|
||||||
|
jBodyObj.put("cunitid",inv.get("cComUnitCode"));//计量单位默认
|
||||||
//默认项 在第三方调用不传输数据情况下 则默认以下数据
|
//默认项 在第三方调用不传输数据情况下 则默认以下数据
|
||||||
|
System.out.println("当前换算率"+inv.get("ichangrate"));
|
||||||
|
if(null != inv.get("ichangrate")){
|
||||||
|
//辅助计量数量
|
||||||
|
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(inv.get("ichangrate"))),6, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
// 买赠类型
|
// 买赠类型
|
||||||
String cdefine22 = jBodyObj.getString("cdefine22");
|
String cdefine22 = jBodyObj.getString("cdefine22");
|
||||||
if(StrUtil.isEmpty(cdefine22)){
|
if(StrUtil.isEmpty(cdefine22)){
|
||||||
|
@ -706,23 +721,25 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
//原币折扣金额
|
//原币折扣金额
|
||||||
BigDecimal idiscount = StrUtil.isNotEmpty(jBodyObj.getString("idiscount")) ? jBodyObj.getBigDecimal("idiscount") : new BigDecimal(0);
|
BigDecimal idiscount = StrUtil.isNotEmpty(jBodyObj.getString("idiscount")) ? jBodyObj.getBigDecimal("idiscount") : new BigDecimal(0);
|
||||||
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");//数量
|
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");//数量
|
||||||
BigDecimal isum = jBodyObj.getBigDecimal("isum");//价税合计
|
// BigDecimal isum = jBodyObj.getBigDecimal("isum");//价税合计
|
||||||
|
BigDecimal isum = new BigDecimal(0);//价税合计
|
||||||
BigDecimal itaxrate_b = jBodyObj.getBigDecimal("itaxrate");//税率
|
BigDecimal itaxrate_b = jBodyObj.getBigDecimal("itaxrate");//税率
|
||||||
BigDecimal nflat = jHead.getBigDecimal("iexchrate");//汇率
|
BigDecimal nflat = jHead.getBigDecimal("iexchrate");//汇率
|
||||||
BigDecimal iTaxUnitPrice = isum.divide(iquantity,6); //原币含税单价
|
// BigDecimal iTaxUnitPrice = isum.divide(iquantity,6); //原币含税单价
|
||||||
|
BigDecimal iTaxUnitPrice = new BigDecimal(0); //原币含税单价
|
||||||
JSONObject ae = new JSONObject();
|
JSONObject ae = new JSONObject();
|
||||||
//工具类编写金额信息进行计算
|
//工具类编写金额信息进行计算
|
||||||
U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 6);
|
// U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 6);
|
||||||
jBodyObj.put("iquotedprice",ae.getString("TaxPrice")) ;
|
jBodyObj.put("iquotedprice",0) ;
|
||||||
jBodyObj.put("itaxunitprice",ae.getString("TaxPrice")) ;//原币含税单价
|
jBodyObj.put("itaxunitprice",0) ;//原币含税单价
|
||||||
jBodyObj.put("isum",ae.getString("Sum"));//价税合计
|
jBodyObj.put("isum",0);//价税合计
|
||||||
jBodyObj.put("iunitprice",ae.getString("UnitPrice")) ;//原币不含税单价
|
jBodyObj.put("iunitprice",0) ;//原币不含税单价
|
||||||
jBodyObj.put("imoney",ae.getString("Money"));//原货不含税金额
|
jBodyObj.put("imoney",0);//原货不含税金额
|
||||||
jBodyObj.put("itax",ae.getString("Tax"));//原币税额
|
jBodyObj.put("itax",0);//原币税额
|
||||||
jBodyObj.put("inatunitprice",ae.getString("NatUnitPrice"));//本币含税单价
|
jBodyObj.put("inatunitprice",0);//本币含税单价
|
||||||
jBodyObj.put("inatmoney",ae.getString("NatMoney"));//本币含税金额
|
jBodyObj.put("inatmoney",0);//本币含税金额
|
||||||
jBodyObj.put("inattax",ae.getString("NatTax"));//本币税额
|
jBodyObj.put("inattax",0);//本币税额
|
||||||
jBodyObj.put("inatsum",ae.getString("NatSum"));//本币含税金额
|
jBodyObj.put("inatsum",0);//本币含税金额
|
||||||
String kl = jBodyObj.getString("kl");
|
String kl = jBodyObj.getString("kl");
|
||||||
String kl2 = jBodyObj.getString("kl2");
|
String kl2 = jBodyObj.getString("kl2");
|
||||||
if(StrUtil.isEmpty(kl)){
|
if(StrUtil.isEmpty(kl)){
|
||||||
|
@ -739,11 +756,15 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
main.put("AccId",AccId);
|
main.put("AccId",AccId);
|
||||||
main.put("head",jHead);
|
main.put("head",jHead);
|
||||||
main.put("body",body);
|
main.put("body",body);
|
||||||
|
|
||||||
main.put("domPosition",new ArrayList<>());
|
main.put("domPosition",new ArrayList<>());
|
||||||
//如果有错误信息,则返回错误信息
|
//如果有错误信息,则返回错误信息
|
||||||
if(StrUtil.isNotEmpty(resultStr.toString())){
|
if(StrUtil.isNotEmpty(resultStr.toString())){
|
||||||
return BaseU8Result.getSuccessMessageEntity(resultStr.toString());
|
return BaseU8Result.getSuccessMessageEntity(resultStr.toString());
|
||||||
}
|
}
|
||||||
|
// if(1==1){
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
logger.info("发货单新增推送U8:"+main.toString());
|
logger.info("发货单新增推送U8:"+main.toString());
|
||||||
String result = U8Util.sengBillToU8(main.toString(), "8000110015");
|
String result = U8Util.sengBillToU8(main.toString(), "8000110015");
|
||||||
logger.info("发货单新增推送U8结果:"+result);
|
logger.info("发货单新增推送U8结果:"+result);
|
||||||
|
@ -797,8 +818,10 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
|
||||||
delete.put("billid", UUID.randomUUID());
|
delete.put("billid", UUID.randomUUID());
|
||||||
delete.put("AccId", AccId);
|
delete.put("AccId", AccId);
|
||||||
delete.put("cVoucherId", dlId);
|
delete.put("cVoucherId", dlId);
|
||||||
|
if(StrUtil.isNotEmpty(dlId)){
|
||||||
//删除
|
//删除
|
||||||
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110017");
|
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110017");
|
||||||
|
}
|
||||||
//删除之后直接返回失败信息
|
//删除之后直接返回失败信息
|
||||||
logger.info("新增失败:"+e.getMessage());
|
logger.info("新增失败:"+e.getMessage());
|
||||||
return BaseU8Result.getFailureMessageEntity("新增失败,请联系U8管理员");
|
return BaseU8Result.getFailureMessageEntity("新增失败,请联系U8管理员");
|
||||||
|
|
|
@ -34,4 +34,8 @@ public interface IOtherReceiptDao extends IBaseDao<OtherReceiptEntity,String> {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int updateState(OtherReceiptEntity entity);
|
int updateState(OtherReceiptEntity entity);
|
||||||
|
|
||||||
|
int updateModify(OtherReceiptEntity entity);
|
||||||
|
|
||||||
|
int insertLog(OtherReceiptEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,4 +24,8 @@ public interface IOtherReceiptDetailDao extends IBaseDao<OtherReceiptDetailEntit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<OtherReceiptDetailEntity> getU8OtherReceipt(OtherReceiptDetailEntity line);
|
List<OtherReceiptDetailEntity> getU8OtherReceipt(OtherReceiptDetailEntity line);
|
||||||
|
|
||||||
|
List<OtherReceiptDetailEntity> getU8OtherReceiptElse(OtherReceiptDetailEntity line);
|
||||||
|
|
||||||
|
int insertU8Log(OtherReceiptDetailEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,4 +29,16 @@ public class OtherReceiptDaoImpl extends MybatisGenericDao<OtherReceiptEntity,St
|
||||||
public int updateState(OtherReceiptEntity entity) {
|
public int updateState(OtherReceiptEntity entity) {
|
||||||
return super.update("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl.entity_update", entity);
|
return super.update("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl.entity_update", entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int updateModify(OtherReceiptEntity entity) {
|
||||||
|
return super.update("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl.entity_modify", entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int insertLog(OtherReceiptEntity entity) {
|
||||||
|
return super.insert("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl.entity_insert_log", entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,16 @@ public class OtherReceiptDetailDaoImpl extends MybatisGenericDao<OtherReceiptDet
|
||||||
public List<OtherReceiptDetailEntity> getU8OtherReceipt(OtherReceiptDetailEntity entity) {
|
public List<OtherReceiptDetailEntity> getU8OtherReceipt(OtherReceiptDetailEntity entity) {
|
||||||
return (List<OtherReceiptDetailEntity>) super.selectList("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDetailDaoImpl.entity_list_base",entity);
|
return (List<OtherReceiptDetailEntity>) super.selectList("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDetailDaoImpl.entity_list_base",entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<OtherReceiptDetailEntity> getU8OtherReceiptElse(OtherReceiptDetailEntity entity) {
|
||||||
|
return (List<OtherReceiptDetailEntity>) super.selectList("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDetailDaoImpl.entity_list_else",entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int insertU8Log(OtherReceiptDetailEntity entity) {
|
||||||
|
return super.insert("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDetailDaoImpl.entity_insert_log", entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class OtherReceiptDetailEntity extends BaseEntity {
|
||||||
private String inum;//
|
private String inum;//
|
||||||
private String iAmount_f;//
|
private String iAmount_f;//
|
||||||
private String cLink;//
|
private String cLink;//
|
||||||
|
private Integer logId;
|
||||||
|
|
||||||
public String getAccId() {
|
public String getAccId() {
|
||||||
return AccId;
|
return AccId;
|
||||||
|
@ -92,4 +93,12 @@ public class OtherReceiptDetailEntity extends BaseEntity {
|
||||||
public void setcLink(String cLink) {
|
public void setcLink(String cLink) {
|
||||||
this.cLink = cLink;
|
this.cLink = cLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getLogId() {
|
||||||
|
return logId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogId(Integer logId) {
|
||||||
|
this.logId = logId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,18 @@
|
||||||
|
|
||||||
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity">
|
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity">
|
||||||
select * from kjs_external.dbo.v_hzya_other_receipt_details
|
select * from kjs_external.dbo.v_hzya_other_receipt_details
|
||||||
|
|
||||||
|
|
||||||
where cLink = #{cLink} and AccId = #{AccId}
|
where cLink = #{cLink} and AccId = #{AccId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="entity_list_else" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity">
|
||||||
|
select * from kjs_external.dbo.v_hzya_other_receipt_details_update
|
||||||
|
where id = #{logId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="entity_insert_log" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity" >
|
||||||
|
insert into kjs_external.dbo.other_receipt_details_log(
|
||||||
|
[id],[AccId],[AccCode],[cinvcode],[cinvname],[iquantity],[cdlcode],[inum],[iAmount_f],[cLink])
|
||||||
|
values(
|
||||||
|
#{logId},#{AccId},#{AccCode},#{cinvcode},#{cinvname},#{iquantity},#{cdlcode},#{inum},#{iAmount_f},#{cLink})
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class OtherReceiptEntity extends BaseEntity {
|
||||||
private String cLink;
|
private String cLink;
|
||||||
private String state;
|
private String state;
|
||||||
private String cDigest;
|
private String cDigest;
|
||||||
|
private String orderType;
|
||||||
|
|
||||||
public String getcDigest() {
|
public String getcDigest() {
|
||||||
return cDigest;
|
return cDigest;
|
||||||
|
@ -96,6 +97,14 @@ public class OtherReceiptEntity extends BaseEntity {
|
||||||
this.syncFlag = syncFlag;
|
this.syncFlag = syncFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOrderType() {
|
||||||
|
return orderType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderType(String orderType) {
|
||||||
|
this.orderType = orderType;
|
||||||
|
}
|
||||||
|
|
||||||
private List<OtherReceiptDetailEntity>OtherReceiptDetailEntity;
|
private List<OtherReceiptDetailEntity>OtherReceiptDetailEntity;
|
||||||
|
|
||||||
public List<com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity> getOtherReceiptDetailEntity() {
|
public List<com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity> getOtherReceiptDetailEntity() {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl">
|
<mapper namespace="com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl">
|
||||||
<resultMap id="get-entity-result" type="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity">
|
<resultMap id="get-entity-result" type="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity">
|
||||||
|
<result property="id" column="id" />
|
||||||
<result property="AccId" column="AccId" />
|
<result property="AccId" column="AccId" />
|
||||||
<result property="AccCode" column="AccCode" />
|
<result property="AccCode" column="AccCode" />
|
||||||
<result property="cvouchid" column="cvouchid" />
|
<result property="cvouchid" column="cvouchid" />
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
<result property="syncFlag" column="sync_flag" />
|
<result property="syncFlag" column="sync_flag" />
|
||||||
<result property="cLink" column="cLink" />
|
<result property="cLink" column="cLink" />
|
||||||
<result property="cDigest" column="cDigest" />
|
<result property="cDigest" column="cDigest" />
|
||||||
|
<result property="orderType" column="orderType" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="OtherReceiptEntity_Base_Column_List">
|
<sql id="OtherReceiptEntity_Base_Column_List">
|
||||||
|
|
||||||
|
@ -28,4 +30,15 @@
|
||||||
where cLink = #{cLink}
|
where cLink = #{cLink}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="entity_modify" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity">
|
||||||
|
update ${AccCode}.dbo.Ap_Vouch set modify_flag_time = getdate()
|
||||||
|
where cLink = #{cLink}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="entity_insert_log" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into kjs_external.dbo.other_receipt_log(
|
||||||
|
[AccId],[AccCode],[ids],[cLink],[cvouchid],[cCusCode],[sync_flag],[cDigest],[orderType])
|
||||||
|
values (#{AccId},#{AccCode},#{ids},#{cLink},#{cvouchid},#{cCusCode},#{syncFlag},#{cDigest},#{orderType})
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -78,9 +79,17 @@ public class OtherReceiptServiceImpl extends BaseService<OtherReceiptEntity,Stri
|
||||||
logger.info("其他应收单对象{}",JSONObject.toJSONString(sale));
|
logger.info("其他应收单对象{}",JSONObject.toJSONString(sale));
|
||||||
line.setcLink(id);
|
line.setcLink(id);
|
||||||
line.setAccId(sale.getAccId());
|
line.setAccId(sale.getAccId());
|
||||||
|
if (sale.getId() != null) {
|
||||||
|
line.setLogId(Integer.parseInt(sale.getId()));
|
||||||
|
}
|
||||||
line.setDataSourceCode(requestJson.getString("db_code"));
|
line.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
logger.info("其他应收单明细查询{}",JSONObject.toJSONString(line));
|
logger.info("其他应收单明细查询{}",JSONObject.toJSONString(line));
|
||||||
List<OtherReceiptDetailEntity> lineList = otherReceiptDetailDao.getU8OtherReceipt(line);
|
List<OtherReceiptDetailEntity> lineList = new ArrayList<>();
|
||||||
|
if (sale.getOrderType() == null || sale.getOrderType().equals("正常")){
|
||||||
|
lineList = otherReceiptDetailDao.getU8OtherReceipt(line);
|
||||||
|
}else{
|
||||||
|
lineList = otherReceiptDetailDao.getU8OtherReceiptElse(line);
|
||||||
|
}
|
||||||
logger.info("其他应收单明细查询数据{}",JSONObject.toJSONString(lineList));
|
logger.info("其他应收单明细查询数据{}",JSONObject.toJSONString(lineList));
|
||||||
sale.setOtherReceiptDetailEntity(lineList);
|
sale.setOtherReceiptDetailEntity(lineList);
|
||||||
logger.info("组装数据");
|
logger.info("组装数据");
|
||||||
|
@ -115,6 +124,28 @@ public class OtherReceiptServiceImpl extends BaseService<OtherReceiptEntity,Stri
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
otherReceiptDao.updateState(sale);
|
otherReceiptDao.updateState(sale);
|
||||||
|
//当推送成功,将数据存入u8库中
|
||||||
|
try{
|
||||||
|
if (sale.getState().equals("Y")){
|
||||||
|
if (sale.getOrderType().equals("修改")){
|
||||||
|
otherReceiptDao.updateModify(sale);
|
||||||
|
}
|
||||||
|
otherReceiptDao.insertLog(sale);
|
||||||
|
sale.getOtherReceiptDetailEntity().forEach(saleDetail -> {
|
||||||
|
try {
|
||||||
|
saleDetail.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
saleDetail.setLogId(Integer.parseInt(sale.getId()));
|
||||||
|
otherReceiptDetailDao.insertU8Log(saleDetail);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("保存写入u8明细日志失败" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("保存写入u8日志失败"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("其他应收单执行失败"+e.getMessage());
|
logger.error("其他应收单执行失败"+e.getMessage());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.hzya.frame.u8.receipt.dao;
|
package com.hzya.frame.u8.receipt.dao;
|
||||||
|
|
||||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
|
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity;
|
||||||
import com.hzya.frame.u8.receipt.entity.ReceiptEntity;
|
import com.hzya.frame.u8.receipt.entity.ReceiptEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,4 +35,8 @@ public interface IReceiptDao extends IBaseDao<ReceiptEntity,String> {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int updateState(ReceiptEntity sale);
|
int updateState(ReceiptEntity sale);
|
||||||
|
|
||||||
|
int modifyState(ReceiptEntity sale);
|
||||||
|
|
||||||
|
int insertLog(ReceiptEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.hzya.frame.u8.receipt.dao.impl;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity;
|
||||||
import com.hzya.frame.u8.receipt.dao.IReceiptDao;
|
import com.hzya.frame.u8.receipt.dao.IReceiptDao;
|
||||||
import com.hzya.frame.u8.receipt.entity.ReceiptEntity;
|
import com.hzya.frame.u8.receipt.entity.ReceiptEntity;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
@ -28,4 +29,16 @@ public class ReceiptDaoImpl extends MybatisGenericDao<ReceiptEntity,String> impl
|
||||||
public int updateState(ReceiptEntity entity) {
|
public int updateState(ReceiptEntity entity) {
|
||||||
return super.update("com.hzya.frame.u8.receipt.dao.impl.ReceiptDaoImpl.entity_update",entity);
|
return super.update("com.hzya.frame.u8.receipt.dao.impl.ReceiptDaoImpl.entity_update",entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int modifyState(ReceiptEntity entity) {
|
||||||
|
return super.update("com.hzya.frame.u8.receipt.dao.impl.ReceiptDaoImpl.entity_modify",entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int insertLog(ReceiptEntity entity) {
|
||||||
|
return super.insert("com.hzya.frame.u8.receipt.dao.impl.ReceiptDaoImpl.entity_insert_log", entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ public class ReceiptEntity extends BaseEntity {
|
||||||
private String state;//状态
|
private String state;//状态
|
||||||
private String AccCode;//账套编码
|
private String AccCode;//账套编码
|
||||||
private String ids;//
|
private String ids;//
|
||||||
|
private String cDigest;
|
||||||
|
private String orderType;
|
||||||
|
|
||||||
public String getIds() {
|
public String getIds() {
|
||||||
return ids;
|
return ids;
|
||||||
|
@ -123,4 +125,20 @@ public class ReceiptEntity extends BaseEntity {
|
||||||
public void setState(String state) {
|
public void setState(String state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getcDigest() {
|
||||||
|
return cDigest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setcDigest(String cDigest) {
|
||||||
|
this.cDigest = cDigest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderType() {
|
||||||
|
return orderType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderType(String orderType) {
|
||||||
|
this.orderType = orderType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
<result property="AccId" column="AccId" />
|
<result property="AccId" column="AccId" />
|
||||||
<result property="AccCode" column="AccCode" />
|
<result property="AccCode" column="AccCode" />
|
||||||
<result property="ids" column="ids" />
|
<result property="ids" column="ids" />
|
||||||
|
<result property="cDigest" column="cDigest" />
|
||||||
|
<result property="orderType" column="orderType" />
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="ReceiptEntity_Base_Column_List">
|
<sql id="ReceiptEntity_Base_Column_List">
|
||||||
|
@ -32,4 +34,18 @@
|
||||||
update ${AccCode}.dbo.Ap_CloseBill set sync_flag = #{state}
|
update ${AccCode}.dbo.Ap_CloseBill set sync_flag = #{state}
|
||||||
where iID = #{iID}
|
where iID = #{iID}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键修改方法-->
|
||||||
|
<update id="entity_modify" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity">
|
||||||
|
update ${AccCode}.dbo.Ap_CloseBill set modify_flag_time = getdate()
|
||||||
|
where iID = #{iID}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="entity_insert_log" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into kjs_external.dbo.receipt_log(
|
||||||
|
[AccId],[AccCode],[iID],[ids],[cvouchid],[dvouchdate],[ccuscode],[ccusname],[iamount_f]
|
||||||
|
,[csscode],[sync_flag],[cDigest],[orderType])
|
||||||
|
values (#{AccId},#{AccCode},#{iID},#{ids},#{cvouchid},#{dvouchdate},#{ccuscode},#{ccusname},#{iamount_f},
|
||||||
|
#{csscode},#{syncFlag},#{cDigest},#{orderType})
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -101,6 +101,18 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
|
||||||
sale.setState("N");
|
sale.setState("N");
|
||||||
}
|
}
|
||||||
sale.setDataSourceCode(requestJson.getString("db_code"));
|
sale.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
// 日志写入u8扩展库
|
||||||
|
try{
|
||||||
|
if (sale.getState().equals("Y")) {
|
||||||
|
if (sale.getOrderType().equals("修改")){
|
||||||
|
saleOutDao.modifyState(sale);
|
||||||
|
}
|
||||||
|
saleOutDao.insertLog(sale);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("保存写入u8日志失败"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
saveLog(interId, logDetails, flag);
|
saveLog(interId, logDetails, flag);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
@ -169,6 +181,7 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
|
||||||
head.put("iamount_f",sale.getIamount_f());
|
head.put("iamount_f",sale.getIamount_f());
|
||||||
head.put("csscode",sale.getCsscode());
|
head.put("csscode",sale.getCsscode());
|
||||||
head.put("syncFlag",sale.getSyncFlag());
|
head.put("syncFlag",sale.getSyncFlag());
|
||||||
|
head.put("cDigest",sale.getcDigest());
|
||||||
main.put("head",head);
|
main.put("head",head);
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
//发货退货单主表@
|
//发货退货单主表@
|
||||||
//发货退货单主表
|
//发货退货单主表
|
||||||
String sqlSelDisList = "select DLID as 'dlid',DLID as 'cdlcode' ,cDLCode as 'cbuscode' ,cDepCode as 'cdepcode' ,cPersonCode as 'cpersoncode' ,cCusCode as 'ccuscode'," +
|
String sqlSelDisList = "select DLID as 'dlid',DLID as 'cdlcode' ,cDLCode as 'cbuscode' ,cDepCode as 'cdepcode' ,cPersonCode as 'cpersoncode' ,cCusCode as 'ccuscode'," +
|
||||||
"cCusCode as 'cinvoicecompany',cSTCode as 'cstcode ,'32' as 'cvouchtype' ,'普通销售' as 'cbustype' ,'发货单' as 'csource' ,GETDATE() as 'ddate' ,'form WMS' as 'cmemo'," +
|
"cCusCode as 'cinvoicecompany',cSTCode as 'cstcode' ,'32' as 'cvouchtype' ,'普通销售' as 'cbustype' ,'发货单' as 'csource' ,GETDATE() as 'ddate' ,'form WMS' as 'cmemo'," +
|
||||||
"case when bReturnFlag = 1 then '多组织-红字采购入库' else '多组织-采购订单' end as 'cdefine1' " +
|
"case when bReturnFlag = 1 then '多组织-红字采购入库' else '多组织-采购订单' end as 'cdefine1' " +
|
||||||
"from "+AccCode+".dbo.DispatchList " +
|
"from "+AccCode+".dbo.DispatchList " +
|
||||||
"where cDLCode = '"+jHead.getString("cbuscode")+"'";
|
"where cDLCode = '"+jHead.getString("cbuscode")+"'";
|
||||||
|
@ -514,11 +514,11 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public U8ResultEntity addSaleOutT(JSONObject parm) {
|
public U8ResultEntity addSaleOutT(JSONObject jsonObject) {
|
||||||
String billCode = "";
|
String billCode = "";
|
||||||
String dlId = "";
|
String dlId = "";
|
||||||
String AccId = "";
|
String AccId = "";
|
||||||
JSONObject jsonObject = parm.getJSONObject("jsonStr");
|
// JSONObject jsonObject = parm.getJSONObject("jsonStr");
|
||||||
logger.info("接收到的参数"+jsonObject.toString());
|
logger.info("接收到的参数"+jsonObject.toString());
|
||||||
StringBuffer resultStr = new StringBuffer();//回传json
|
StringBuffer resultStr = new StringBuffer();//回传json
|
||||||
try {
|
try {
|
||||||
|
@ -566,21 +566,38 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
if(StrUtil.isEmpty(AccCode)){
|
if(StrUtil.isEmpty(AccCode)){
|
||||||
return BaseU8Result.getFailureMessageEntity("获取账套号有误,请联系管理员");
|
return BaseU8Result.getFailureMessageEntity("获取账套号有误,请联系管理员");
|
||||||
}
|
}
|
||||||
|
String ccodeSql = "SELECT ISNULL(max(CONVERT(DECIMAL(20, 0), ccode))+1, CONVERT (VARCHAR (20),ddate,112) + '0001') as ccode " +
|
||||||
|
"FROM "+AccCode+".dbo.RdRecord32 " +
|
||||||
|
"WHERE cCode LIKE CONVERT (VARCHAR (20),'"+DateUtil.format(jHead.getDate("ddate"),"yyyyMMdd")+"',112) + '%'" +
|
||||||
|
"AND len(cCode) = 12 GROUP BY ddate";
|
||||||
|
//查询账套中的发货单信息
|
||||||
|
// SaleInvEntity U8Obj = new SaleInvEntity();
|
||||||
|
// U8Obj.setDataSourceCode("YONYOUU8NEW");
|
||||||
|
List<HashMap<String, Object>> ccodeHashMaps = saleInvDao.getU8BillData(ccodeSql,U8Obj);
|
||||||
|
if(CollectionUtils.isNotEmpty(ccodeHashMaps)){
|
||||||
|
HashMap<String, Object> ccodeObj= ccodeHashMaps.get(0);
|
||||||
|
jHead.put("ccode",ccodeObj.get("ccode"));
|
||||||
|
}else{
|
||||||
|
jHead.put("ccode",DateUtil.format(jHead.getDate("ddate"),"yyyyMMdd")+"0001");
|
||||||
|
}
|
||||||
|
jHead.put("csource","发货单");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//验证单号唯一
|
//验证单号唯一
|
||||||
String cdefine5 = jsonObject.getString("cdefine5");
|
// String cdefine5 = jsonObject.getString("cdefine5");
|
||||||
if(StrUtil.isNotEmpty(cdefine5)){
|
// if(StrUtil.isNotEmpty(cdefine5)){
|
||||||
String cdefine5Sql = "select cdefine5 from "+AccCode+".dbo.rdrecord32 where cdefine5 = '"+cdefine5+"'";
|
// String cdefine5Sql = "select cdefine5 from "+AccCode+".dbo.rdrecord32 where cdefine5 = '"+cdefine5+"'";
|
||||||
List<HashMap<String, Object>> cdefine5Map = saleInvDao.getU8BillData(cdefine5Sql,U8Obj);
|
// List<HashMap<String, Object>> cdefine5Map = saleInvDao.getU8BillData(cdefine5Sql,U8Obj);
|
||||||
if(CollectionUtils.isNotEmpty(cdefine5Map) ){
|
// if(CollectionUtils.isNotEmpty(cdefine5Map) ){
|
||||||
return BaseU8Result.getFailureMessageEntity("单号重复,请检查:"+cdefine5);
|
// return BaseU8Result.getFailureMessageEntity("单号重复,请检查:"+cdefine5);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//发货退货单主表@
|
//发货退货单主表@
|
||||||
//发货退货单主表
|
//发货退货单主表
|
||||||
String sqlSelDisList = "select DLID as 'dlid',DLID as 'cdlcode' ,cDLCode as 'cbuscode' ,cDepCode as 'cdepcode' ,cPersonCode as 'cpersoncode' ,cCusCode as 'ccuscode'," +
|
String sqlSelDisList = "select DLID as 'dlid',DLID as 'cdlcode' ,cDLCode as 'cbuscode' ,cDepCode as 'cdepcode' ,cPersonCode as 'cpersoncode' ,cCusCode as 'ccuscode'," +
|
||||||
"cCusCode as 'cinvoicecompany',cSTCode as 'cstcode ,'32' as 'cvouchtype' ,'普通销售' as 'cbustype' ,'发货单' as 'csource' ,GETDATE() as 'ddate' ,'form WMS' as 'cmemo'," +
|
"cCusCode as 'cinvoicecompany',cSTCode as 'cstcode' ,'32' as 'cvouchtype' ,'普通销售' as 'cbustype' ,'发货单' as 'csource' ,GETDATE() as 'ddate' ,'form WMS' as 'cmemo'," +
|
||||||
"case when bReturnFlag = 1 then '多组织-红字采购入库' else '多组织-采购订单' end as 'cdefine1' " +
|
"case when bReturnFlag = 1 then '多组织-红字采购入库' else '多组织-采购订单' end as 'cdefine1' " +
|
||||||
"from "+AccCode+".dbo.DispatchList " +
|
"from "+AccCode+".dbo.DispatchList " +
|
||||||
"where cDLCode = '"+jHead.getString("cbuscode")+"'";
|
"where cDLCode = '"+jHead.getString("cbuscode")+"'";
|
||||||
|
@ -635,7 +652,10 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
//表体
|
//表体
|
||||||
JSONArray body = new JSONArray();
|
JSONArray body = new JSONArray();
|
||||||
JSONArray jBody = jsonObject.getJSONArray("body");
|
JSONArray jBody = jsonObject.getJSONArray("body");
|
||||||
|
int k = 1;
|
||||||
for (int i = 0; i < jBody.size(); i++) {
|
for (int i = 0; i < jBody.size(); i++) {
|
||||||
|
System.out.println("错误的行"+k);
|
||||||
|
k++;
|
||||||
JSONObject jBodyObj = jBody.getJSONObject(i);
|
JSONObject jBodyObj = jBody.getJSONObject(i);
|
||||||
if(StrUtil.isEmpty(jBodyObj.getString("cinvcode"))){
|
if(StrUtil.isEmpty(jBodyObj.getString("cinvcode"))){
|
||||||
resultStr.append("材料编码不能为空 行:"+i+1) ;
|
resultStr.append("材料编码不能为空 行:"+i+1) ;
|
||||||
|
@ -659,22 +679,24 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//发货退货单子表@
|
//发货退货单子表@
|
||||||
String sqlSelDisLists = " select idlsid from "+AccCode+".dbo.DispatchList dl left join "+AccCode+".dbo.DispatchLists dls on dls.DLID = dl.DLID " +
|
String sqlSelDisLists = " select idlsid,irowno from "+AccCode+".dbo.DispatchList dl left join "+AccCode+".dbo.DispatchLists dls on dls.DLID = dl.DLID " +
|
||||||
"where cDLCode = '"+jBodyObj.getString("cbdlcode")+"" +
|
"where cDLCode = '"+jBodyObj.getString("cbdlcode")+"" +
|
||||||
"' and cInvCode = '"+jBodyObj.getString("cinvcode")+"" +
|
"' and cInvCode = '"+jBodyObj.getString("cinvcode")+"'" ;
|
||||||
"' and irowno = '"+jBodyObj.getString("cdblrowno")+"'";
|
// "' and irowno = '"+jBodyObj.getString("cdblrowno")+"'";
|
||||||
List<HashMap<String, Object>> selDisDetailsListMap = saleInvDao.getU8BillData(sqlSelDisLists,U8Obj);
|
List<HashMap<String, Object>> selDisDetailsListMap = saleInvDao.getU8BillData(sqlSelDisLists,U8Obj);
|
||||||
if(CollectionUtils.isEmpty(selDisDetailsListMap) ){
|
if(CollectionUtils.isEmpty(selDisDetailsListMap)&& selDisDetailsListMap.size()==0){
|
||||||
return BaseU8Result.getFailureMessageEntity("发货单子表查询失败"+jHead.getString("cbuscode")+"发货单表体存货"+jBodyObj.getString("cinvcode")+"行号"+jBodyObj.getString("cdblrowno")+"不存在");
|
continue;
|
||||||
|
// return BaseU8Result.getFailureMessageEntity("发货单子表查询失败"+jHead.getString("cbuscode")+"发货单表体存货"+jBodyObj.getString("cinvcode")+"行号"+jBodyObj.getString("cdblrowno")+"不存在");
|
||||||
}
|
}
|
||||||
HashMap<String, Object> selDisDetails= hashMaps.get(0);
|
HashMap<String, Object> selDisDetails= selDisDetailsListMap.get(0);
|
||||||
if(StrUtil.isEmpty(jBodyObj.getString("idlsid"))){
|
if(StrUtil.isEmpty(jBodyObj.getString("idlsid"))){
|
||||||
jBodyObj.put("idlsid",selDisDetails.get("idlsid"));
|
jBodyObj.put("idlsid",selDisDetails.get("idlsid"));
|
||||||
|
jBodyObj.put("irowno",selDisDetails.get("irowno"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//获取辅计量单位
|
//获取辅计量单位
|
||||||
String dtInvSql = "select cInvCode,cInvName,cInvStd,Inv.cComUnitCode,cInvCCode,iChangRate, cPUComUnitCode,cSAComUnitCode,cProductUnit,cSTComUnitCode " +
|
String dtInvSql = "select inv.bInvBatch,cInvCode,cInvName,cInvStd,Inv.cComUnitCode,cInvCCode,iChangRate, cPUComUnitCode,cSAComUnitCode,cProductUnit,cSTComUnitCode " +
|
||||||
"from "+AccCode+".dbo.Inventory Inv " +
|
"from "+AccCode+".dbo.Inventory Inv " +
|
||||||
"left join "+AccCode+".dbo.ComputationUnit Com On Inv.cComUnitCode = Com.cComUnitCode " +
|
"left join "+AccCode+".dbo.ComputationUnit Com On Inv.cComUnitCode = Com.cComUnitCode " +
|
||||||
"where cInvCode='" + jBodyObj.getString("cinvcode") +"'";
|
"where cInvCode='" + jBodyObj.getString("cinvcode") +"'";
|
||||||
|
@ -689,15 +711,19 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
String sqlCassUnit = "select * from "+AccCode+".dbo.ComputationUnit where cComUnitCode='" +dtInvObj.get("cSTComUnitCode")+"'";
|
String sqlCassUnit = "select * from "+AccCode+".dbo.ComputationUnit where cComUnitCode='" +dtInvObj.get("cSTComUnitCode")+"'";
|
||||||
List<HashMap<String, Object>> dtUnit = saleInvDao.getU8BillData(sqlCassUnit,U8Obj);
|
List<HashMap<String, Object>> dtUnit = saleInvDao.getU8BillData(sqlCassUnit,U8Obj);
|
||||||
if(CollectionUtils.isEmpty(dtUnit) ){
|
if(CollectionUtils.isEmpty(dtUnit) ){
|
||||||
return BaseU8Result.getFailureMessageEntity("查询单位失败,请检查,行号:"+i+1);
|
// return BaseU8Result.getFailureMessageEntity("查询单位失败,请检查,行号:"+i+1);
|
||||||
}
|
jBodyObj.put("iinvexchrate",0);
|
||||||
|
}else {
|
||||||
HashMap<String, Object> dtUnitObj= dtUnit.get(0);
|
HashMap<String, Object> dtUnitObj= dtUnit.get(0);
|
||||||
jBodyObj.put("iinvexchrate",dtUnitObj.get("iChangRate"));
|
jBodyObj.put("iinvexchrate",dtUnitObj.get("iChangRate"));
|
||||||
|
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(jBodyObj.getBigDecimal("iinvexchrate"),6, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(dtUnitObj.get("iChangRate"))),6, RoundingMode.HALF_UP));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
jBodyObj.put("irowno",i+1);
|
|
||||||
//默认字段
|
//默认字段
|
||||||
//是否需要开票
|
//是否需要开票
|
||||||
if(StrUtil.isEmpty(jBodyObj.getString("bneedbill"))){
|
if(StrUtil.isEmpty(jBodyObj.getString("bneedbill"))){
|
||||||
|
@ -728,6 +754,15 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
jBodyObj.put("cProBatch",0);
|
||||||
|
// jBodyObj.put("csource","发货单");
|
||||||
|
// jBodyObj.put("cbustype","普通销售");
|
||||||
|
jBodyObj.put("cProBatch",0);
|
||||||
|
String bInvBatch = String.valueOf(dtInvObj.get("bInvBatch"));
|
||||||
|
if("true".equals(bInvBatch)){
|
||||||
|
jBodyObj.put("cbatch",0);
|
||||||
|
}
|
||||||
|
|
||||||
body.add(jBodyObj);
|
body.add(jBodyObj);
|
||||||
}
|
}
|
||||||
JSONObject main = new JSONObject();
|
JSONObject main = new JSONObject();
|
||||||
|
@ -777,8 +812,10 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
|
||||||
delete.put("billid", UUID.randomUUID());
|
delete.put("billid", UUID.randomUUID());
|
||||||
delete.put("AccId", AccId);
|
delete.put("AccId", AccId);
|
||||||
delete.put("cVoucherId", billCode);
|
delete.put("cVoucherId", billCode);
|
||||||
//删除
|
if(StrUtil.isNotEmpty(billCode)){
|
||||||
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110023");
|
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110023");
|
||||||
|
}
|
||||||
|
//删除
|
||||||
logger.info("新增失败:"+e.getMessage());
|
logger.info("新增失败:"+e.getMessage());
|
||||||
return BaseU8Result.getFailureMessageEntity("新增失败,请联系U8管理员");
|
return BaseU8Result.getFailureMessageEntity("新增失败,请联系U8管理员");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue