Commit 8b618757 by 熊智

优化

parent 4a1b996b
......@@ -45,8 +45,8 @@ public class FundPoolBranchOfArLoacl extends FundPoolBranchBase {
" ServeProject.FNumber = '" + DCConstant.serviceProjectdfGoodAmount + "' or " +//代付货款
" ServeProject.FNumber = '" + DCConstant.serviceProjectdfGoodDIffAmount + "' or " +//代付差异
" ServeProject.FNumber = '" + DCConstant.serviceProjectGoodAmount + "' or " +//货值
" ServeProject.FNumber = '" + DCConstant.serviceProjectInvoiceDIffAmount + "' or " +//开票费差
" ServeProject.FNumber = '" + DCConstant.serviceProjectdfkGoodAmount + "'" +//垫付货款
" ServeProject.FNumber = '" + DCConstant.serviceProjectInvoiceDIffAmount + "' " +//开票费差
// " ServeProject.FNumber = '" + DCConstant.serviceProjectdfkGoodAmount + "'" +//垫付货款
" )");
where.append("\n or (" +
" ServeProject.FGroup = '" + serviceGroup.FEIGHT_VALUE + "' " +
......
package com.kingdee.eas.hse.scm.planandorder.app;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
......@@ -26,7 +18,6 @@ import java.util.regex.Pattern;
import javax.sql.RowSet;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
......@@ -38,8 +29,6 @@ import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.ormapping.IORMappingDAO;
import com.kingdee.bos.dao.ormapping.ORMappingDAO;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.bot.BOTMappingCollection;
import com.kingdee.bos.metadata.bot.BOTMappingFactory;
......@@ -71,31 +60,14 @@ import com.kingdee.eas.base.btp.app.BOTAppTools;
import com.kingdee.eas.base.codingrule.CodingRuleInfo;
import com.kingdee.eas.base.codingrule.CodingRuleManagerFactory;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.basedata.assistant.CityFactory;
import com.kingdee.eas.basedata.assistant.CityInfo;
import com.kingdee.eas.basedata.assistant.CurrencyFactory;
import com.kingdee.eas.basedata.assistant.CurrencyInfo;
import com.kingdee.eas.basedata.assistant.ICity;
import com.kingdee.eas.basedata.assistant.IRegion;
import com.kingdee.eas.basedata.assistant.MeasureUnitCollection;
import com.kingdee.eas.basedata.assistant.MeasureUnitFactory;
import com.kingdee.eas.basedata.assistant.MeasureUnitInfo;
import com.kingdee.eas.basedata.assistant.ProvinceFactory;
import com.kingdee.eas.basedata.assistant.ProvinceInfo;
import com.kingdee.eas.basedata.assistant.RegionFactory;
import com.kingdee.eas.basedata.assistant.RegionInfo;
import com.kingdee.eas.basedata.framework.DataBaseDAssignFactory;
import com.kingdee.eas.basedata.framework.DataBaseDAssignInfo;
import com.kingdee.eas.basedata.framework.DataStateEnum;
import com.kingdee.eas.basedata.master.cssp.CustomerInfo;
import com.kingdee.eas.basedata.master.cssp.CustomerKindEnum;
import com.kingdee.eas.basedata.master.cssp.CustomerLinkManCollection;
import com.kingdee.eas.basedata.master.cssp.CustomerLinkManFactory;
import com.kingdee.eas.basedata.master.cssp.CustomerLinkManInfo;
import com.kingdee.eas.basedata.master.cssp.CustomerSaleInfoFactory;
import com.kingdee.eas.basedata.master.cssp.CustomerSaleInfoInfo;
import com.kingdee.eas.basedata.master.cssp.ICustomerLinkMan;
import com.kingdee.eas.basedata.master.cssp.ICustomerSaleInfo;
import com.kingdee.eas.basedata.master.material.AccountType;
import com.kingdee.eas.basedata.master.material.CalculateTypeEnum;
import com.kingdee.eas.basedata.master.material.CustomsDeterminesEnum;
......@@ -127,17 +99,12 @@ import com.kingdee.eas.basedata.org.FullOrgUnitFactory;
import com.kingdee.eas.camel.XZUtil;
import com.kingdee.eas.camel.app.XZAppUtil;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.newbill.GoodsRecepitCollection;
import com.kingdee.eas.custom.newbill.GoodsRecepitFactory;
import com.kingdee.eas.custom.newbill.HproseDockingFacadeFactory;
import com.kingdee.eas.custom.newbill.IchuntCustomTaskFacadeFactory;
import com.kingdee.eas.custom.newbill.InventoryManagementFacadeFactory;
import com.kingdee.eas.framework.CoreBillBaseCollection;
import com.kingdee.eas.framework.CoreBillBaseInfo;
import com.kingdee.eas.hse.ichunt_parameter;
import com.kingdee.eas.hse.basedata.CHMeasureUnitInfo;
import com.kingdee.eas.hse.basedata.ISysParameter;
import com.kingdee.eas.hse.basedata.SysParameterCollection;
import com.kingdee.eas.hse.basedata.SysParameterFactory;
import com.kingdee.eas.hse.basedata.SysParameterInfo;
import com.kingdee.eas.hse.common.HSEBillStatusEnum;
import com.kingdee.eas.hse.common.Resource;
......@@ -155,7 +122,6 @@ import com.kingdee.eas.hse.scm.HSEExchangeRateInfo;
import com.kingdee.eas.hse.scm.IFetchNumber;
import com.kingdee.eas.hse.scm.PurOrderException;
import com.kingdee.eas.hse.scm.forExRate;
import com.kingdee.eas.hse.scm.business.PrincipalFactory;
import com.kingdee.eas.hse.scm.business.PrincipalInfo;
import com.kingdee.eas.hse.scm.business.TFProtocolEntryInfo;
import com.kingdee.eas.hse.scm.logisticsmanagement.OrderingBillDeliveryAddrFactory;
......@@ -167,23 +133,26 @@ import com.kingdee.eas.hse.scm.planandorder.EntrustBillClassifyEntryInfo;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillCollection;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillEntryCollection;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillEntryInfo;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillExFactory;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillExInfo;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillFactory;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillInfo;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillTDeliEntryFactory;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillTLoadEntryFactory;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillTabStatusEnum;
import com.kingdee.eas.hse.scm.planandorder.GoodsPayType;
import com.kingdee.eas.hse.scm.planandorder.IEntrustBillEx;
import com.kingdee.eas.hse.scm.planandorder.InternalCostBillFactory;
import com.kingdee.eas.hse.scm.planandorder.client.CdityClassfyEnum;
import com.kingdee.eas.hse.scm.purchasemanager.IPurcharseOrder;
import com.kingdee.eas.hse.scm.purchasemanager.IPurchaseInWoreHouse;
import com.kingdee.eas.hse.scm.purchasemanager.PurcharseOrderFactory;
import com.kingdee.eas.hse.scm.purchasemanager.PurcharseOrderInfo;
import com.kingdee.eas.hse.scm.purchasemanager.PurchaseInWoreHouseFactory;
import com.kingdee.eas.hse.scm.purchasemanager.PurchaseInWoreHouseInfo;
import com.kingdee.eas.hse.scm.salemanager.PostRequistionBillFactory;
import com.kingdee.eas.hse.scm.salemanager.PostRequistionBillInfo;
import com.kingdee.eas.hse.scm.service.Command;
import com.kingdee.eas.hse.scm.service.IScsfundPool;
import com.kingdee.eas.hse.scm.service.ScsfundPoolFactory;
import com.kingdee.eas.hse.scm.service.ScsfundPoolInfo;
import com.kingdee.eas.hse.scm.settlemanager.FeightManagerEntryFactory;
import com.kingdee.eas.hse.scm.warehousemanager.InWoreHouseRegisterCommodityInfoFactory;
import com.kingdee.eas.hse.scm.warehousemanager.InWoreHouseRegisterCommodityInfoInfo;
......@@ -193,10 +162,6 @@ import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;
import com.kingdee.util.NumericExceptionSubItem;
import com.kingdee.util.StringUtils;
import com.kingdee.util.db.SQLUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.MessageProperties;
public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean {
private static int activeServiceFlag = 3;
......@@ -472,185 +437,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
}
/**
* 校验客户企业性质
*
* @param ctx
* @param info
* @author xiongzhi
* @throws EASBizException
* @throws BOSException
* @date 2023-1-6 上午10:21:22
*/
private void checkCompanyNature(Context ctx, EntrustBillInfo info) throws EASBizException, BOSException {
CustomerInfo customerInfo = info.getCustomer();
CustomerKindEnum customerKind = customerInfo.getCustomerKind();
if (UIRuleUtil.isNull(customerKind) || CustomerKindEnum.other.equals(customerKind)) {
throw XZAppUtil.diyEASBizException("SCM系统 客户[" + customerInfo.getName() + "]企业性质为其他或为空!!!");
}
PrincipalInfo principal = info.getPrincipal();
principal = (PrincipalInfo) XZAppUtil.getValue(ctx, principal.getString("id"), XZUtil.getSeletor("id", "name", "entType.*"));
SysParameterInfo entType = principal.getEntType();
if (UIRuleUtil.isNull(entType) || !customerKind.getAlias().equals(entType.getName())) {
SysParameterCollection coll2 = SysParameterFactory.getLocalInstance(ctx).getSysParameterCollection("where treeid.number = 'CompN0006' and name = '" + customerKind.getAlias() + "'");
if (coll2.size() > 0) {
entType = coll2.get(0);
principal.setEntType(entType);
PrincipalFactory.getLocalInstance(ctx).updatePartial(principal, XZUtil.getSeletor("entType"));
}
}
info.setCustomerType(entType);
}
/**
* @param ctx
* @param info
* @author xiongzhi
* @throws BOSException
* @throws EASBizException
* @date 2022-5-30 下午03:56:15
*/
private void checkAddress(Context ctx, EntrustBillInfo info) throws BOSException, EASBizException {
String sourceBillId = info.getId().toString();
String oql = "where description = '" + sourceBillId + "'";
IEntrustBillEx iEntrustBillEx = EntrustBillExFactory.getLocalInstance(ctx);
if (iEntrustBillEx.exists(oql)) {
EntrustBillExInfo entrustBillExInfo = iEntrustBillEx.getEntrustBillExInfo(oql);
// 省份
String provinces = entrustBillExInfo.getProvinces();
// 城市
String city = entrustBillExInfo.getCity();
// 区域
String county = entrustBillExInfo.getCounty();
// 获取省市区
if (!StringUtils.isEmpty(provinces)) {
if (!ProvinceFactory.getLocalInstance(ctx).exists("where name like '" + provinces + "%'")) {
throw XZAppUtil.diyEASBizException("发货地址省份: " + provinces + "不存在,请先在省份基础资料中维护!");
}
}
// 获取城市
if (!StringUtils.isEmpty(city)) {
if (!CityFactory.getLocalInstance(ctx).exists("where name like '" + city + "%'")) {
throw XZAppUtil.diyEASBizException("发货地址城市: " + city + "不存在,请先在城市基础资料中维护!");
}
}
// 获取区县
if (!StringUtils.isEmpty(county)) {
if (!RegionFactory.getLocalInstance(ctx).exists("where name like '" + county + "%'")) {
throw XZAppUtil.diyEASBizException("发货地址区县: " + county + "不存在,请先在区县基础资料中维护!");
}
}
}
}
/**
* 合并分录
*
* @param info
* @author xiongzhi
* @date 2021-1-20 下午02:46:14
*/
private void mergeEntry(EntrustBillInfo info) {
EntrustBillClassifyEntryCollection classifyEntrys = info.getClassifyEntrys();
LinkedHashMap<String, ArrayList<EntrustBillClassifyEntryInfo>> map = new LinkedHashMap<String, ArrayList<EntrustBillClassifyEntryInfo>>();
for (int i = 0, size = classifyEntrys.size(); i < size; i++) {
EntrustBillClassifyEntryInfo classifyEntry = classifyEntrys.get(i);
// 自动合并同品牌、型号、产地 和 单价分录
SysParameterInfo country = classifyEntry.getCountryOforigins();
// 卖出价
BigDecimal sellingRate = classifyEntry.getSellingRate();
sellingRate = DCUtil.emptyToValue(sellingRate, BigDecimal.ZERO);
String key = "";
if (UIRuleUtil.isNotNull(country)) {
key = classifyEntry.getManufacturer() + "##" + classifyEntry.getModel() + "##" + country.getId() + "##" + classifyEntry.getPrice2().setScale(12) + "##" + sellingRate.setScale(12);
} else {
key = classifyEntry.getManufacturer() + "##" + classifyEntry.getModel() + "##" + classifyEntry.getPrice2().setScale(12) + "##" + sellingRate.setScale(12);
}
if (map.containsKey(key)) {
ArrayList<EntrustBillClassifyEntryInfo> list = map.get(key);
list.add(classifyEntry);
} else {
ArrayList<EntrustBillClassifyEntryInfo> list = new ArrayList<EntrustBillClassifyEntryInfo>();
list.add(classifyEntry);
map.put(key, list);
}
}
if (!map.isEmpty()) {
int seq = 1;
info.getClassifyEntrys().clear();
for (String key : map.keySet()) {
ArrayList<EntrustBillClassifyEntryInfo> list = map.get(key);
if (list.size() == 1) {
EntrustBillClassifyEntryInfo classifyEntry = list.get(0);
classifyEntry.setSeq(seq);
info.getClassifyEntrys().add(classifyEntry);
} else {
EntrustBillClassifyEntryInfo classifyEntry = null;
BigDecimal qty = BigDecimal.ZERO;
BigDecimal amt = BigDecimal.ZERO;
BigDecimal purQty = BigDecimal.ZERO;
BigDecimal totalSellingRate = BigDecimal.ZERO;
for (int i = 0, size = list.size(); i < size; i++) {
EntrustBillClassifyEntryInfo tempEntry = list.get(i);
if (0 == i) {
classifyEntry = tempEntry;
}
qty = qty.add(tempEntry.getQty2());
amt = amt.add(tempEntry.getAmount2());
purQty = purQty.add(DCUtil.emptyToValue(tempEntry.getPurQty(), BigDecimal.ZERO));
totalSellingRate = totalSellingRate.add(DCUtil.emptyToValue(tempEntry.getTotalSellingRate(), BigDecimal.ZERO));
}
classifyEntry.setQty(qty);
classifyEntry.setQty2(qty);
classifyEntry.setAmount(amt);
classifyEntry.setAmount2(amt);
classifyEntry.setNoPurQty(qty);
classifyEntry.setNoReceiptQty(qty);
classifyEntry.setNoDeliveryQty(qty);
classifyEntry.setPurQty(purQty);
classifyEntry.setSeq(seq);
classifyEntry.setTotalSellingRate(totalSellingRate);
info.getClassifyEntrys().add(classifyEntry);
}
seq++;
}
}
}
/**
* @param ctx
* @param info
* @author xiongzhi
* @throws BOSException
* @throws EASBizException
* @date 2020-9-14 下午04:32:16
*/
private void checkMaterial2(Context ctx, EntrustBillInfo info) throws BOSException, EASBizException {
PrincipalInfo principal = info.getPrincipal();
String entrustNo = info.getNumber();
EntrustBillClassifyEntryCollection entrys = info.getClassifyEntrys();
for (int i = 0; i < entrys.size(); i++) {
EntrustBillClassifyEntryInfo entry = entrys.get(i);
MaterialInfo materialInfo = entry.getMaterial();
String model = entry.getModel();
materialInfo = (MaterialInfo) XZAppUtil.getValue(ctx, materialInfo.getString("id"));
// if (!"深圳市猎芯科技有限公司".equals(principal.getName())) {
// if (entrustNo.startsWith("A")) {
// if (EccnCheckUtil.checkAOrderEccnControl(ctx, model)) {
// throw XZAppUtil.diyEASBizException("第" + (i + 1) + "行分录 型号 属于管制品");
// }
// } else {
// if (EccnCheckUtil.checkEccnControl(ctx, model)) {
// throw XZAppUtil.diyEASBizException("第" + (i + 1) + "行分录 型号 属于管制品");
// }
// }
// }
if (!model.equals(materialInfo.getModel())) {
throw XZAppUtil.diyEASBizException("第" + (i + 1) + "行分录 型号 与 物料编码 不匹配!");
}
}
}
/**
* @author xiongzhi
* @throws BOSException
* @throws SQLException
......@@ -1110,44 +896,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
}
/**
* 检查整理后报关数量不能大于商检数量
*
* @param ctx
* @param model
* @throws EASBizException
* @throws BOSException
*/
// private void checkQty(Context ctx, IObjectValue model)
// throws EASBizException, BOSException {
// EntrustBillInfo info = (EntrustBillInfo)model;
// String id = info.getId().toString();
//
// StringBuffer sql = new StringBuffer();
// sql.append(" select re.fseq ");
// sql.append(" from CT_PDA_EntrustBRE re ");
// sql.append(" where re.fparentid = '" + id + "' ");
// sql.append(" and isnull(re.CFQty, 0) < isnull(re.CFQty2, 0) ");
// sql.append(" and isnull(re.CFIsInsp, 0) = 1 ");
//
// try {
// IRowSet rs = DbUtil.executeQuery(ctx, sql.toString());
// if (rs != null && rs.size() > 0){
// ArrayList<String> list = new ArrayList<String>();
// while (rs.next()){
// list.add(String.valueOf(rs.getInt("fseq")));
// }
//
// throw new EASBizException(new NumericExceptionSubItem("0xF1000080",
// Resource.getString("0xF1000080", StringUtils.join(list.iterator(),
// ","))));
// }
// } catch (SQLException e) {
// e.printStackTrace();
// throw new EASBizException(new NumericExceptionSubItem("0xF1000079",
// Resource.getString("0xF1000079")));
// }
// }
/**
* 检查整理后报关单价不能大于整理前的报关单价
*
* @param ctx
......@@ -1654,7 +1402,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
* @throws EASBizException
*/
private void doTriggerAction2(Context ctx, IObjectPK pk, IObjectValue model, EntrustBillTabStatusEnum action) throws BOSException, EASBizException {
EntrustBillInfo info = (EntrustBillInfo) model;
info.setStatusOfTruck(action);
......@@ -1686,7 +1433,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
info.setStatusOfPricing(action);
EntrustBillClassifyEntryCollection entrys = info.getClassifyEntrys();
/* List<CurrencyInfo> listCurrency=new ArrayList<CurrencyInfo>(); */
Boolean b = info.isPreSaleContract();
if (b) {
......@@ -1958,16 +1704,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
filter.getFilterItems().add(new FilterItemInfo("parent", id, CompareType.EQUALS));
EntrustBillTDeliEntryFactory.getLocalInstance(ctx).delete(filter);
// EntrustBillTDeliEntryCollection entrys = editData.getTDeliEntrys();
// for (int i = 0; i < entrys.size(); i++) {
// EntrustBillTDeliEntryInfo entry = entrys.get(i);
// if (entry.getId() == null) {
// entry.setId(BOSUuid.create("8750C065"));
// }
// entry.setParent(editData);
// entry.setSeq(i + 1);
// EntrustBillTDeliEntryFactory.getLocalInstance(ctx).save(entry);
// }
// 同步到订车单
ArrayList<String> orderingBillIDs = new ArrayList<String>();
......@@ -1991,37 +1727,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
FilterInfo filter2 = new FilterInfo();
filter2.getFilterItems().add(new FilterItemInfo("parent", tid, CompareType.EQUALS));
OrderingBillDeliveryAddrFactory.getLocalInstance(ctx).delete(filter2);
// EntrustBillTDeliEntryCollection entruEntryColl =
// editData.getTDeliEntrys();
// for (int i = 0, l = entruEntryColl.size(); i < l; i++) {
// EntrustBillTDeliEntryInfo info = entruEntryColl.get(i);
//
// // 填充数据
// OrderingBillDeliveryAddrInfo item = new
// OrderingBillDeliveryAddrInfo();
// item.setId(BOSUuid.create("F1AECBEF"));
// item.setParent(orderingBillInfo);
// item.setSeq(i + 1);
// item.setOrigBillEntryId(info.getOrigBillEntryId());
// item.setSourceBillEntryId(info.getId().toString());
// item.setSourceBillId(id);
// item.setWGFile(info.getEnclosedFile());
// item.setSo(info.getSo());
// item.setRemark(info.getRemarks());
// item.setClosingStorehouseTime(info.getLastStorageTime());
// item.setContactWay(info.getContactType());
// item.setContactor(info.getContactor());
// item.setAddress(info.getAddress());
// item.setPackagesNum(info.getPackages());
// item.setCardQty(info.getCardQty());
// item.setWeight(info.getWeight());
// item.setShippingMark(info.getShippingMark());
//
// // orderEntryColl.add(item);
// OrderingBillDeliveryAddrFactory.getLocalInstance(ctx).save(item
// );
// }
}
}
......@@ -2041,12 +1746,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
filter.getFilterItems().add(new FilterItemInfo("parent", id, CompareType.EQUALS));
EntrustBillTLoadEntryFactory.getLocalInstance(ctx).delete(filter);
// EntrustBillTLoadEntryCollection entrys = editData.getTLoadEntrys();
// for (int i = 0; i < entrys.size(); i++) {
// EntrustBillTLoadEntryInfo entry = entrys.get(i);
// EntrustBillTLoadEntryFactory.getLocalInstance(ctx).save(entry);
// }
StringBuffer sql = new StringBuffer();
sql.append("/*dialect*/\n update CT_LM_OrderingBTLI A set ");
sql.append("\n (A.CFLoadingTime) = ");
......@@ -2116,144 +1815,12 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
// updateJYZXPurOrderData(ctx, info);
deleteInnerDeductionCostBill(ctx, pk.toString());
// 同步更新平台订单状态
updatePTOrder(ctx, info);
// 同步删除采购系统订单记录
synPurSystem(ctx, info);
String log = XZAppUtil.getUserInfo(ctx).getName() + XZUtil.formatDate(new Date()) + "操作单号:" + info.getNumber();
XZUtil.logInfo("委托单", "删除", "info", entrustBillLogger, log, getJsonString(info));
}
/**
* @param ctx
* @param number
* @author xiongzhi
* @throws BOSException
* @date 2022-12-6 下午01:52:03
*/
private void synPurSystem(Context ctx, EntrustBillInfo info) throws BOSException {
JSONObject mq_data = new JSONObject();
mq_data.put("queue_name", "lie_queue_pur");
mq_data.put("__from", "供应链系统");// 消息来源,后续用来追踪消息从哪里发出的
mq_data.put("__insert_time", new Date().getTime());// 消息插入时间
mq_data.put("__route_key", "/sync/scmOrder/deleteScmOrder");
mq_data.put("__uk", info.getString("id"));
mq_data.put("__type", "http");
mq_data.put("__search_key", "委托单(" + info.getNumber() + ")");
JSONObject json = new JSONObject();
json.put("warehouse_receipt_sn", info.getNumber());
mq_data.put("data", json);
sendPurData2MQ(ctx, "synCSBaseData", mq_data.toJSONString(), "lie_queue_pur");
}
/**
* 推送库存数据
*
* @throws BOSException
* @throws IOException
*/
private void sendPurData2MQ(Context ctx, String mqKey, String json, String QUEUE_NAME) throws BOSException {
com.rabbitmq.client.Connection connection = null;
Channel channel = null;
ConnectionFactory factory = new ConnectionFactory();
initFactory(ctx, mqKey, factory);
try {
connection = factory.newConnection();
channel = connection.createChannel();
channel.basicPublish("", QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, StringEscapeUtils.escapeJava(json).replaceAll("\\\\\"", "\"").getBytes());
} catch (IOException e) {
logger.error("推送客商数据至一体化失败(" + json + "),失败原因:" + e.getMessage());
throw new BOSException(e);
} finally {
try {
channel.close();
connection.close();
} catch (IOException e) {
logger.error("推送客商数据至一体化失败(" + json + "),失败原因:" + e.getMessage());
throw new BOSException(e);
}
}
}
/**
* @param factory
* @param mqKey
* @author xiongzhi
* @date 2020-4-13 上午11:26:29
*/
private void initFactory(Context ctx, String mqKey, ConnectionFactory factory) {
String value = DCUtil.getInitSysValueByParamNumber(ctx, mqKey);
String[] values = value.split(";");
factory.setHost(values[0].trim());
factory.setPort(Integer.parseInt(values[1].trim()));
factory.setUsername(values[2].trim());
factory.setPassword(values[3].trim());
}
/**
* 同步更新平台订单状态
*
* @param ctx
* @param info
* @author xiongzhi
* @throws BOSException
* @throws EASBizException
* @date 2020-7-20 上午09:53:20
*/
private void updatePTOrder(Context ctx, EntrustBillInfo info) throws BOSException, EASBizException {
if ("true".equals(DCUtil.getInitSysValueByParamNumber(ctx, "synPTOrderDeleteStatus"))) {
JSONObject json = new JSONObject();
String ptId = info.getPtid();
json.put("id", ptId);
json.put("erpId", info.getString("id"));
HashMap rs = HproseDockingFacadeFactory.getLocalInstance(ctx).pubRunConnHp("", json.toJSONString(), "erpPullDeletectOrder");
if (rs.containsKey("4444")) {
throw XZAppUtil.diyEASBizException((String) rs.get("4444"));
}
}
}
/**
* @author xiongzhi
* @param ctx
* @param info
* @throws EASBizException
* @date 2019-6-14 上午11:32:34
* @description 更新交易中心系统对应可能存在的采购订单的下游标识记录
*/
// private void updateJYZXPurOrderData(Context ctx, EntrustBillInfo info) throws EASBizException {
// String sourceBillType = info.getSourceBillType();
// if ("JYZX_PURORDER".equals(sourceBillType)) {// 该委托单 来源 于 交易中 的 采购订单
// String id = info.getString("id");
// logger.info("更新委托单(" + info.getNumber() + ")相对应的交易中心平台的采购订单标识记录!");
// // 调用交易中心接口 反写 采购订单 对应 供应链平台 委托单记录
// JSONObject json = new JSONObject();
// json.put("TYPE", "purOrder");// 采购订单
// json.put("ENTRUSTBILLID", id);
// // 先调用交易中心的登录接口方法
// String addressAndPort = DCUtil.getInitSysValueByParamNumber(ctx, "ws05");
// String loginStr = DCUtil.getInitSysValueByParamNumber(ctx, "ws06");
// String[] logins = loginStr.split(",");
// Object[] loginInfo = { logins[0].trim(), logins[1].trim(), logins[2].trim(), logins[3].trim(), logins[4].trim(), Integer.parseInt(logins[5].trim()), logins[6].trim() };
// try {
// WSContext context = CAWebServiceUtils.loginEAS(addressAndPort, loginInfo);
// if (!StringUtils.isEmpty(context.getSessionId())) {
// String urlname = addressAndPort + "/ormrpc/services/WSWebServiceBySCMFacade?wsdl";
// String rs = CAWebServiceUtils.invoke(urlname, "updateObject", json.toJSONString());
// JSONObject rsJson = JSONObject.parseObject(rs);
// if (rsJson.containsKey(CAWebServiceUtils.failCode)) {
// throw new BOSException("委托单(" + info.getNumber() + ") " + rsJson.getString(CAWebServiceUtils.failCode));
// }
// }
// // logger.info("委托单(" + info.getNumber() + ")相对应的交易中心平台的采购订单标识记录完毕!");
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("调用交易中心接口失败,原因:" + e.getMessage());
// throw new EASBizException(new NumericExceptionSubItem("0xE0000012", "\n交易中心接口调用失败,原因:" + e.getMessage()));
// }
// }
// }
/**
* 删除内扣成本
*
* @param ctx
......@@ -2287,7 +1854,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
if (isRel) {
throw new EASBizException(new NumericExceptionSubItem("0xE0000012", "提示:委托单已做费用确认单,不允许删除!"));
}
}
/**
......@@ -2344,31 +1910,7 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
}
/**
* 平台订单都要生成发货通知单
*
* @param ctx
* @param model
* @author xiongzhi
* @throws BOSException
* @throws EASBizException
* @date 2021-6-17 下午02:31:41
*/
private void generateReqDeliveryBill(Context ctx, EntrustBillInfo info) throws BOSException, EASBizException {
String sourceBillId = info.getId().toString();
String oql = "where description = '" + sourceBillId + "' and hkDeliveryType = '上门代提货'";
IEntrustBillEx iEntrustBillEx = EntrustBillExFactory.getLocalInstance(ctx);
if (iEntrustBillEx.exists(oql)) {
String botMappingNumber = "THPC_001";
try {
DCCallBotpUtil.doBotpWithBOTPNumber(ctx, info, botMappingNumber);
} catch (Exception e) {
throw XZAppUtil.diyEASBizException(e.getMessage());
}
}
}
/**
* 生成深圳发货通知单 (只有收货信息不为空的平台执行采购订单才允许生成)
* 生成深圳发货通知单 (国采)
*
* @param ctx
* @param srcBill
......@@ -2380,145 +1922,14 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
if (HSEBillStatusEnum.AUDITED.equals(entrustInfo.getBillStatus())) {// 已审核装填
TFProtocolEntryInfo tfeInfo = entrustInfo.getBussPlan();
String number = tfeInfo.getBussExPlan().getNumber();
if (null != number && !"".equals(number) && number.contains("ASI")) {// 执行采购
String oql = "select * where entrustBillNumber='" + srcBill.getNumber() + "'";
GoodsRecepitCollection receiptCol = GoodsRecepitFactory.getLocalInstance(ctx).getGoodsRecepitCollection(oql);
if (receiptCol == null || receiptCol.size() <= 0 || receiptCol.get(0) == null) {// 收货信息不为空才允许生成发货通知单
return;
}
String botMappingNumber = "LX-01-006copy";// 执行采购生成深圳发货通知单
if (null != number && !"".equals(number) && number.contains("ACI")) {// 普通采购
String botMappingNumber = "LX-13-006";// 生成深圳发货通知单
try {
BTPTransformResult result = DCCallBotpUtil.doBotpWithBOTPNumber(ctx, srcBill, botMappingNumber);
if (result != null) {
IObjectCollection destBillCol = result.getBills();
PostRequistionBillInfo post = (PostRequistionBillInfo) destBillCol.getObject(0);
IEntrustBillEx iEntrustBillEx = EntrustBillExFactory.getLocalInstance(ctx);
String sourceBillId = srcBill.getId().toString();
oql = "where description = '" + sourceBillId + "'";
if (iEntrustBillEx.exists(oql)) {
EntrustBillExInfo entrustBillExInfo = iEntrustBillEx.getEntrustBillExInfo(oql);
// 联系人
String contact = entrustBillExInfo.getContact2();
// 手机
String mobile = entrustBillExInfo.getMobile2();
// 电话
String landline = entrustBillExInfo.getLandline();
// 地址
String address = entrustBillExInfo.getAddress3();
// 收货方
String areaAddress = entrustBillExInfo.getAreaAddress();
// 平台地址ID
String addressID = entrustBillExInfo.getPTAddressID();
// 省份
String provinces = entrustBillExInfo.getProvinces();
// 城市
String city = entrustBillExInfo.getCity();
// 区域
String county = entrustBillExInfo.getCounty();
// 地址最后更新时间
Timestamp lastUpdateTime = entrustBillExInfo.getPTAddressLastUpdateTime();
ICustomerLinkMan iCustomerLinkMan = CustomerLinkManFactory.getLocalInstance(ctx);
oql = "where PTAddressID = '" + addressID + "'";
CustomerLinkManInfo linkManInfo = null;
CustomerLinkManCollection linkManColl = iCustomerLinkMan.getCollection(oql);
// 获取省市区
ProvinceInfo provinceInfo = null;
if (!StringUtils.isEmpty(provinces)) {
EntityViewInfo view = new EntityViewInfo();
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("name", provinces + "%", CompareType.LIKE));
view.setFilter(filter);
provinceInfo = ProvinceFactory.getLocalInstance(ctx).getProvinceCollection(view).get(0);
}
// 获取城市
CityInfo cityInfo = null;
if (!StringUtils.isEmpty(city)) {
EntityViewInfo view = new EntityViewInfo();
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("name", city + "%", CompareType.LIKE));
view.setFilter(filter);
ICity iCity = CityFactory.getLocalInstance(ctx);
cityInfo = iCity.getCityCollection(view).get(0);
}
// 获取区县
RegionInfo regionInfo = null;
if (!StringUtils.isEmpty(county)) {
EntityViewInfo view = new EntityViewInfo();
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("name", county + "%", CompareType.LIKE));
view.setFilter(filter);
IRegion iRegion = RegionFactory.getLocalInstance(ctx);
regionInfo = iRegion.getRegionCollection(view).get(0);
}
if (UIRuleUtil.isNotNull(linkManColl) && !linkManColl.isEmpty()) {
linkManInfo = linkManColl.get(0);
// 上次修改地址的时间
Timestamp addressLastUpdateTime = linkManInfo.getLastUpdateTime();
if (lastUpdateTime.compareTo(addressLastUpdateTime) != 0) {
// 最后修改时间不一致 需要同步日期
linkManInfo.setContactPerson(contact);
linkManInfo.setMobile(mobile);
linkManInfo.setAddress(address);
linkManInfo.setPhone(landline);
linkManInfo.setAreaAddress(areaAddress);
linkManInfo.setProvinces(provinceInfo);
linkManInfo.setCity(cityInfo);
linkManInfo.setCounty(regionInfo);
linkManInfo.setLastUpdateTime(lastUpdateTime);
updateCustomerLinkMan(ctx, linkManInfo, XZUtil.getSeletor("contactPerson", "mobile", "address", "phone", "areaAddress", "provinces", "city", "county",
"lastUpdateTime"));
}
} else {
EntrustBillInfo entrustBillInfo = (EntrustBillInfo) XZAppUtil.getValue(ctx, sourceBillId, XZUtil.getSeletor("CU.id", "customer.id", "customer.name"));
// 客户
CustomerInfo customer = entrustBillInfo.getCustomer();
String customerID = customer.getString("id");
String cuID = entrustBillInfo.getCU().getString("id");
ICustomerSaleInfo iSaleInfoFactory = CustomerSaleInfoFactory.getLocalInstance(ctx);
oql = "select customerLinkMan.* where saleOrgUnit.id = '" + cuID + "' and customer.id = '" + customerID + "'";
if (iSaleInfoFactory.exists(oql)) {
CustomerSaleInfoInfo saleInfo = (CustomerSaleInfoInfo) iSaleInfoFactory.getDataBaseCollection(oql).get(0);
linkManInfo = new CustomerLinkManInfo();
linkManInfo.setId(BOSUuid.create(linkManInfo.getBOSType()));
linkManInfo.setCustomerSale(saleInfo);
linkManInfo.setContactPerson(contact);
linkManInfo.setMobile(mobile);
linkManInfo.setAddress(address);
linkManInfo.setPhone(landline);
linkManInfo.setAreaAddress(areaAddress);
linkManInfo.setPTAddressID(addressID);
linkManInfo.setProvinces(provinceInfo);
linkManInfo.setCity(cityInfo);
linkManInfo.setCounty(regionInfo);
linkManInfo.setLastUpdateTime(lastUpdateTime);
addNewCustomerLinkMan(ctx, linkManInfo);
}
}
post.setReceivingInfo(linkManInfo);
post.setConsignee(linkManInfo.getAreaAddress());
post.setAttention(linkManInfo.getContactPerson());
post.setTelephone(linkManInfo.getMobile());
post.setReceivingAdress(linkManInfo.getAddress());
post.setProvince(linkManInfo.getProvinces());
post.setCity(linkManInfo.getCity());
post.setRegion(linkManInfo.getCounty());
post.setConsignee(linkManInfo.getAreaAddress());
String msg = "";
String transport = DCUtil.emptyToValue(entrustBillExInfo.getTransport(), "");
String carrier = DCUtil.emptyToValue(entrustBillExInfo.getCarrier(), "");
String freight = DCUtil.emptyToValue(entrustBillExInfo.getFreight(), "");
if (StringUtils.isEmpty(entrustBillExInfo.getDeliveryRamark())) {
msg = transport + carrier + freight;
} else {
msg = entrustBillExInfo.getDeliveryRamark() + "," + transport + carrier + freight;
}
post.setPostRequRemark(msg);
PostRequistionBillFactory.getLocalInstance(ctx).updatePartial(post,
DCUtil.getSeletor("province", "city", "region", "receivingAdress", "consignee", "attention", "telephone", "receivingInfo", "postRequRemark"));
}
PostRequistionBillFactory.getLocalInstance(ctx).submit(post);
}
} catch (Exception e) {
throw new EASBizException(new NumericExceptionSubItem("0xE0000012", "生成深圳发货通知单失败" + e.getMessage()));
......@@ -2527,25 +1938,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
}
}
protected void updateCustomerLinkMan(Context ctx, IObjectValue model, SelectorItemCollection selector) throws BOSException {
Connection cn = null;
cn = getConnection(ctx);
IORMappingDAO dao = getCustomerLinkDao(ctx, cn);
dao.updatePartial(model, selector);
SQLUtils.cleanup(cn);
}
private IObjectPK addNewCustomerLinkMan(Context ctx, IObjectValue model) throws BOSException {
Connection cn = getConnection(ctx);
IObjectPK iobjectpk = getCustomerLinkDao(ctx, cn).addnew(model);
SQLUtils.cleanup(cn);
return iobjectpk;
}
private IORMappingDAO getCustomerLinkDao(Context ctx, Connection cn) {
return ORMappingDAO.getInstance(new CustomerLinkManInfo().getBOSType(), ctx, cn);
}
@Override
protected void _classfiyUnAudit(Context ctx, IObjectValue model) throws BOSException, EASBizException {
EntrustBillInfo entrustInfo = (EntrustBillInfo) model;
......@@ -2681,8 +2073,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
}
}
}
// System.out.println("===============委托单检查物料是否为新物料是否管制物品:isExist = "+
// isExist+"");
return isExist;
}
......@@ -2716,113 +2106,94 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
selector.add(new SelectorItemInfo("BillStatus"));
selector.add(new SelectorItemInfo("auditor"));
selector.add(new SelectorItemInfo("AuditDate"));
_updatePartial(ctx, entrustInfo, selector);// (ctx, pk,
_updatePartial(ctx, entrustInfo, selector);// (
serviceController.execCommand(new Command(ctx, "classfiyAudit", (SCSBillBaseInfo) entrustInfo));
// generateSZPostBillByBtop(ctx, (EntrustBillInfo) model);
// 平台订单代为提货
// generateReqDeliveryBill(ctx, (EntrustBillInfo) model);
// updateSupplyIchuntSynTable(ctx, (EntrustBillInfo) model,true);
// logger.error("委托单结束审核" + entrustInfo.getNumber());
// post(ctx, entrustInfo);
createNextBill(ctx, entrustInfo);
String log = XZAppUtil.getUserInfo(ctx).getName() + XZUtil.formatDate(new Date()) + "操作单号:" + entrustInfo.getNumber();
XZUtil.logInfo("委托单", "审核", "info", entrustBillLogger, log, getJsonString(entrustInfo));
}
/**
* 审核后同步到平台
*
* @param ctx
* @param entrustInfo
* @throws BOSException
* @throws EASBizException
* @author 熊智
* @date 2024-1-26 上午10:40:34
*/
private void post(Context ctx, EntrustBillInfo entrustInfo) throws BOSException, EASBizException {
JSONObject jsonObject = new JSONObject();
EntrustBillClassifyEntryCollection billEntryClos = entrustInfo.getClassifyEntrys();
ArrayList<JSONObject> recLists = new ArrayList<JSONObject>();
ISysParameter iSysParameter = SysParameterFactory.getLocalInstance(ctx);
for (int i = 0; i < billEntryClos.size(); i++) {
EntrustBillClassifyEntryInfo entrustEntryInfo = billEntryClos.get(i);
if (StringUtils.isEmpty(entrustEntryInfo.getRecid())) {
// 非平台订单不用推送采购系统
return;
}
JSONObject rj = new JSONObject();
rj.put("scm_order_id", entrustEntryInfo.getRecid());
rj.put("erp_goods_id", entrustEntryInfo.getMaterial().getId().toString());
rj.put("erp_scm_item_id", entrustEntryInfo.getId().toString());
rj.put("tariff", entrustEntryInfo.getTariffAmount());
rj.put("tariff_rate", entrustEntryInfo.getTariffRate());
rj.put("commodity_inspection", entrustEntryInfo.isIsInspOrg() == true ? "1" : "0");
if (UIRuleUtil.isNotNull(entrustEntryInfo.getCountryOforigins())) {
SysParameterInfo sysinfo = iSysParameter.getSysParameterInfo(new ObjectUuidPK(entrustEntryInfo.getCountryOforigins().getId().toString()));
rj.put("origin", sysinfo.getName());
private void createNextBill(final Context ctx, final EntrustBillInfo entrustInfo) {
new Thread(new Runnable() {
public void run() {
try {
// 生成采购订单,收货通知单
createBotpPurOrder(ctx, entrustInfo);
// 生成发货通知单
generateSZPostBillByBtop(ctx, entrustInfo);
// 生成付汇申请单
createPaymentBill(ctx, entrustInfo);
} catch (Exception e) {
XZAppUtil.insertJKJsonParam(ctx, entrustInfo.getNumber() + "委托单审核自动生成下游失败", e.getMessage());
}
}
rj.put("origin_tax", entrustEntryInfo.getOriginAmt());
recLists.add(rj);
}
if (!recLists.isEmpty()) {
jsonObject.put("items", recLists);
jsonObject.put("warehouse_receipt_sn", entrustInfo.getNumber());
jsonObject.put("scm_order_sn", entrustInfo.getSourceBillType());
Map customerMap = new HashMap<String, String>();
customerMap.put("queue_name", "lie_queue_pur");
customerMap.put("__route_key", "/sync/scmOrder/updateScmOrder");
customerMap.put("_uk", entrustInfo.getId().toString());
customerMap.put("__search_key", entrustInfo.getNumber());
doHttpPost(ctx, jsonObject, customerMap);
callBotpCreatePurOrder(ctx, entrustInfo);
}
}).start();
}
/**
* 委托单审核 生成采购订单
*
* @param ctx
* @param info
* @throws BOSException
* @throws EASBizException
* @param entrustInfo
* @author 熊智
* @throws BOSException
* @throws EASBizException
* @date 2024-1-26 上午11:09:16
*/
private void callBotpCreatePurOrder(Context ctx, EntrustBillInfo info) throws EASBizException, BOSException {
EntrustBillClassifyEntryCollection classfyEntryClos = info.getClassifyEntrys();
EntrustBillClassifyEntryCollection newClos = new EntrustBillClassifyEntryCollection();
EntrustBillClassifyEntryCollection oldClos = new EntrustBillClassifyEntryCollection();
for (int i = 0; i < classfyEntryClos.size(); i++) {
EntrustBillClassifyEntryInfo eninfo = classfyEntryClos.get(i);
if(eninfo.isIsInspOrg()){
newClos.add(eninfo);
}else{
oldClos.add(eninfo);
private void createPaymentBill(Context ctx, EntrustBillInfo entrustInfo) throws BOSException, EASBizException {
// 获取委托单对应的采购货款记录
IScsfundPool iFactory = ScsfundPoolFactory.getLocalInstance(ctx);
String oql = "where serverProject.number = '101000' and sourceBillId = '" + entrustInfo.getId() + "' and sourceFunction = '委托单'";
if (iFactory.exists(oql)) {
ScsfundPoolInfo scsInfo = iFactory.getScsfundPoolCollection(oql).get(0);
JSONObject json = new JSONObject();
json.put("settlement_type", 1);
json.put("supplierID", entrustInfo.getVendor().getString("id"));
JSONArray details = new JSONArray();
JSONObject detail = new JSONObject();
detail.put("poolNumber", scsInfo.getNumber());
detail.put("verityAmt", scsInfo.getSettleAmount());
details.add(detail);
json.put("details", details);
String rs = IchuntCustomTaskFacadeFactory.getLocalInstance(ctx).createPayLocalGood(json.toJSONString());
JSONObject rsJson = JSONObject.parseObject(rs);
if (rsJson.containsKey("4444")) {
throw XZAppUtil.diyEASBizException(rsJson.getString("4444"));
}
}
}
private void createBotpPurOrder(Context ctx, EntrustBillInfo info) throws Exception {
if (info.getExportCount() == 13) {
IObjectPK pk = callBotpPurOrder(ctx, info, "LX-13-001");// 生成采购订单
if (pk != null) {
String oql = "select *, bizFlow.*, customer.*, entrys.* where id = '" + pk + "'";
IPurcharseOrder iPurcharseOrder = PurcharseOrderFactory.getLocalInstance(ctx);
if (iPurcharseOrder.exists(oql)) {
PurcharseOrderInfo orderInfo = iPurcharseOrder.getPurcharseOrderInfo(oql);
iPurcharseOrder.submit(orderInfo);
iPurcharseOrder.passAudit(new ObjectUuidPK(orderInfo.getString("id")), orderInfo);
// 收货通知单
BTPTransformResult transResult = DCCallBotpUtil.doBotpWithBOTPNumber(ctx, orderInfo, "LX-13-002");
if (transResult != null) {
IObjectCollection destBillCol = transResult.getBills();
PurchaseInWoreHouseInfo inWoreInfo = (PurchaseInWoreHouseInfo) destBillCol.getObject(0);
IPurchaseInWoreHouse inWoreFactory = PurchaseInWoreHouseFactory.getLocalInstance(ctx);
inWoreFactory.submit(inWoreInfo);
inWoreFactory.passAudit(new ObjectUuidPK(inWoreInfo.getId()), inWoreInfo);
}
}
}
}
if(newClos.size()>0){//表示存在商检的情况
info.getClassifyEntrys().clear();
info.getClassifyEntrys().addCollection(newClos);
createBotpPurOrder(ctx,info);//生成商检的采购订单
if(oldClos.size()>0){
info.getClassifyEntrys().clear();
info.getClassifyEntrys().addCollection(oldClos);
createBotpPurOrder(ctx,info);//生成非商检的采购订单
}
}else{
createBotpPurOrder(ctx,info);
}
}
private void createBotpPurOrder(Context ctx, EntrustBillInfo info) throws EASBizException, BOSException {
String ruleNumber = "";
if (info.getExportCount() == 7) {
ruleNumber = "LX-01-001";
} else if (info.getExportCount() == 4) {
ruleNumber = "LX-02-001";
} else if (info.getExportCount() == 9) {
ruleNumber = "LX-08-0001";
}
IObjectPK pk = callBotpPurOrder(ctx, info, ruleNumber);// 生成采购订单
if (UIRuleUtil.isNull(pk)) {
logger.error(info.getNumber() + "生成采购订单正常.");
} else {
logger.error(info.getNumber() + "生成采购订单异常。。");
}
}
private IObjectPK callBotpPurOrder(Context ctx, EntrustBillInfo info, String ruleNumber) throws EASBizException, BOSException {
......@@ -2830,7 +2201,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
IObjectCollection bills = res.getBills();
if (!bills.isEmpty()) {
CoreBillBaseInfo corebaseInfo = (CoreBillBaseInfo) bills.getObject(0);
// return BTPManagerFactory.getLocalInstance(ctx).saveRelations(corebaseInfo, relations);;
if (corebaseInfo instanceof PurcharseOrderInfo) {
try {
IPurcharseOrder iPurcharseOrder = PurcharseOrderFactory.getLocalInstance(ctx);
......@@ -2912,7 +2282,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
paramsEntryList.clear();
}
} catch (BOSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
......@@ -2939,65 +2308,6 @@ public class EntrustBillControllerBean extends AbstractEntrustBillControllerBean
return BTPManagerFactory.getLocalInstance(ctx).transform(coreBillColl, botMappingInfo);
}
private void doHttpPost(Context ctx, JSONObject jsonObject, Map customerMap) {
JSONObject jsData = new JSONObject();
jsData.put("queue_name", customerMap.get("queue_name"));
JSONObject mq_data = new JSONObject();
mq_data.put("__from", "ERP");// 消息来源,后续用来追踪消息从哪里发出的
mq_data.put("__insert_time", new Date().getTime());// 消息插入时间
mq_data.put("__route_key", customerMap.get("__route_key"));// 消息route_key,http请求时为路由地址,soap请求时为方法
// mq_data.put("__type", "");// 消息转发类型,http,soap,默认为http的post请求,soap为erp的webservices调用,选填字段
mq_data.put("__uk", customerMap.get("_uk"));// 消息唯一标识符,用户自定义,别重复就行,后续用来追踪消息
mq_data.put("__search_key", customerMap.get("__search_key"));// 各个系统自定义的搜索字段,可以为订单号,采购单号等
mq_data.put("data", jsonObject);
jsData.put("mq_data", mq_data);
logger.error(StringEscapeUtils.escapeJava(jsData.toJSONString()).replaceAll("\\\\\"", "\""));
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
String entrustBillPostMQ = DCUtil.getInitSysValueByParamNumber(ctx, "entrustBillPostMQ");
URL realUrl = new URL(entrustBillPostMQ);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
conn.setRequestProperty("accept", "application/json");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(StringEscapeUtils.escapeJava(jsData.toJSONString()).replaceAll("\\\\\"", "\""));
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
logger.error("PubFacadeControllerBean _doHttpPost err:" + e.getMessage());
}
// 使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
/**
* 判断是否低于最低报关单价;低于最低报关单价返回true,否则返回false
*/
......
......@@ -108,6 +108,7 @@ public class EntrustBillEditUICTEx extends EntrustBillEditUI {
this.tabPanelMain.remove(panelInlandDelivery);
this.tabPanelMain.remove(panelPurInw);
this.tabPanelMain.remove(panelAttachment);
this.tabPanelMain.remove(panelPay);
}
@Override
......
package com.kingdee.eas.hse.scm.settlemanager.app;
import hprose.client.HproseHttpClient;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import org.apache.log4j.Logger;
import com.alibaba.fastjson.JSONObject;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.ui.face.UIRuleUtil;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.btp.BTPTransformResult;
import com.kingdee.eas.basedata.assistant.AccountBankInfo;
import com.kingdee.eas.basedata.assistant.BankInfo;
import com.kingdee.eas.basedata.assistant.CurrencyInfo;
import com.kingdee.eas.basedata.master.account.AccountViewInfo;
import com.kingdee.eas.camel.XZUtil;
import com.kingdee.eas.camel.app.XZAppUtil;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.fi.cas.IPaymentBill;
import com.kingdee.eas.fi.cas.PaymentBillFactory;
import com.kingdee.eas.fi.cas.PaymentBillInfo;
import com.kingdee.eas.hse.basedata.SysParameterFactory;
import com.kingdee.eas.hse.basedata.SysParameterInfo;
import com.kingdee.eas.hse.common.DCConstant;
import com.kingdee.eas.hse.common.HSEBillStatusEnum;
import com.kingdee.eas.hse.common.Resource;
import com.kingdee.eas.hse.common.util.DCCallBotpUtil;
import com.kingdee.eas.hse.common.util.DCUtil;
import com.kingdee.eas.hse.scm.custommanager.CustomsBillEntryFactory;
import com.kingdee.eas.hse.scm.planandorder.EntrustBillPayMentBillEntryFactory;
......@@ -58,7 +62,6 @@ public class PayLoaclGoodControllerBean extends AbstractPayLoaclGoodControllerBe
@Override
protected IObjectPK _submit(Context ctx, IObjectValue model)
throws BOSException, EASBizException {
// checkPayData(ctx,model);
PayLoaclGoodInfo info = (PayLoaclGoodInfo) model;
SysParameterInfo sysInfo = info.getRemitType();
if(info.getRemitType().getName() == null){
......@@ -96,115 +99,62 @@ public class PayLoaclGoodControllerBean extends AbstractPayLoaclGoodControllerBe
throws EASBizException, BOSException {
checkPayData(ctx,model);
super._passAudit(ctx, pk, model);
//调用PT接口 同步PT付汇申请单审核状态
PayLoaclGoodInfo info = (PayLoaclGoodInfo)model;
Date auditDate = info.getAuditDate();
info = (PayLoaclGoodInfo)_getValue(ctx, "select number, isSrcPT where id = '"+info.getId()+"'");
if(info.isIsSrcPT() && UIRuleUtil.isNotNull(auditDate)){
JSONObject json = new JSONObject();
json.put("poolNumber", info.getNumber());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
json.put("completeTime", sdf.format(auditDate));
//同步返回相关信息
synPTData(ctx, json.toJSONString());
}
// 自动生成付款单
createNextBill(ctx, (PayLoaclGoodInfo)model);
}
public static class methodType{
public static final String unAudit = "反审核";
public static final String delete = "删除";
}
/**
* 调用平台付汇申请单 反审核,删除
*
* @author xiongzhi
* @throws EASBizException
* @date 2020-7-6 上午10:17:59
* @param ctx
* @param model
* @author 熊智
* @date 2024-1-26 上午11:35:53
*/
private void callPTMethods(Context ctx, PayLoaclGoodInfo info, String type) throws EASBizException{
if("true".equals(DCUtil.getInitSysValueByParamNumber(ctx, "synPTPaylocalGood"))){
JSONObject json = new JSONObject();
json.put("id", info.getString("id"));
json.put("poolNumber", info.getNumber());
HproseHttpClient client = new HproseHttpClient();
client.setHeader("Referer", "SCM_ERP");
client.useService(DCUtil.getInitSysValueByParamNumber(ctx, "ws03"));
//反审核
if(type.equals(methodType.unAudit)){
private void createNextBill(final Context ctx, final PayLoaclGoodInfo info) {
new Thread(new Runnable() {
public void run() {
try {
String result = (String) client.invoke("updatePaymentApplyOriginStatus", new Object[] {json.toJSONString()});
JSONObject resultdata = JSONObject.parseObject(result);
int c = Integer.parseInt(String.valueOf(resultdata.get("err_code")));
if(0 == c){
logger.error("同步反审核平台付汇申请单成功,付汇申请单号:" + info.getNumber());
} else {
throw XZAppUtil.diyEASBizException("同步反审核平台付汇申请单失败,原因:"+resultdata.get("err_msg"));
}
} catch (Throwable e) {
throw XZAppUtil.diyEASBizException("同步反审核平台付汇申请单失败,原因:"+e.getMessage());
}
//删除
} else if(type.equals(methodType.delete)){
try {
String result = (String) client.invoke("deletePaymentApply", new Object[] {json.toJSONString()});
JSONObject resultdata = JSONObject.parseObject(result);
int c = Integer.parseInt(String.valueOf(resultdata.get("err_code")));
if(0 == c){
logger.error("同步删除平台付汇申请单成功,付汇申请单号:" + info.getNumber());
} else {
throw XZAppUtil.diyEASBizException("同步删除平台付汇申请单失败,原因:"+resultdata.get("err_msg"));
}
} catch (Throwable e) {
throw XZAppUtil.diyEASBizException("同步删除平台付汇申请单失败,原因:"+e.getMessage());
createPaymentBill(ctx, info);
} catch (Exception e) {
XZAppUtil.insertJKJsonParam(ctx, info.getNumber() + "付汇申请单审核自动生成付款单失败", e.getMessage());
}
}
}
}).start();
}
/**
* 同步供应链数据状态
* @param ctx
* @author xiongzhi
* @throws EASBizException
* @date 2020-4-17 上午11:10:38
*/
private void synPTData(Context ctx, String json) throws EASBizException {
HproseHttpClient client = new HproseHttpClient();
client.useService(DCUtil.getInitSysValueByParamNumber(ctx, "ws03"));
client.setHeader("Referer", "SCM_ERP");
try {
String result = (String) client.invoke("updatePaymentApplyStatus", new Object[] {json});
JSONObject resultdata = JSONObject.parseObject(result);
int c = Integer.parseInt(String.valueOf(resultdata.get("err_code")));
if(0 != c){
throw XZAppUtil.diyEASBizException("同步供应链平台失败,原因:"+resultdata.get("err_msg"));
}
} catch (Throwable e) {
throw XZAppUtil.diyEASBizException("同步供应链平台失败,原因:"+e.getMessage());
private void createPaymentBill(Context ctx, PayLoaclGoodInfo info) throws Exception {
BTPTransformResult result = DCCallBotpUtil.doBotpWithBOTPNumber(ctx, info, "LX-SYS9913-2");
if (result != null) {
IObjectCollection destBillCol = result.getBills();
PaymentBillInfo paymentBillInfo = (PaymentBillInfo) destBillCol.getObject(0);
BankInfo bankInfo = new BankInfo();
bankInfo.setId(BOSUuid.read("LxYAAAABZtgMXUOH"));
paymentBillInfo.setPayerBank(bankInfo);
AccountBankInfo account = new AccountBankInfo();
account.setId(BOSUuid.read("LxYAAAABe1T7Mm5e"));
paymentBillInfo.setPayerAccountBank(account);
AccountViewInfo viewInfo = new AccountViewInfo();
viewInfo.setId(BOSUuid.read("QDh8mrRwSbSINz0waIc08Z2pmCY="));
paymentBillInfo.setPayerAccount(viewInfo);
paymentBillInfo.setActPayAmt(info.getActPayAmount());
paymentBillInfo.setBuyAmount(info.getActPayAmount());
paymentBillInfo.setActPayAmtHk(info.getActPayAmount());
IPaymentBill iPayBill = PaymentBillFactory.getLocalInstance(ctx);
iPayBill.submit(paymentBillInfo);
HashSet ids = new HashSet();
ids.add(paymentBillInfo.getString("id"));
iPayBill.audit(ids);
iPayBill.pay(ids);
}
}
@Override
public void _unAudit(Context ctx, IObjectPK pk, IObjectValue model)
throws BOSException, EASBizException {
PayLoaclGoodInfo info = (PayLoaclGoodInfo)model;
if(info.isIsSrcPT()){
throw new EASBizException(new NumericExceptionSubItem("1111", "该订单来源于平台,不能反审核!"));
}
deleteEntryPayMentBill(ctx,model);
super._unAudit(ctx, pk, model);
info = (PayLoaclGoodInfo)_getValue(ctx, "select id, number, isSrcPT where id = '"+info.getId()+"'");
callPTMethods(ctx, info, methodType.unAudit);
}
@Override
protected void _delete(Context ctx, IObjectPK pk) throws BOSException, EASBizException {
PayLoaclGoodInfo info = (PayLoaclGoodInfo) _getValue(ctx, pk);
super._delete(ctx, pk);
callPTMethods(ctx, info, methodType.delete);
}
/**
* 删除委托单付款信息
* @param ctx
......@@ -299,17 +249,6 @@ public class PayLoaclGoodControllerBean extends AbstractPayLoaclGoodControllerBe
if(info.getE1().size()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000063", Resource.getString("0xE0000063","付款明细")));
}
/*if(info.getE1().size()>0){
int count = 0;
for (int i = 0; i < info.getE1().size(); i++) {
if(!info.getE1().get(i).isIFeight()){
count++;
}
}
if(count>1){
throw new EASBizException(new NumericExceptionSubItem("0xE0000064", Resource.getString("0xE0000064","付款明细")));
}
}*/
if(info.getE2().size()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000063", Resource.getString("0xE0000063","收款明细")));
}
......@@ -338,23 +277,6 @@ public class PayLoaclGoodControllerBean extends AbstractPayLoaclGoodControllerBe
}
}
else if(sysInfo.getName().equals("垫付")){
/*if(info.getRemitUse().getName().equals("预付货款") ){
throw new EASBizException(new NumericExceptionSubItem("0xE0000060", Resource.getString("0xE0000060")));
}*/
/*if(info.getE1().size()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000063", Resource.getString("0xE0000063","付款明细")));
}*/
/*if(info.getE1().size()>0){
int count = 0;
for (int i = 0; i < info.getE1().size(); i++) {
if(!info.getE1().get(i).isIFeight()){
count++;
}
}
if(count>1){
throw new EASBizException(new NumericExceptionSubItem("0xE0000064", Resource.getString("0xE0000064","付款明细")));
}
}*/
if(info.getE2().size()>0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000062", Resource.getString("0xE0000062","收款明细")));
}
......@@ -374,23 +296,6 @@ public class PayLoaclGoodControllerBean extends AbstractPayLoaclGoodControllerBe
if(DCUtil.emptyToValue(info.getDfAmount(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO)<=0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000059", Resource.getString("0xE0000059","代付金额")));
}
/*else if(info.getDfDiffAmount().compareTo(BigDecimal.ZERO)!=0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000061", Resource.getString("0xE0000061","代付差异")));
}*/
/*if(info.getE1().size()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000063", Resource.getString("0xE0000063","付款明细")));
}*/
/*if(info.getE1().size()>0){
int count = 0;
for (int i = 0; i < info.getE1().size(); i++) {
if(!info.getE1().get(i).isIFeight()){
count++;
}
}
if(count>1){
throw new EASBizException(new NumericExceptionSubItem("0xE0000064", Resource.getString("0xE0000064","付款明细")));
}
}*/
if(info.getE2().size()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000063", Resource.getString("0xE0000063","收款明细")));
}
......@@ -407,7 +312,6 @@ public class PayLoaclGoodControllerBean extends AbstractPayLoaclGoodControllerBe
dffAmount = dffAmount.add(DCUtil.emptyToValue(e1Info.getDffAmount(), BigDecimal.ZERO));
}
if(dfAmount.compareTo(BigDecimal.ZERO)>0){
// if(dfAmount.compareTo(dfAmountTTL)!=0){
if(dfAmount.compareTo(dfAmountTTL.add(new BigDecimal("0.05")))>0
|| dfAmount.compareTo(dfAmountTTL.subtract(new BigDecimal("0.05")))<0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000073", Resource.getString("0xE0000073")));
......
......@@ -109,11 +109,11 @@ public class ArRPWriteOffBillListUI extends AbstractArRPWriteOffBillListUI {
// 补充核销生成记录
// 可批量操作的人员权限
String batchOperatUsers = DCUtil.getInitSysValueByParamNumber(null, "batchOperatUsers");
String user = XZClientUtil.getUserInfo().getNumber();
if(new HashSet(Arrays.asList(batchOperatUsers.split(","))).contains(user)) {
addVerifyRecordBtn();
}
// String batchOperatUsers = DCUtil.getInitSysValueByParamNumber(null, "batchOperatUsers");
// String user = XZClientUtil.getUserInfo().getNumber();
// if(new HashSet(Arrays.asList(batchOperatUsers.split(","))).contains(user)) {
// addVerifyRecordBtn();
// }
}
/**
......@@ -590,15 +590,15 @@ public class ArRPWriteOffBillListUI extends AbstractArRPWriteOffBillListUI {
StringBuffer where = new StringBuffer();
where.append("\n and ");
where.append("\n ( ");
where.append("\n (ServeProject.FGroup = '" + serviceGroup.FEIGHT_VALUE + "' and FArap = '" + ArApType.AR_VALUE + "') "); // 费用组
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectdfkGoodAmount + "' "); // 垫付货款
// where.append("\n (ServeProject.FGroup = '" + serviceGroup.FEIGHT_VALUE + "' and FArap = '" + ArApType.AR_VALUE + "') "); // 费用组
where.append("\n ServeProject.FNumber = '" + DCConstant.serviceProjectdfkGoodAmount + "' "); // 垫付货款
// where.append("\n or ServeProject.FNumber = '" +
// DCConstant.serviceProjectdfGoodDIffAmount + "' "); //代付差异
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectvatAmount + "' "); // 关税
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjecttarrfiAmount + "' "); // 增值税
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectdlfGoodAmount + "' "); // 代理费
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectLowdlfGoodAmount + "' "); // 最低代理费
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectisTaxAmount + "' "); // 税金
// where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectdlfGoodAmount + "' "); // 代理费
// where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectLowdlfGoodAmount + "' "); // 最低代理费
// where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectisTaxAmount + "' "); // 税金
where.append("\n or ServeProject.FNumber = '" + DCConstant.serviceProjectdfGoodAmount + "' "); // 代付货款
where.append("\n ) ");
......@@ -636,7 +636,7 @@ public class ArRPWriteOffBillListUI extends AbstractArRPWriteOffBillListUI {
sql.append("\n sum(FSettlementAmount) as CFChargeAmount ");
sql.append("\n from CT_SM_ArChargeSettleE1 entry ");
sql.append("\n left outer join CT_SM_ArChargeSettle bill on bill.FID = entry.FParentID ");
sql.append("\n where bill.CFBillStatus = '" + HSEBillStatusEnum.AUDITED_VALUE + "' ");
sql.append("\n where bill.CFBillStatus = '" + HSEBillStatusEnum.AUDITED_VALUE + "' and entry.FServeProjectID != 'crYAAAJeQECIb4YR' ");
sql.append("\n group by entry.FFeePoolId ");
sql.append("\n union all ");
sql.append("\n select to_char(entry.CFAdjfeePoolId) CFScsfundPoolID, ");
......@@ -644,12 +644,12 @@ public class ArRPWriteOffBillListUI extends AbstractArRPWriteOffBillListUI {
sql.append("\n sum(entry.CFAdjSAT) as CFChargeAmount ");
sql.append("\n from CT_SM_ArChargeSettleE1 entry ");
sql.append("\n left outer join CT_SM_ArChargeSettle bill on bill.FID = entry.FParentID ");
sql.append("\n where bill.CFBillStatus = '" + HSEBillStatusEnum.AUDITED_VALUE + "' and isnull(entry.CFAdjSAT,0)!=0 ");
sql.append("\n where bill.CFBillStatus = '" + HSEBillStatusEnum.AUDITED_VALUE + "' and isnull(entry.CFAdjSAT,0)!=0 and entry.FServeProjectID != 'crYAAAJeQECIb4YR' ");
sql.append("\n group by entry.CFAdjfeePoolId ");
sql.append("\n union all ");
sql.append("\n select to_char(pl.fid) CFScsfundPoolID,pl.FOrgAmount CFOriginalAmount,pl.FSettleAmount CFChargeAmount from CT_SRV_ScsfundPool pl ");
sql.append("\n inner join CT_BAS_ServeProject sp on pl.FServerProjectID = sp.FID");
sql.append("\n where sp.fnumber = '" + DCConstant.serviceProjectContractTax1 + "' and FArap = " + ArApType.ar.getValue() + " ");// 合同应收税金
sql.append("\n where sp.fnumber in ('" + DCConstant.serviceProjectContractTax1 + "', '" + DCConstant.serviceProjectdfkGoodAmount + "') and FArap = " + ArApType.ar.getValue() + " ");// 合同应收税金
sql.append("\n ) tempTable ");
sql.append("\n ) rp on pl.FID=rp.CFScsfundPoolID");
// sql.append("\n ) dt where dt.principalAllName not like '%猎芯科技%'");
......
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 sign in to comment