|
@@ -0,0 +1,74 @@
|
|
|
+package nckd.poc602.plugin.task;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+import kd.bos.context.RequestContext;
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.exception.KDException;
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
+import kd.bos.schedule.executor.AbstractTask;
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Module :供应链-合同管理
|
|
|
+ * Description :采购合同未进行价格审定提醒
|
|
|
+ * @author : xiaobing_wu
|
|
|
+ * @date : 2025-4-26
|
|
|
+ */
|
|
|
+public class PurContractHaveNotJGSDTask extends AbstractTask {
|
|
|
+ @Override
|
|
|
+ public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
|
|
+ //1、从销售合同变跟单中查询所有已审核&变更原因=A:价格审定,获取所有
|
|
|
+ Set<Object> xshtids = new HashSet<>();
|
|
|
+ QFilter qxsbg = new QFilter("billstatus", QCP.equals, "C");
|
|
|
+ qxsbg.and("nckd_combofield",QCP.equals,"A");
|
|
|
+
|
|
|
+ DynamicObjectCollection collections = QueryServiceHelper.query("conm_xsalcontrac","id", qxsbg.toArray(), "");
|
|
|
+ if(!collections.isEmpty()){
|
|
|
+ for (DynamicObject saleData : collections) {
|
|
|
+ Object id = saleData.get("id");
|
|
|
+ xshtids.add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!xshtids.isEmpty()) {
|
|
|
+ Map<String,Set<String>> xsht2cght = new HashMap<>();
|
|
|
+ QFilter qcght = new QFilter("billstatus", QCP.equals, "C");
|
|
|
+ qcght.and("nckd_refbillfield", QCP.in, xshtids);
|
|
|
+ qcght.and("nckd_combofield",QCP.not_equals,"A");
|
|
|
+
|
|
|
+ DynamicObjectCollection cghts = QueryServiceHelper.query("conm_purcontract","id,billno,nckd_refbillfield", qcght.toArray(), "");
|
|
|
+ if(!cghts.isEmpty()){
|
|
|
+ for (DynamicObject saleData : collections) {
|
|
|
+ String billno = saleData.getString("billno");//采购合同编号
|
|
|
+ DynamicObject srcxsht = saleData.getDynamicObject("nckd_refbillfield");
|
|
|
+ String xshtbillno = srcxsht.getString("billno");
|
|
|
+ Set<String> cghtinfo = xsht2cght.get(xshtbillno);
|
|
|
+ if(cghtinfo == null) {
|
|
|
+ cghtinfo = new HashSet<>();
|
|
|
+ cghtinfo.add(billno);
|
|
|
+ xsht2cght.put(xshtbillno, cghtinfo);
|
|
|
+ }else {
|
|
|
+ cghtinfo.add(billno);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!xsht2cght.isEmpty()) {
|
|
|
+ StringBuffer bf = new StringBuffer();
|
|
|
+ for(String xsht : xsht2cght.keySet()) {
|
|
|
+ Set<String> cght = xsht2cght.get(xsht);
|
|
|
+ String tm = "以下采购合同(来源于销售合同:" + xsht + ")";
|
|
|
+ bf.append(tm);
|
|
|
+ bf.append(System.lineSeparator());
|
|
|
+ bf.append(cght.toString());
|
|
|
+ bf.append(System.lineSeparator());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|