Merge remote-tracking branch 'origin/master'

This commit is contained in:
龚豆豆 2025-11-11 14:49:02 +08:00
commit c41673bc18
5 changed files with 153 additions and 38 deletions

View File

@ -1,38 +0,0 @@
package tqq9.lc123.cloud.app.plugin.form.im;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.EventObject;
/**
* 盘点表表单插件
*/
public class InvCountBillPLugin extends AbstractBillPlugIn {
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
//给泛微审批状态设置初始默认值--待提交
this.getModel().setValue("tqq9_fwstate", "A");
//设置创建部门
DynamicObject creator = (DynamicObject) this.getModel().getValue("creator");
if(creator != null){
DynamicObject bos_user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("id", QCP.equals, creator.getLong("id"))});
DynamicObjectCollection entryentity = bos_user.getDynamicObjectCollection("entryentity");
DynamicObject dept = null;
for (DynamicObject dynamicObject : entryentity) {
boolean ispartjob = dynamicObject.getBoolean("ispartjob");
if (!ispartjob) {
dept = dynamicObject.getDynamicObject("dpt");
}
}
this.getModel().setValue("tqq9_dept", dept);
}
}
}

View File

@ -0,0 +1,24 @@
package tqq9.lc123.cloud.app.plugin.form.im;
import kd.sdk.scmc.im.extpoint.IInvCountSchemeAuditExpand;
import java.util.HashMap;
import java.util.Map;
/**
* 盘点方案传值给盘点表
* 系统服务云-配置工具-业务扩展-业务扩展场景
* 名称库存盘点方案审核处理扩展字段
*/
public class InvCountSchemeAuditExpandPlugin implements IInvCountSchemeAuditExpand {
@Override
public Map<String, String> getFieldMap() {
Map<String, String> fieldMap = new HashMap<>(1);
//key:盘点方案单头扩展字段标识 value:盘点表单头扩展字段标识
fieldMap.put("tqq9_dept","tqq9_dept");//创建部门
fieldMap.put("tqq9_fwstate","tqq9_fwstate");//泛微审批状态-默认A
return fieldMap;
}
}

View File

@ -86,5 +86,38 @@ public class PmReceiptNoticeFormPlugin extends AbstractBillPlugIn {
} }
} }
else if ("tqq9_partclose".equals(itemKey)) {
String billNo = (String) this.getModel().getValue("billno");
String message = null;
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
String entityType = "pm_receiptnotice";
String entityName;
String label = "tqq9_ispartclose";
DynamicObject receiveorg = dataEntity.getDynamicObject("receiveorg");//收货组织
if (null != receiveorg) {
String number = receiveorg.getString("number");
if ("SHLC".equals(number)) {
DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry");
String warehouseCode = null;
for (DynamicObject dynamicObject : billentry) {
DynamicObject warehouse = dynamicObject.getDynamicObject("warehouse");
if (null != warehouse) {
warehouseCode = warehouse.getString("number");
}
}
String orderType = "CGRK";
entityName = "WMS-SH-收货通知单部分取消";
message = BillCloseCancelUtils.wmsPartClose(orderType, warehouseCode, billNo, entityType, entityName, label);
}
if (StringUtils.isNotEmpty(message)) {
this.getView().showMessage(String.valueOf(message));
}
}
}
} }
} }

View File

@ -107,6 +107,43 @@ public class PmReceiptNoticeListPlugin extends AbstractListPlugin {
} }
} else if ("tqq9_partclose".equals(itemKey)) {
BillList billList = this.getControl("billlistap");
ListSelectedRowCollection selectedRows = billList.getSelectedRows();
List<String> billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList());
for (String billNo : billnoList) {
String message = null;
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse",
new QFilter[]{new QFilter("billno", QCP.equals, billNo)});
String entityType = "pm_receiptnotice";
String entityName;
String label = "tqq9_ispartclose";
DynamicObject receiveorg = dataEntity.getDynamicObject("receiveorg");//收货组织
if (null != receiveorg) {
String number = receiveorg.getString("number");
if ("SHLC".equals(number)) {
DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry");
String warehouseCode = null;
for (DynamicObject dynamicObject : billentry) {
DynamicObject warehouse = dynamicObject.getDynamicObject("warehouse");
if (null != warehouse) {
warehouseCode = warehouse.getString("number");
}
}
String orderType = "CGRK";
entityName = "WMS-SH-收货通知单部分取消";
message = BillCloseCancelUtils.wmsPartClose(orderType, warehouseCode, billNo, entityType, entityName, label);
}
if (StringUtils.isNotEmpty(message)) {
this.getView().showMessage(String.valueOf(message));
}
}
}
} }
} }
} }

View File

@ -265,4 +265,63 @@ public class BillCloseCancelUtils {
} }
return message; return message;
} }
/**
* 通天晓单据部分关闭
*
* @param orderType 单据类型
* @param warehouseCode 仓库编号
* @param billNo 单据编号
* @param entityType 单据标识
* @param entityName 单据名称
* @param label 推送标识
* @return 取消结果
*/
public static String wmsPartClose(String orderType, String warehouseCode, String billNo, String entityType, String entityName, String label) {
String method = "entryorder.close";
String message = null;
Map<String, Object> request = new HashMap<>();
request.put("warehouseCode", warehouseCode);
request.put("ownerCode", "LICHI");
request.put("orderCode", billNo);
request.put("orderId", "");
request.put("orderType", orderType);
request.put("closeReason", "");
Map<String, Object> finalMap = new HashMap<>();
finalMap.put("request", request);
StringBuilder xmlBuilder = new StringBuilder();
xmlBuilder.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
HttpRequestUtils.buildXml(xmlBuilder, finalMap, 0);
String ttx_mainUrl = ConfigUtils.getThirdConfigByNumber("Ttx_MainURL");
String ttx_customerId = ConfigUtils.getThirdConfigByNumber("Ttx_CustomerId");
ttx_mainUrl = ttx_mainUrl + "?method=" + method + "&v=2.0&format=xml&customerId=" + ttx_customerId;
Map<String, String> headMap = new HashMap<>();
try {
String result = HttpRequestUtils.postXml(ttx_mainUrl, xmlBuilder.toString(), headMap);
if (StringUtils.isNotEmpty(result)) {
JSONObject jsonObject = HttpRequestUtils.xmlToJson(result);
JSONObject response = jsonObject.getJSONObject("response");
String flag = response.getString("flag");
String code = response.getString("code");
message = response.getString("message");
if ("0".equals(code) || "200".equals(code)) {
message = "部分关闭成功";
}
LCLogServiceImpl lcLogService = new LCLogServiceImpl();
lcLogService.savelog(entityName, ttx_mainUrl, true, code.equals("200"), xmlBuilder.toString(), result);
lcLogService.isSuccess(entityType, billNo, "billno", label, code.equals("200"));
}
} catch (
IOException e) {
throw new RuntimeException(e);
}
return message;
}
} }