|
@@ -83,17 +83,37 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
System.out.println(cCode);
|
|
|
}
|
|
|
|
|
|
- @DS("master3")
|
|
|
+ @DS("master1")
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String,Object> propellingThree(IncidentTicket incidentTicket,IncidentTicketChildren children) {
|
|
|
+ public Map<String,Object> propellingOne(IncidentTicket incidentTicket,IncidentTicketChildren children) {
|
|
|
Map<String,Object> resMap = new HashMap<>();
|
|
|
resMap.put("res","false");
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ String accidentType = children.getAccidentType();
|
|
|
+ String accidentNumber = incidentTicket.getAccidentNumber();
|
|
|
+ map.put("cPBVMemo", accidentNumber);
|
|
|
+ if(accidentType.equals("不涉及金额")){
|
|
|
+ resMap.put("res","noneTrue");
|
|
|
+ return resMap;
|
|
|
+ }else if(accidentType.equals("扣款")){
|
|
|
+ map.put("bNegative", 1);
|
|
|
+
|
|
|
+ }else if(accidentType.equals("应补")){
|
|
|
+ map.put("bNegative", 0);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","事故类型有误:"+accidentType);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
String businessType = incidentTicket.getBusinessType();
|
|
|
String moneyType = incidentTicket.getMoneyType();
|
|
|
String accidentData = incidentTicket.getAccidentData();
|
|
|
- String factory = incidentTicket.getFactory();
|
|
|
+
|
|
|
String responsibilityCompany = incidentTicket.getResponsibilityCompany();
|
|
|
|
|
|
String exchangeRate = children.getExchangeRate();
|
|
@@ -101,92 +121,86 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
String practicalSum = children.getPracticalSum();
|
|
|
String zhanghaoId = children.getZhanghaoId();
|
|
|
|
|
|
- Map<String,Object> factoryMap = incidentTicketMapper.getVendor(factory);
|
|
|
+
|
|
|
Map<String,Object> responsibilityCompanyMap = incidentTicketMapper.getVendor(responsibilityCompany);
|
|
|
|
|
|
- if(factoryMap == null){
|
|
|
- resMap.put("msg",zhanghaoId+"账套不存在工厂 "+factory);
|
|
|
- return resMap;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if(responsibilityCompanyMap == null){
|
|
|
resMap.put("msg",zhanghaoId+"账套不存在责任单位 "+responsibilityCompany);
|
|
|
return resMap;
|
|
|
}
|
|
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
+
|
|
|
|
|
|
|
|
|
* 主表
|
|
|
*/
|
|
|
map.put("cPBVBillType","03");
|
|
|
- String cCode = "test";
|
|
|
-
|
|
|
-
|
|
|
|
|
|
- map.put("cPBVCode",cCode);
|
|
|
- if(StringUtils.isNotBlank(businessType) && businessType.equals("委外加工")){
|
|
|
+ map.put("iVTid", 131586);
|
|
|
+ if(businessType.equals("委外加工")){
|
|
|
map.put("cPTCode","02");
|
|
|
- }else{
|
|
|
+ map.put("cBusType", "委外加工");
|
|
|
+ map.put("cSource", "委外");
|
|
|
+ }else if(businessType.equals("普通采购")){
|
|
|
map.put("cPTCode","01");
|
|
|
+ map.put("cBusType", "普通采购");
|
|
|
+ map.put("cSource", "采购");
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","业务类型有误 :"+businessType);
|
|
|
+ return resMap;
|
|
|
}
|
|
|
+
|
|
|
map.put("dPBVDate", DateUtils.getDate("yyyy-MM-dd"));
|
|
|
- String cVenCode = factoryMap.get("cVenCode").toString();
|
|
|
+ String cVenCode = responsibilityCompanyMap.get("cVenCode").toString();
|
|
|
map.put("cVenCode", cVenCode);
|
|
|
String cUnitCode = responsibilityCompanyMap.get("cVenCode").toString();
|
|
|
map.put("cUnitCode", cUnitCode);
|
|
|
map.put("cexch_name", moneyType);
|
|
|
-
|
|
|
- map.put("cExchRate", 12);
|
|
|
- map.put("iPBVTaxRate", 0.0);
|
|
|
- if(StringUtils.isNotBlank(businessType)){
|
|
|
- map.put("cBusType", businessType);
|
|
|
- }else{
|
|
|
- map.put("cBusType", "普通采购");
|
|
|
- }
|
|
|
+ map.put("cExchRate", exchangeRate);
|
|
|
+ map.put("iPBVTaxRate", 0);
|
|
|
|
|
|
map.put("cPBVMaker", sysUser.getRealname());
|
|
|
- map.put("bNegative", 0);
|
|
|
+
|
|
|
map.put("bOriginal", 0);
|
|
|
map.put("bFirst", 0);
|
|
|
map.put("iNetLock", 0);
|
|
|
map.put("cDefine2", planNumber);
|
|
|
map.put("dVouDate", accidentData);
|
|
|
- map.put("iVTid", 8167);
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- map.put("cSource", "采购");
|
|
|
- map.put("cDefine12", factory);
|
|
|
+
|
|
|
+ map.put("cDefine12", responsibilityCompany);
|
|
|
map.put("cDefine13", responsibilityCompany);
|
|
|
map.put("iDiscountTaxType",0);
|
|
|
map.put("bCredit",0);
|
|
|
String cVenAccount = "";
|
|
|
String cVenBank = "";
|
|
|
- if(factoryMap.get("cVenAccount") != null){
|
|
|
- cVenAccount = factoryMap.get("cVenAccount").toString();
|
|
|
+ if(responsibilityCompanyMap.get("cVenAccount") != null){
|
|
|
+ cVenAccount = responsibilityCompanyMap.get("cVenAccount").toString();
|
|
|
}
|
|
|
- if(factoryMap.get("cVenBank") != null){
|
|
|
- cVenBank = factoryMap.get("cVenBank").toString();
|
|
|
+ if(responsibilityCompanyMap.get("cVenBank") != null){
|
|
|
+ cVenBank = responsibilityCompanyMap.get("cVenBank").toString();
|
|
|
}
|
|
|
map.put("cVenAccount",cVenAccount);
|
|
|
map.put("cVenBank",cVenBank);
|
|
|
map.put("iPrintCount",0);
|
|
|
String cVenContactCode = "";
|
|
|
String cVenPerson = "";
|
|
|
- if(factoryMap.get("cVenContactCode") != null){
|
|
|
- cVenContactCode = factoryMap.get("cVenContactCode").toString();
|
|
|
+ if(responsibilityCompanyMap.get("cVenContactCode") != null){
|
|
|
+ cVenContactCode = responsibilityCompanyMap.get("cVenContactCode").toString();
|
|
|
}
|
|
|
- if(factoryMap.get("cVenPerson") != null){
|
|
|
- cVenPerson = factoryMap.get("cVenPerson").toString();
|
|
|
+ if(responsibilityCompanyMap.get("cVenPerson") != null){
|
|
|
+ cVenPerson = responsibilityCompanyMap.get("cVenPerson").toString();
|
|
|
}
|
|
|
map.put("cContactCode",cVenContactCode);
|
|
|
map.put("cVenPerson",cVenPerson);
|
|
|
map.put("IsWfControlled",0);
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
- sb.append("||puzl|");
|
|
|
- sb.append(cCode);
|
|
|
- map.put("csysbarcode",sb.toString());
|
|
|
- map.put("cmaketime",DateUtils.now());
|
|
|
|
|
|
+ map.put("cmaketime",DateUtils.now());
|
|
|
|
|
|
|
|
|
* 子表
|
|
@@ -194,154 +208,488 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
Map<String,Object> map2 = new HashMap<>();
|
|
|
|
|
|
|
|
|
-
|
|
|
map2.put("cInvCode","N3000002424");
|
|
|
map2.put("bExBill",1);
|
|
|
|
|
|
-
|
|
|
- if(StringUtils.isNotBlank(practicalSum)){
|
|
|
|
|
|
- }else{
|
|
|
- map2.put("iOriMoney",0);
|
|
|
- }
|
|
|
-
|
|
|
- map2.put("iOriSum",practicalSum);
|
|
|
- map2.put("iOriTaxPrice",0);
|
|
|
- map2.put("iMoney",practicalSum);
|
|
|
- map2.put("iSum",practicalSum);
|
|
|
- map2.put("iTaxPrice",practicalSum);
|
|
|
- map2.put("iTaxRate",0);
|
|
|
- map2.put("ivouchrowno",1);
|
|
|
- map2.put("cbsysbarcode",sb.toString()+"|1");
|
|
|
- map2.put("bgift",0);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ try {
|
|
|
|
|
|
+
|
|
|
+ BigDecimal sl = new BigDecimal("1");
|
|
|
+ BigDecimal hl = new BigDecimal(exchangeRate);
|
|
|
+
|
|
|
+ BigDecimal iOriMoney = new BigDecimal(practicalSum).divide(sl,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal iOriTaxPrice = new BigDecimal(practicalSum).subtract(iOriMoney);
|
|
|
+
|
|
|
+ BigDecimal iSum = new BigDecimal(practicalSum).multiply(hl);
|
|
|
+
|
|
|
+ BigDecimal iMoney = iSum.divide(sl,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal iTaxPrice = iSum.subtract(iMoney);
|
|
|
+
|
|
|
+ if(accidentType.equals("不涉及金额")){
|
|
|
+ map2.put("iOriMoney",0);
|
|
|
+ map2.put("iOriSum",0);
|
|
|
+ map2.put("iOriSum",0);
|
|
|
+ map2.put("iOriTaxPrice",0);
|
|
|
+ map2.put("iSum",0);
|
|
|
+ map2.put("iMoney",0);
|
|
|
+ map2.put("iTaxPrice",0);
|
|
|
+ }else if(accidentType.equals("扣款")){
|
|
|
+ map2.put("iOriMoney","-"+iOriMoney);
|
|
|
+ map2.put("iOriSum","-"+practicalSum);
|
|
|
+ map2.put("iOriTaxPrice","-"+iOriTaxPrice);
|
|
|
+ map2.put("iOriTaxPrice",0);
|
|
|
+ map2.put("iSum","-"+iSum);
|
|
|
+ map2.put("iMoney","-"+iMoney);
|
|
|
+ map2.put("iTaxPrice",0);
|
|
|
+
|
|
|
+ }else if(accidentType.equals("应补")){
|
|
|
+ map2.put("iOriMoney",iOriMoney);
|
|
|
+ map2.put("iOriSum",practicalSum);
|
|
|
+ map2.put("iOriTaxPrice",0);
|
|
|
+ map2.put("iSum",iSum);
|
|
|
+ map2.put("iMoney",iMoney);
|
|
|
+ map2.put("iTaxPrice",0);
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","事故类型有误:"+accidentType);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ map2.put("iTaxRate",0);
|
|
|
+ map2.put("ivouchrowno",1);
|
|
|
+
|
|
|
+ map2.put("bgift",0);
|
|
|
+
|
|
|
+ String cCode=this.addOne(incidentTicketMapper.getMaxCode("cPBVCode","PurBillVouch","cpbvcode"));
|
|
|
+ incidentTicketMapper.updateVoucherHistoryCNumber(this.maxNumber(cCode),"2502");
|
|
|
+
|
|
|
+ map.put("cPBVCode",cCode);
|
|
|
+ resMap.put("cCode",cCode);
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append("||puzl|");
|
|
|
+ sb.append(cCode);
|
|
|
+ map.put("csysbarcode",sb.toString());
|
|
|
+ map2.put("cbsysbarcode",sb.toString()+"|1");
|
|
|
+
|
|
|
+ int chId = incidentTicketMapper.getMaxCode2();
|
|
|
+ map.put("pbvid",chId+1);
|
|
|
+ incidentTicketMapper.insertPurBillVouch(map);
|
|
|
+
|
|
|
+ int chIds = incidentTicketMapper.getMaxCode3();
|
|
|
+ map2.put("pbvid",chId+1);
|
|
|
+ map2.put("id",chIds+1);
|
|
|
+ incidentTicketMapper.insertPurBillVouchs(map2);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ resMap.put("msg","同步数据有误,请联系管理员");
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ resMap.put("res","true");
|
|
|
return resMap;
|
|
|
}
|
|
|
|
|
|
- @DS("master3")
|
|
|
+ @DS("master2")
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Result<?> propelling(IncidentTicket incidentTicket){
|
|
|
+ public Map<String,Object> propellingTwo(IncidentTicket incidentTicket,IncidentTicketChildren children) {
|
|
|
+ Map<String,Object> resMap = new HashMap<>();
|
|
|
+ resMap.put("res","false");
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
|
|
- if(!incidentTicket.getState().equals("3")){
|
|
|
- return Result.error("此单据状态下无法推送");
|
|
|
+ String accidentType = children.getAccidentType();
|
|
|
+ String accidentNumber = incidentTicket.getAccidentNumber();
|
|
|
+ map.put("cPBVMemo", accidentNumber);
|
|
|
+ if(accidentType.equals("不涉及金额")){
|
|
|
+ resMap.put("res","noneTrue");
|
|
|
+ return resMap;
|
|
|
+ }else if(accidentType.equals("扣款")){
|
|
|
+ map.put("bNegative", 1);
|
|
|
+ }else if(accidentType.equals("应补")){
|
|
|
+ map.put("bNegative", 0);
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","事故类型有误:"+accidentType);
|
|
|
+ return resMap;
|
|
|
}
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
-
|
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
String businessType = incidentTicket.getBusinessType();
|
|
|
String moneyType = incidentTicket.getMoneyType();
|
|
|
String accidentData = incidentTicket.getAccidentData();
|
|
|
- String factory = incidentTicket.getFactory();
|
|
|
+
|
|
|
String responsibilityCompany = incidentTicket.getResponsibilityCompany();
|
|
|
- List<IncidentTicketChildren> childrenList = incidentTicketChildrenMapper.selectByMainId(incidentTicket.getId());
|
|
|
|
|
|
- for (IncidentTicketChildren children:childrenList){
|
|
|
+ String exchangeRate = children.getExchangeRate();
|
|
|
+ String planNumber = children.getPlanNumber();
|
|
|
+ String practicalSum = children.getPracticalSum();
|
|
|
+ String zhanghaoId = children.getZhanghaoId();
|
|
|
|
|
|
- String exchangeRate = children.getExchangeRate();
|
|
|
- String planNumber = children.getPlanNumber();
|
|
|
- String practicalSum = children.getPracticalSum();
|
|
|
+
|
|
|
+ Map<String,Object> responsibilityCompanyMap = incidentTicketMapper.getVendor(responsibilityCompany);
|
|
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
-
|
|
|
-
|
|
|
- * 主表
|
|
|
- */
|
|
|
- map.put("cPBVBillType","03");
|
|
|
+ if(responsibilityCompanyMap == null){
|
|
|
+ resMap.put("msg",zhanghaoId+"账套不存在责任单位 "+responsibilityCompany);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
|
|
|
- String cCode=this.addOne(incidentTicketMapper.getMaxCode("cPBVCode","PurBillVouch","cmaketime"));
|
|
|
- incidentTicketMapper.updateVoucherHistoryCNumber(this.maxNumber(cCode),"2502");
|
|
|
|
|
|
- map.put("PBVID","2"+cCode);
|
|
|
- map.put("cPBVCode",cCode);
|
|
|
- if(businessType.equals("普通采购")){
|
|
|
- map.put("cPTCode","01");
|
|
|
- }else{
|
|
|
- map.put("cPTCode","02");
|
|
|
- }
|
|
|
- map.put("dPBVDate", DateUtils.getDate("yyyy-MM-dd"));
|
|
|
- map.put("cVenCode", "0001");
|
|
|
- map.put("cUnitCode", "0001");
|
|
|
- map.put("cexch_name", moneyType);
|
|
|
-
|
|
|
- map.put("cExchRate", 12.0);
|
|
|
- map.put("iPBVTaxRate", 0);
|
|
|
- if(StringUtils.isNotBlank(businessType)){
|
|
|
- map.put("cBusType", businessType);
|
|
|
+
|
|
|
+
|
|
|
+ * 主表
|
|
|
+ */
|
|
|
+ map.put("cPBVBillType","03");
|
|
|
+
|
|
|
+ map.put("iVTid", 131601);
|
|
|
+ if(businessType.equals("委外加工")){
|
|
|
+ map.put("cPTCode","02");
|
|
|
+ map.put("cBusType", "委外加工");
|
|
|
+ map.put("cSource", "委外");
|
|
|
+ }else if(businessType.equals("普通采购")){
|
|
|
+ map.put("cPTCode","01");
|
|
|
+ map.put("cBusType", "普通采购");
|
|
|
+ map.put("cSource", "采购");
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","业务类型有误 :"+businessType);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+ map.put("dPBVDate", DateUtils.getDate("yyyy-MM-dd"));
|
|
|
+ String cVenCode = responsibilityCompanyMap.get("cVenCode").toString();
|
|
|
+ map.put("cVenCode", cVenCode);
|
|
|
+ String cUnitCode = responsibilityCompanyMap.get("cVenCode").toString();
|
|
|
+ map.put("cUnitCode", cUnitCode);
|
|
|
+ map.put("cexch_name", moneyType);
|
|
|
+ map.put("cExchRate", exchangeRate);
|
|
|
+ map.put("iPBVTaxRate", 13);
|
|
|
+
|
|
|
+ map.put("cPBVMaker", sysUser.getRealname());
|
|
|
+
|
|
|
+ map.put("bOriginal", 0);
|
|
|
+ map.put("bFirst", 0);
|
|
|
+ map.put("iNetLock", 0);
|
|
|
+ map.put("cDefine2", planNumber);
|
|
|
+ map.put("dVouDate", accidentData);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ map.put("cDefine12", responsibilityCompany);
|
|
|
+ map.put("cDefine13", responsibilityCompany);
|
|
|
+ map.put("iDiscountTaxType",0);
|
|
|
+ map.put("bCredit",0);
|
|
|
+ String cVenAccount = "";
|
|
|
+ String cVenBank = "";
|
|
|
+ if(responsibilityCompanyMap.get("cVenAccount") != null){
|
|
|
+ cVenAccount = responsibilityCompanyMap.get("cVenAccount").toString();
|
|
|
+ }
|
|
|
+ if(responsibilityCompanyMap.get("cVenBank") != null){
|
|
|
+ cVenBank = responsibilityCompanyMap.get("cVenBank").toString();
|
|
|
+ }
|
|
|
+ map.put("cVenAccount",cVenAccount);
|
|
|
+ map.put("cVenBank",cVenBank);
|
|
|
+ map.put("iPrintCount",0);
|
|
|
+ String cVenContactCode = "";
|
|
|
+ String cVenPerson = "";
|
|
|
+ if(responsibilityCompanyMap.get("cVenContactCode") != null){
|
|
|
+ cVenContactCode = responsibilityCompanyMap.get("cVenContactCode").toString();
|
|
|
+ }
|
|
|
+ if(responsibilityCompanyMap.get("cVenPerson") != null){
|
|
|
+ cVenPerson = responsibilityCompanyMap.get("cVenPerson").toString();
|
|
|
+ }
|
|
|
+ map.put("cContactCode",cVenContactCode);
|
|
|
+ map.put("cVenPerson",cVenPerson);
|
|
|
+ map.put("IsWfControlled",0);
|
|
|
+
|
|
|
+ map.put("cmaketime",DateUtils.now());
|
|
|
+
|
|
|
+
|
|
|
+ * 子表
|
|
|
+ */
|
|
|
+ Map<String,Object> map2 = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ map2.put("cInvCode","N3000002424");
|
|
|
+ map2.put("bExBill",1);
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal sl = new BigDecimal("1.13");
|
|
|
+ BigDecimal hl = new BigDecimal(exchangeRate);
|
|
|
+
|
|
|
+ BigDecimal iOriMoney = new BigDecimal(practicalSum).divide(sl,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal iOriTaxPrice = new BigDecimal(practicalSum).subtract(iOriMoney);
|
|
|
+
|
|
|
+ BigDecimal iSum = new BigDecimal(practicalSum).multiply(hl);
|
|
|
+
|
|
|
+ BigDecimal iMoney = iSum.divide(sl,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal iTaxPrice = iSum.subtract(iMoney);
|
|
|
+
|
|
|
+ if(accidentType.equals("不涉及金额")){
|
|
|
+ map2.put("iOriMoney",0);
|
|
|
+ map2.put("iOriSum",0);
|
|
|
+ map2.put("iOriSum",0);
|
|
|
+ map2.put("iOriTaxPrice",0);
|
|
|
+ map2.put("iSum",0);
|
|
|
+ map2.put("iMoney",0);
|
|
|
+ map2.put("iTaxPrice",0);
|
|
|
+ }else if(accidentType.equals("扣款")){
|
|
|
+ map2.put("iOriMoney","-"+iOriMoney);
|
|
|
+ map2.put("iOriSum","-"+practicalSum);
|
|
|
+ map2.put("iOriTaxPrice","-"+iOriTaxPrice);
|
|
|
+ map2.put("iSum","-"+iSum);
|
|
|
+ map2.put("iMoney","-"+iMoney);
|
|
|
+ map2.put("iTaxPrice","-"+iTaxPrice);
|
|
|
+
|
|
|
+ }else if(accidentType.equals("应补")){
|
|
|
+ map2.put("iOriMoney",iOriMoney);
|
|
|
+ map2.put("iOriSum",practicalSum);
|
|
|
+ map2.put("iOriTaxPrice",iOriTaxPrice);
|
|
|
+ map2.put("iSum",iSum);
|
|
|
+ map2.put("iMoney",iMoney);
|
|
|
+ map2.put("iTaxPrice",iTaxPrice);
|
|
|
}else{
|
|
|
- map.put("cBusType", "普通采购");
|
|
|
+ resMap.put("msg","事故类型有误:"+accidentType);
|
|
|
+ return resMap;
|
|
|
}
|
|
|
|
|
|
- map.put("cPBVMaker", sysUser.getRealname());
|
|
|
- map.put("bNegative", 0);
|
|
|
- map.put("bOriginal", 0);
|
|
|
- map.put("bFirst", 0);
|
|
|
- map.put("iNetLock", 0);
|
|
|
- map.put("cDefine2", planNumber);
|
|
|
- map.put("dVouDate", accidentData);
|
|
|
- map.put("iVTid", "8167");
|
|
|
-
|
|
|
- map.put("cSource", businessType);
|
|
|
- map.put("cDefine12", factory);
|
|
|
- map.put("cDefine13", responsibilityCompany);
|
|
|
- map.put("iDiscountTaxType",0);
|
|
|
- map.put("bCredit",0);
|
|
|
- map.put("cVenAccount","1112333333333");
|
|
|
- map.put("cVenBank","中国银行");
|
|
|
- map.put("iPrintCount",0);
|
|
|
- map.put("cContactCode","0001");
|
|
|
- map.put("cVenPerson","同步");
|
|
|
- map.put("IsWfControlled",0);
|
|
|
+ map2.put("iTaxRate",13);
|
|
|
+ map2.put("ivouchrowno",1);
|
|
|
+
|
|
|
+ map2.put("bgift",0);
|
|
|
+
|
|
|
+ String cCode=this.addOne(incidentTicketMapper.getMaxCode("cPBVCode","PurBillVouch","cpbvcode"));
|
|
|
+ incidentTicketMapper.updateVoucherHistoryCNumber(this.maxNumber(cCode),"2502");
|
|
|
+
|
|
|
+ map.put("cPBVCode",cCode);
|
|
|
+ resMap.put("cCode",cCode);
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
sb.append("||puzl|");
|
|
|
sb.append(cCode);
|
|
|
map.put("csysbarcode",sb.toString());
|
|
|
- map.put("cmaketime",DateUtils.now());
|
|
|
+ map2.put("cbsysbarcode",sb.toString()+"|1");
|
|
|
+
|
|
|
+ int chId = incidentTicketMapper.getMaxCode2();
|
|
|
+ map.put("pbvid",chId+1);
|
|
|
+ incidentTicketMapper.insertPurBillVouch(map);
|
|
|
+
|
|
|
+ int chIds = incidentTicketMapper.getMaxCode3();
|
|
|
+ map2.put("pbvid",chId+1);
|
|
|
+ map2.put("id",chIds+1);
|
|
|
+ incidentTicketMapper.insertPurBillVouchs(map2);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ resMap.put("msg","同步数据有误,请联系管理员");
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ resMap.put("res","true");
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @DS("master3")
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Map<String,Object> propellingThree(IncidentTicket incidentTicket,IncidentTicketChildren children) {
|
|
|
+ Map<String,Object> resMap = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ resMap.put("res","false");
|
|
|
+
|
|
|
+ String accidentType = children.getAccidentType();
|
|
|
+ String accidentNumber = incidentTicket.getAccidentNumber();
|
|
|
+ map.put("cPBVMemo", accidentNumber);
|
|
|
+ if(accidentType.equals("不涉及金额")){
|
|
|
+ resMap.put("res","noneTrue");
|
|
|
+ return resMap;
|
|
|
+ }else if(accidentType.equals("扣款")){
|
|
|
+ map.put("bNegative", 1);
|
|
|
+
|
|
|
+ }else if(accidentType.equals("应补")){
|
|
|
+ map.put("bNegative", 0);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","事故类型有误:"+accidentType);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ String businessType = incidentTicket.getBusinessType();
|
|
|
+ String moneyType = incidentTicket.getMoneyType();
|
|
|
+ String accidentData = incidentTicket.getAccidentData();
|
|
|
+
|
|
|
+ String responsibilityCompany = incidentTicket.getResponsibilityCompany();
|
|
|
+
|
|
|
+ String exchangeRate = children.getExchangeRate();
|
|
|
+ String planNumber = children.getPlanNumber();
|
|
|
+ String practicalSum = children.getPracticalSum();
|
|
|
+ String zhanghaoId = children.getZhanghaoId();
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,Object> responsibilityCompanyMap = incidentTicketMapper.getVendor(responsibilityCompany);
|
|
|
+
|
|
|
+ if(responsibilityCompanyMap == null){
|
|
|
+ resMap.put("msg",zhanghaoId+"账套不存在责任单位 "+responsibilityCompany);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 主表
|
|
|
+ */
|
|
|
+ map.put("cPBVBillType","03");
|
|
|
+
|
|
|
+ map.put("iVTid", 8167);
|
|
|
+ if(businessType.equals("委外加工")){
|
|
|
+ map.put("cPTCode","02");
|
|
|
+ map.put("cBusType", "委外加工");
|
|
|
+ map.put("cSource", "委外");
|
|
|
+ }else if(businessType.equals("普通采购")){
|
|
|
+ map.put("cPTCode","01");
|
|
|
+ map.put("cBusType", "普通采购");
|
|
|
+ map.put("cSource", "采购");
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","业务类型有误 :"+businessType);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+ map.put("dPBVDate", DateUtils.getDate("yyyy-MM-dd"));
|
|
|
+ String cVenCode = responsibilityCompanyMap.get("cVenCode").toString();
|
|
|
+ map.put("cVenCode", cVenCode);
|
|
|
+ String cUnitCode = responsibilityCompanyMap.get("cVenCode").toString();
|
|
|
+ map.put("cUnitCode", cUnitCode);
|
|
|
+ map.put("cexch_name", moneyType);
|
|
|
+ map.put("cExchRate", exchangeRate);
|
|
|
+ map.put("iPBVTaxRate", 13);
|
|
|
|
|
|
+ map.put("cPBVMaker", sysUser.getRealname());
|
|
|
+ map.put("bOriginal", 0);
|
|
|
+ map.put("bFirst", 0);
|
|
|
+ map.put("iNetLock", 0);
|
|
|
+ map.put("cDefine2", planNumber);
|
|
|
+ map.put("dVouDate", accidentData);
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- * 子表
|
|
|
- */
|
|
|
- Map<String,Object> map2 = new HashMap<>();
|
|
|
+ map.put("cDefine12", responsibilityCompany);
|
|
|
+ map.put("cDefine13", responsibilityCompany);
|
|
|
+ map.put("iDiscountTaxType",0);
|
|
|
+ map.put("bCredit",0);
|
|
|
+ String cVenAccount = "";
|
|
|
+ String cVenBank = "";
|
|
|
+ if(responsibilityCompanyMap.get("cVenAccount") != null){
|
|
|
+ cVenAccount = responsibilityCompanyMap.get("cVenAccount").toString();
|
|
|
+ }
|
|
|
+ if(responsibilityCompanyMap.get("cVenBank") != null){
|
|
|
+ cVenBank = responsibilityCompanyMap.get("cVenBank").toString();
|
|
|
+ }
|
|
|
+ map.put("cVenAccount",cVenAccount);
|
|
|
+ map.put("cVenBank",cVenBank);
|
|
|
+ map.put("iPrintCount",0);
|
|
|
+ String cVenContactCode = "";
|
|
|
+ String cVenPerson = "";
|
|
|
+ if(responsibilityCompanyMap.get("cVenContactCode") != null){
|
|
|
+ cVenContactCode = responsibilityCompanyMap.get("cVenContactCode").toString();
|
|
|
+ }
|
|
|
+ if(responsibilityCompanyMap.get("cVenPerson") != null){
|
|
|
+ cVenPerson = responsibilityCompanyMap.get("cVenPerson").toString();
|
|
|
+ }
|
|
|
+ map.put("cContactCode",cVenContactCode);
|
|
|
+ map.put("cVenPerson",cVenPerson);
|
|
|
+ map.put("IsWfControlled",0);
|
|
|
+
|
|
|
+ map.put("cmaketime",DateUtils.now());
|
|
|
+
|
|
|
+
|
|
|
+ * 子表
|
|
|
+ */
|
|
|
+ Map<String,Object> map2 = new HashMap<>();
|
|
|
+
|
|
|
+ map2.put("cInvCode","N3000002424");
|
|
|
+ map2.put("bExBill",1);
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
|
|
|
- map2.put("pbvid",map.get("PBVID"));
|
|
|
- map2.put("cInvCode","N3000002424");
|
|
|
- map2.put("bExBill",1);
|
|
|
-
|
|
|
|
|
|
- map2.put("iOriMoney",practicalSum);
|
|
|
- map2.put("iOriSum",practicalSum);
|
|
|
- map2.put("iOriTaxPrice",0);
|
|
|
- map2.put("iMoney",practicalSum);
|
|
|
- map2.put("iSum",practicalSum);
|
|
|
- map2.put("iTaxPrice",practicalSum);
|
|
|
- map2.put("iTaxRate",0);
|
|
|
+ BigDecimal sl = new BigDecimal("1.13");
|
|
|
+ BigDecimal hl = new BigDecimal(exchangeRate);
|
|
|
+
|
|
|
+ BigDecimal iOriMoney = new BigDecimal(practicalSum).divide(sl,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal iOriTaxPrice = new BigDecimal(practicalSum).subtract(iOriMoney);
|
|
|
+
|
|
|
+ BigDecimal iSum = new BigDecimal(practicalSum).multiply(hl);
|
|
|
+
|
|
|
+ BigDecimal iMoney = iSum.divide(sl,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ BigDecimal iTaxPrice = iSum.subtract(iMoney);
|
|
|
+
|
|
|
+ if(accidentType.equals("不涉及金额")){
|
|
|
+ map2.put("iOriMoney",0);
|
|
|
+ map2.put("iOriSum",0);
|
|
|
+ map2.put("iOriSum",0);
|
|
|
+ map2.put("iOriTaxPrice",0);
|
|
|
+ map2.put("iSum",0);
|
|
|
+ map2.put("iMoney",0);
|
|
|
+ map2.put("iTaxPrice",0);
|
|
|
+ }else if(accidentType.equals("扣款")){
|
|
|
+ map2.put("iOriMoney","-"+iOriMoney);
|
|
|
+ map2.put("iOriSum","-"+practicalSum);
|
|
|
+ map2.put("iOriTaxPrice","-"+iOriTaxPrice);
|
|
|
+ map2.put("iSum","-"+iSum);
|
|
|
+ map2.put("iMoney","-"+iMoney);
|
|
|
+ map2.put("iTaxPrice","-"+iTaxPrice);
|
|
|
+
|
|
|
+ }else if(accidentType.equals("应补")){
|
|
|
+ map2.put("iOriMoney",iOriMoney);
|
|
|
+ map2.put("iOriSum",practicalSum);
|
|
|
+ map2.put("iOriTaxPrice",iOriTaxPrice);
|
|
|
+ map2.put("iSum",iSum);
|
|
|
+ map2.put("iMoney",iMoney);
|
|
|
+ map2.put("iTaxPrice",iTaxPrice);
|
|
|
+ }else{
|
|
|
+ resMap.put("msg","事故类型有误:"+accidentType);
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ map2.put("iTaxRate",13);
|
|
|
map2.put("ivouchrowno",1);
|
|
|
- map2.put("cbsysbarcode",sb.toString()+"|1");
|
|
|
+
|
|
|
map2.put("bgift",0);
|
|
|
|
|
|
+ String cCode=this.addOne(incidentTicketMapper.getMaxCode("cPBVCode","PurBillVouch","cpbvcode"));
|
|
|
+ incidentTicketMapper.updateVoucherHistoryCNumber(this.maxNumber(cCode),"2502");
|
|
|
+
|
|
|
+ map.put("cPBVCode",cCode);
|
|
|
+ resMap.put("cCode",cCode);
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append("||puzl|");
|
|
|
+ sb.append(cCode);
|
|
|
+ map.put("csysbarcode",sb.toString());
|
|
|
+ map2.put("cbsysbarcode",sb.toString()+"|1");
|
|
|
+
|
|
|
+ int chId = incidentTicketMapper.getMaxCode2();
|
|
|
+ map.put("pbvid",chId+1);
|
|
|
incidentTicketMapper.insertPurBillVouch(map);
|
|
|
+
|
|
|
+ int chIds = incidentTicketMapper.getMaxCode3();
|
|
|
+ map2.put("pbvid",chId+1);
|
|
|
+ map2.put("id",chIds+1);
|
|
|
incidentTicketMapper.insertPurBillVouchs(map2);
|
|
|
|
|
|
- children.setU8Invoice(cCode);
|
|
|
- incidentTicketChildrenMapper.updateById(children);
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ resMap.put("msg","同步数据有误,请联系管理员");
|
|
|
+ return resMap;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- incidentTicket.setState("4");
|
|
|
- incidentTicket.setUpdateBy(sysUser.getUsername());
|
|
|
- incidentTicket.setUpdateTime(new Date());
|
|
|
- incidentTicketMapper.updateById(incidentTicket);
|
|
|
- return Result.ok("已推送");
|
|
|
+ resMap.put("res","true");
|
|
|
+ return resMap;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -362,7 +710,7 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
|
|
|
for(String o:idList){
|
|
|
|
|
|
- sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),o,"质量事故单",code+" "+title, CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),o,"质量事故单 "+code,code+" "+title, CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
IncidentTicketMsg incidentTicketMsg = new IncidentTicketMsg();
|
|
|
LoginUser loginUser = sysBaseAPI.getUserByName(o);
|
|
|
incidentTicketMsg.setPkIncidentTicket(headId);
|
|
@@ -422,13 +770,13 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(!isAuth){
|
|
|
- return Result.error("您无权操作此事故单");
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
HashMap<String,Object> taskParam = new HashMap<>();
|
|
|
|
|
|
- sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),"T0008","质量事故单",code+" "+title+" 财务对单人已处理完毕;", CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),"T0008","质量事故单 "+code,code+" "+title+" 财务对单人已处理完毕;", CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
|
|
|
|
|
|
|