Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
57d3af8a69
|
|
@ -206,6 +206,8 @@ public class SupplierControl implements Serializable {
|
|||
} else {
|
||||
DynamicObject bd_supplier = BusinessDataServiceHelper.newDynamicObject(entityName);
|
||||
bd_supplier.set("number", number);
|
||||
bd_supplier.set("tqq9_ispur",false);//非采购供应商
|
||||
bd_supplier.set("ctrlstrategy","2");//控制策略为自由分配
|
||||
bd_supplier.set("name", name);
|
||||
bd_supplier.set("simplename", simplename);
|
||||
bd_supplier.set("tqq9_combofield3_jyzt", tqq9_combofield3_jyzt);
|
||||
|
|
|
|||
|
|
@ -21,11 +21,13 @@ import java.util.Set;
|
|||
* 获取选中行单据分录,遍历对比分录每条数据的 "数量" 和 "关联数量" 字段,如果每一条都相等,则将是否可做收货通知 置为 false
|
||||
*/
|
||||
public class PurOrderBillUpdatasfkzshListPlugin extends AbstractListPlugin implements Plugin {
|
||||
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
super.itemClick(evt);
|
||||
String itemKey = evt.getItemKey();
|
||||
if ("biz_sfkzsh".equals(itemKey)) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
BillList billList = this.getView().getControl("billlistap");
|
||||
// 获取选中行集合
|
||||
ListSelectedRowCollection selectedRows = billList.getSelectedRows();
|
||||
|
|
@ -36,25 +38,36 @@ public class PurOrderBillUpdatasfkzshListPlugin extends AbstractListPlugin imple
|
|||
}
|
||||
QFilter f = new QFilter("id", "in", idSet);
|
||||
DynamicObject[] billArr = BusinessDataServiceHelper.load("pm_purorderbill",
|
||||
"id,billno,tqq9_sfkzsh,billentry,billentry.joinqty,billentry.qty", new QFilter[]{f});
|
||||
"id,billno,tqq9_sfkzsh,billentry,billentry.joinqty,billentry.qty,billstatus", new QFilter[]{f});
|
||||
for (DynamicObject bill : billArr) {
|
||||
//获取单据分录
|
||||
DynamicObjectCollection billEntryCollection = bill.getDynamicObjectCollection("billentry");
|
||||
boolean allEqual = true;
|
||||
for (DynamicObject billEntry : billEntryCollection) {
|
||||
if (billEntry.getBigDecimal("qty").compareTo( billEntry.getBigDecimal("joinqty")) !=0) {
|
||||
allEqual = false;
|
||||
break;
|
||||
String billstatus = bill.getString("billstatus");
|
||||
String billNo = bill.getString("billno");
|
||||
if ("C".equals(billstatus)) {
|
||||
//获取单据分录
|
||||
DynamicObjectCollection billEntryCollection = bill.getDynamicObjectCollection("billentry");
|
||||
boolean allEqual = true;
|
||||
for (DynamicObject billEntry : billEntryCollection) {
|
||||
if (billEntry.getBigDecimal("qty").compareTo(billEntry.getBigDecimal("joinqty")) != 0) {
|
||||
allEqual = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!allEqual) {
|
||||
bill.set("tqq9_sfkzsh", "true");
|
||||
if (!allEqual) {
|
||||
bill.set("tqq9_sfkzsh", "true");
|
||||
} else {
|
||||
bill.set("tqq9_sfkzsh", "false");
|
||||
}
|
||||
SaveServiceHelper.save(new DynamicObject[]{bill});
|
||||
}
|
||||
else {
|
||||
bill.set("tqq9_sfkzsh", "false");
|
||||
msg.append(billNo).append(",");
|
||||
}
|
||||
SaveServiceHelper.save(new DynamicObject[]{bill});
|
||||
}
|
||||
if (msg.length() > 0) {
|
||||
msg.deleteCharAt(msg.length() - 1);
|
||||
this.getView().showTipNotification("单据【"+msg+"】未审核,不能更新【是否可做收获通知】");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package tqq9.lc123.cloud.app.plugin.operate.conm;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.DateDifferenceCalculator;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 采购合同保存插件
|
||||
* 保存时,设置剩余有效天数默认值
|
||||
*/
|
||||
public class ConmPurcontractDefaultDaysSaveOp extends AbstractOperationServicePlugIn {
|
||||
|
||||
@Override
|
||||
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||||
super.beforeExecuteOperationTransaction(e);
|
||||
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||
for (DynamicObject purcontract : dataEntities1) {
|
||||
Date biztimeend = purcontract.getDate("biztimeend");//介质日期
|
||||
int tqq9_syyxts = DateDifferenceCalculator.calculateRemainingDays(biztimeend, new Date());//剩余时间
|
||||
purcontract.set("tqq9_syyxts", tqq9_syyxts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package tqq9.lc123.cloud.app.plugin.operate.sys;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.DateDifferenceCalculator;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 生产商保存插件
|
||||
* 保存前默认计算各类型证照的剩余有效天数
|
||||
*/
|
||||
public class ProxyAndFactoryDefaultDaysSaveOp extends AbstractOperationServicePlugIn {
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||||
super.beforeExecuteOperationTransaction(e);
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
for (DynamicObject proxyandfactory : dataEntities) {
|
||||
//营业执照税号
|
||||
Date tqq9_taxenddate = proxyandfactory.getDate("tqq9_taxenddate");
|
||||
int tqq9_yyzzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_taxenddate, new Date());
|
||||
proxyandfactory.set("tqq9_yyzzts", tqq9_yyzzts);
|
||||
|
||||
//医疗器械生产许可证号
|
||||
Date tqq9_proenddate = proxyandfactory.getDate("tqq9_proenddate");
|
||||
int tqq9_qxscxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_proenddate, new Date());
|
||||
proxyandfactory.set("tqq9_qxscxkzts", tqq9_qxscxkzts);
|
||||
|
||||
//医疗器械经营许可证号
|
||||
Date tqq9_saleenddate = proxyandfactory.getDate("tqq9_saleenddate");
|
||||
int tqq9_qxjyxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_saleenddate, new Date());
|
||||
proxyandfactory.set("tqq9_qxjyxkzts", tqq9_qxjyxkzts);
|
||||
|
||||
//辐射安全许可证号
|
||||
Date tqq9_safeenddate = proxyandfactory.getDate("tqq9_safeenddate");
|
||||
int tqq9_fsaqxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_safeenddate, new Date());
|
||||
proxyandfactory.set("tqq9_fsaqxkzts", tqq9_fsaqxkzts);
|
||||
|
||||
//化妆品许可证号
|
||||
Date tqq9_beautyenddate = proxyandfactory.getDate("tqq9_beautyenddate");
|
||||
int tqq9_hzpxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_beautyenddate, new Date());
|
||||
proxyandfactory.set("tqq9_hzpxkzts", tqq9_hzpxkzts);
|
||||
|
||||
//消毒产品生产企业卫生许可证号
|
||||
DynamicObjectCollection entries = proxyandfactory.getDynamicObjectCollection("tqq9_clnentry");
|
||||
for (DynamicObject entry : entries) {
|
||||
Date tqq9_clnenddate = entry.getDate("tqq9_clnenddate");
|
||||
int tqq9_xdpwsxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_clnenddate, new Date());
|
||||
entry.set("tqq9_xdpwsxkzts", tqq9_xdpwsxkzts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package tqq9.lc123.cloud.app.plugin.task;
|
|||
|
||||
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.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
|
|
@ -17,10 +18,12 @@ import tqq9.lc123.cloud.app.plugin.utils.DateDifferenceCalculator;
|
|||
import tqq9.lc123.cloud.app.plugin.utils.EmailUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 供应商、注册证证照时间到期时间计算并发送预警邮件
|
||||
* 增加生产商、采购合同
|
||||
*/
|
||||
public class DaysRemainingTask extends AbstractTask implements Plugin {
|
||||
private final static Log logger = LogFactory.getLog(DaysRemainingTask.class);
|
||||
|
|
@ -32,6 +35,8 @@ public class DaysRemainingTask extends AbstractTask implements Plugin {
|
|||
if(StringUtils.isNotBlank(warnDaysStr)){
|
||||
warnDays = Integer.valueOf(warnDaysStr);
|
||||
}
|
||||
//key:用户编码,value:邮箱
|
||||
Map<String, String> emailMap = new HashMap<>();
|
||||
//供应商
|
||||
QFilter f1 = new QFilter("enable", QCP.equals, "1");
|
||||
QFilter f2 = new QFilter("status", QCP.equals, "C");
|
||||
|
|
@ -192,14 +197,24 @@ public class DaysRemainingTask extends AbstractTask implements Plugin {
|
|||
if(StringUtils.isNotBlank(sb.toString())){
|
||||
DynamicObject creator = supplier.getDynamicObject("creator");//创建人
|
||||
if(creator != null){
|
||||
String emailAddress = creator.getString("email");//创建人邮箱
|
||||
String emailAddress = null;
|
||||
String creatorNumber = creator.getString("number");
|
||||
if(emailMap.containsKey(creatorNumber)){
|
||||
emailAddress = emailMap.get(creatorNumber);
|
||||
}else{
|
||||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),
|
||||
creator.getDynamicObjectType().getName(), "name,email");
|
||||
emailAddress = creator.getString("email");
|
||||
}
|
||||
if(StringUtils.isNotBlank(emailAddress)){
|
||||
emailMap.put(creatorNumber, emailAddress);
|
||||
String warnStr = "供应商【编码:"+number+",名称:"+name+"】证照到期提醒:"+ sb;
|
||||
EmailUtils.sendEmail(emailAddress, warnStr, "供应商证照到期提醒");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveServiceHelper.save(suppliers);
|
||||
|
||||
//注册证
|
||||
DynamicObject[] tqq9_registration = BusinessDataServiceHelper.load("tqq9_registration",
|
||||
|
|
@ -219,14 +234,150 @@ public class DaysRemainingTask extends AbstractTask implements Plugin {
|
|||
String warnStr = "商品注册证【编码:"+number+",名称:"+name+"】证照到期提醒:距离过期时间还剩余 " + remainingDays + " 天。";
|
||||
DynamicObject creator = dynamicObject.getDynamicObject("creator");
|
||||
if(creator != null){
|
||||
String emailAddress = creator.getString("email");
|
||||
EmailUtils.sendEmail(emailAddress, warnStr, "商品注册证到期提醒");
|
||||
String emailAddress = null;
|
||||
String creatorNumber = creator.getString("number");
|
||||
if(emailMap.containsKey(creatorNumber)){
|
||||
emailAddress = emailMap.get(creatorNumber);
|
||||
}else{
|
||||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),
|
||||
creator.getDynamicObjectType().getName(), "name,email");
|
||||
emailAddress = creator.getString("email");
|
||||
}
|
||||
if(StringUtils.isNotBlank(emailAddress)){
|
||||
emailMap.put(creatorNumber, emailAddress);
|
||||
EmailUtils.sendEmail(emailAddress, warnStr, "商品注册证到期提醒");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveServiceHelper.save(suppliers);
|
||||
SaveServiceHelper.save(tqq9_registration);
|
||||
|
||||
//生产商
|
||||
DynamicObject[] proxyandfactoryArr = BusinessDataServiceHelper.load("tqq9_proxyandfactory",
|
||||
"id,name,number,creator," +
|
||||
"tqq9_taxno,tqq9_prolicense,tqq9_saleno,tqq9_safeno,tqq9_beautyno," +
|
||||
"tqq9_taxenddate,tqq9_proenddate,tqq9_saleenddate,tqq9_safeenddate,tqq9_beautyenddate," +
|
||||
"tqq9_yyzzts,tqq9_qxscxkzts,tqq9_qxjyxkzts,tqq9_fsaqxkzts,tqq9_hzpxkzts," +
|
||||
"tqq9_clnentry.tqq9_clnenddate,tqq9_clnentry.tqq9_xdpwsxkzts",
|
||||
new QFilter[]{f1, f2});
|
||||
for (DynamicObject proxyandfactory : proxyandfactoryArr) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
String name = proxyandfactory.getString("name");
|
||||
String number = proxyandfactory.getString("number");
|
||||
//营业执照税号
|
||||
String tqq9_taxno = proxyandfactory.getString("tqq9_taxno");
|
||||
Date tqq9_taxenddate = proxyandfactory.getDate("tqq9_taxenddate");
|
||||
int tqq9_yyzzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_taxenddate, currentDate);
|
||||
proxyandfactory.set("tqq9_yyzzts", tqq9_yyzzts);
|
||||
if(tqq9_yyzzts <= warnDays){
|
||||
msg.append("营业执照税号 ").append(tqq9_taxno).append(" ,距离过期时间还剩余 ").append(tqq9_yyzzts).append(" 天。");
|
||||
}
|
||||
|
||||
//医疗器械生产许可证号
|
||||
String tqq9_prolicense = proxyandfactory.getString("tqq9_prolicense");
|
||||
Date tqq9_proenddate = proxyandfactory.getDate("tqq9_proenddate");
|
||||
int tqq9_qxscxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_proenddate, currentDate);
|
||||
proxyandfactory.set("tqq9_qxscxkzts", tqq9_qxscxkzts);
|
||||
if(tqq9_qxscxkzts <= warnDays){
|
||||
msg.append("医疗器械生产许可证号 ").append(tqq9_prolicense).append(" ,距离过期时间还剩余 ").append(tqq9_qxscxkzts).append(" 天。");
|
||||
}
|
||||
|
||||
//医疗器械经营许可证号
|
||||
String tqq9_saleno = proxyandfactory.getString("tqq9_saleno");
|
||||
Date tqq9_saleenddate = proxyandfactory.getDate("tqq9_saleenddate");
|
||||
int tqq9_qxjyxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_saleenddate, currentDate);
|
||||
proxyandfactory.set("tqq9_qxjyxkzts", tqq9_qxjyxkzts);
|
||||
if(tqq9_qxjyxkzts <= warnDays){
|
||||
msg.append("医疗器械经营许可证号 ").append(tqq9_saleno).append(" ,距离过期时间还剩余 ").append(tqq9_qxjyxkzts).append(" 天。");
|
||||
}
|
||||
|
||||
//辐射安全许可证号
|
||||
String tqq9_safeno = proxyandfactory.getString("tqq9_safeno");
|
||||
Date tqq9_safeenddate = proxyandfactory.getDate("tqq9_safeenddate");
|
||||
int tqq9_fsaqxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_safeenddate, currentDate);
|
||||
proxyandfactory.set("tqq9_fsaqxkzts", tqq9_fsaqxkzts);
|
||||
if(tqq9_fsaqxkzts <= warnDays){
|
||||
msg.append("辐射安全许可证号 ").append(tqq9_safeno).append(" ,距离过期时间还剩余 ").append(tqq9_fsaqxkzts).append(" 天。");
|
||||
}
|
||||
|
||||
//化妆品许可证号
|
||||
String tqq9_beautyno = proxyandfactory.getString("tqq9_beautyno");
|
||||
Date tqq9_beautyenddate = proxyandfactory.getDate("tqq9_beautyenddate");
|
||||
int tqq9_hzpxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_beautyenddate, currentDate);
|
||||
proxyandfactory.set("tqq9_hzpxkzts", tqq9_hzpxkzts);
|
||||
if(tqq9_hzpxkzts <= warnDays){
|
||||
msg.append("化妆品许可证号 ").append(tqq9_beautyno).append(" ,距离过期时间还剩余 ").append(tqq9_hzpxkzts).append(" 天。");
|
||||
}
|
||||
|
||||
//消毒产品生产企业卫生许可证号
|
||||
DynamicObjectCollection entries = proxyandfactory.getDynamicObjectCollection("tqq9_clnentry");
|
||||
for (DynamicObject entry : entries) {
|
||||
String tqq9_clnno = entry.getString("tqq9_clnno");
|
||||
Date tqq9_clnenddate = entry.getDate("tqq9_clnenddate");
|
||||
int tqq9_xdpwsxkzts = DateDifferenceCalculator.calculateRemainingDays(tqq9_clnenddate, currentDate);
|
||||
entry.set("tqq9_xdpwsxkzts", tqq9_xdpwsxkzts);
|
||||
if(tqq9_xdpwsxkzts <= warnDays){
|
||||
msg.append("消毒产品生产企业卫生许可证号 ").append(tqq9_clnno).append(" ,距离过期时间还剩余 ").append(tqq9_xdpwsxkzts).append(" 天。");
|
||||
}
|
||||
}
|
||||
|
||||
if(msg != null && msg.toString().length() > 0){
|
||||
DynamicObject creator = proxyandfactory.getDynamicObject("creator");
|
||||
if(creator != null){
|
||||
String emailAddress = null;
|
||||
String creatorNumber = creator.getString("number");
|
||||
if(emailMap.containsKey(creatorNumber)){
|
||||
emailAddress = emailMap.get(creatorNumber);
|
||||
}else{
|
||||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),
|
||||
creator.getDynamicObjectType().getName(), "name,email");
|
||||
emailAddress = creator.getString("email");
|
||||
}
|
||||
if(StringUtils.isNotBlank(emailAddress)){
|
||||
String warnStr = "生产商【编码:"+number+",名称:"+name+"】证照到期提醒:" + msg;
|
||||
emailMap.put(creatorNumber, emailAddress);
|
||||
EmailUtils.sendEmail(emailAddress, warnStr, "生产商到期提醒");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveServiceHelper.save(proxyandfactoryArr);
|
||||
|
||||
//采购合同
|
||||
DynamicObject[] purcontractArr = BusinessDataServiceHelper.load("conm_purcontract",
|
||||
"id,name,number,creator,biztimeend,tqq9_syyxts",
|
||||
new QFilter[]{f1, f2});
|
||||
for (DynamicObject purcontract : purcontractArr) {
|
||||
String name = purcontract.getString("name");
|
||||
String number = purcontract.getString("number");
|
||||
Date biztimeend = purcontract.getDate("biztimeend");
|
||||
int tqq9_syyxts = DateDifferenceCalculator.calculateRemainingDays(biztimeend, currentDate);
|
||||
purcontract.set("tqq9_syyxts", tqq9_syyxts);
|
||||
|
||||
if(tqq9_syyxts <= warnDays){
|
||||
DynamicObject creator = purcontract.getDynamicObject("creator");
|
||||
if(creator != null){
|
||||
String emailAddress = null;
|
||||
String creatorNumber = creator.getString("number");
|
||||
if(emailMap.containsKey(creatorNumber)){
|
||||
emailAddress = emailMap.get(creatorNumber);
|
||||
}else{
|
||||
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),
|
||||
creator.getDynamicObjectType().getName(), "name,email");
|
||||
emailAddress = creator.getString("email");
|
||||
}
|
||||
if(StringUtils.isNotBlank(emailAddress)){
|
||||
StringBuilder warnStr = new StringBuilder();
|
||||
warnStr.append("采购合同【编码:"+number+",名称:"+name+"】证照到期提醒:").append("距离过期时间还剩余 ").append(tqq9_syyxts).append(" 天。");
|
||||
emailMap.put(creatorNumber, emailAddress);
|
||||
EmailUtils.sendEmail(emailAddress, warnStr.toString(), "采购合同提醒");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveServiceHelper.save(purcontractArr);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue