1.日志接口,返利规则,入库调整,退货补货调整

This commit is contained in:
龚豆豆 2025-11-03 16:25:12 +08:00
parent d624616a26
commit d463687681
7 changed files with 112 additions and 23 deletions

View File

@ -471,9 +471,16 @@ public class WMSPurInController {
}
}
int i=0;
//回传成功
int failCount = 0;//失败数量
int successCount = 1;//成功数量
if(results.size()>0){
boolean billStatus = results.get(0).isBillStatus();
if (!billStatus){
i=1;
}
}
int failCount = i;//失败数量
int successCount = 1-i;//成功数量
resultExt.setFailCount(failCount);
resultExt.setSuccessCount(successCount);
resultExt.setResult(results);

View File

@ -12,6 +12,7 @@ public class Constants {
//操作类型
public static final String TYPE_SAVE = "save"; //保存类型
public static final String TYPE_DELETE = "delete"; //保存类型
public static final String TYPE_PUSH = "push"; //下推类型
public static final String TYPE_SUBMIT = "submit"; //提交类型
public static final String TYPE_AUDIT = "audit"; //审核类型

View File

@ -1,6 +1,6 @@
package tqq9.lc123.cloud.app.eip.iscb;
public interface LCLogService {
public void savelog(String interfaceName,String interfaceUrl,Boolean isPost,Boolean isSucess,String request,String response);
public void savelog(String interfaceName,String interfaceUrl,Boolean isPost,Boolean isSucess,String request,String response);
}

View File

@ -1,11 +1,14 @@
package tqq9.lc123.cloud.app.plugin.form.conm;
import kd.bos.bill.BillShowParameter;
import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.BeforeDeleteRowEventArgs;
import kd.bos.entity.operate.result.IOperateInfo;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.form.CloseCallBack;
import kd.bos.form.ShowType;
import kd.bos.form.StyleCss;
@ -21,6 +24,8 @@ import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.DeleteServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import tqq9.lc123.cloud.app.api.utils.Constants;
import java.math.BigDecimal;
import java.util.*;
@ -59,6 +64,24 @@ public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements H
String name = dynamicObject.getString("tqq9_rulename");
if (tqq9_pur_rebate.getString("status").equals("A")) {
rebate.add(tqq9_pur_rebate.getLong("id"));
OperateOption option = OperateOption.create();
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, "tqq9_pur_rebate", new DynamicObject[]{tqq9_pur_rebate}, option);
if (!sumbitResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo.size() != 0) {
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
this.getView().showMessage("名称为:'" + name + "'的返利规则删除失败,原因为:"+iOperateInfo);
}
} else if (StringUtils.isNotBlank(sumbitResult.getMessage())) {
this.getView().showMessage("名称为:'" + name + "'的返利规则删除失败,原因为:"+sumbitResult.getMessage());
} else {
this.getView().showMessage("名称为:'" + name + "'的返利规则删除失败,原因为:"+sumbitResult.getInteractionContext().getSimpleMessage());
}
}else{
this.getView().showMessage("名称为:'" + name + "'的返利规则删除成功");
}
} else {
this.getView().showMessage("名称为:'" + name + "'的返利规则为非暂存状态,无法删除");
e.setCancel(true);

View File

@ -13,6 +13,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
@ -35,12 +36,12 @@ public class OtherInIotManagePlugin extends AbstractOperationServicePlugIn imple
for (DynamicObject dataEntity : e.getDataEntities()) {
String billno = dataEntity.getString("billno");
QFilter qFilter = new QFilter("billno", QCP.equals, billno);
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("im_otherinbill",
"billentry.producedate,billentry.expirydate,billentry.lotnumber,billentry.tqq9_registration,billentry.material",
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("im_purinbill",
"billentry.producedate,billentry.expirydate,billentry.lotnumber,billentry.tqq9_zczh,billentry.material,billentry.warehouse,billentry.lot,billentry.qty,billentry.tqq9_goods",
qFilter.toArray());
DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry");
// DynamicObject[] tqq9_goodlotmanages=new DynamicObject[billentry.size()];
boolean falg=false;
boolean falg = false;
DynamicObjectCollection tqq9_goodlotmanages = new DynamicObjectCollection();
for (int i = 0; i < billentry.size(); i++) {
@ -56,29 +57,86 @@ public class OtherInIotManagePlugin extends AbstractOperationServicePlugIn imple
DynamicObject tqq9_brand = material.getDynamicObject("tqq9_brand");//商品品牌
String number = material.getString("number");//商品编码
String name = null;
if(tqq9_registration!=null){
name=tqq9_registration.getString("name");
if (tqq9_registration != null) {
name = tqq9_registration.getString("name");
}
tqq9_goodlotmanage.set("number",number);//商品编码
tqq9_goodlotmanage.set("tqq9_lot",lotnumber);//批号
tqq9_goodlotmanage.set("number", number);//商品编码
tqq9_goodlotmanage.set("tqq9_lot", lotnumber);//批号
tqq9_goodlotmanage.set("name",name);//商品注册证名称
tqq9_goodlotmanage.set("tqq9_brand",tqq9_brand);//商品品牌
tqq9_goodlotmanage.set("tqq9_crreatdate",producedate);//生产日期
tqq9_goodlotmanage.set("tqq9_invaliddate",expirydate);//到期日期
tqq9_goodlotmanage.set("status","C");//数据状态
tqq9_goodlotmanage.set("enable","1");//使用状态
tqq9_goodlotmanage.set("name", name);//商品注册证名称
tqq9_goodlotmanage.set("tqq9_brand", tqq9_brand);//商品品牌
tqq9_goodlotmanage.set("tqq9_crreatdate", producedate);//生产日期
tqq9_goodlotmanage.set("tqq9_invaliddate", expirydate);//到期日期
tqq9_goodlotmanage.set("status", "C");//数据状态
tqq9_goodlotmanage.set("enable", "1");//使用状态
QFilter f1 = new QFilter("number", QCP.equals, number);
QFilter f2 = new QFilter("tqq9_lot", QCP.equals, lotnumber);
QFilter f3 = new QFilter("tqq9_crreatdate", QCP.equals, producedate);
QFilter f4 = new QFilter("tqq9_invaliddate", QCP.equals, expirydate);
DynamicObject tqq9_goodlotmanage1 = BusinessDataServiceHelper.loadSingle("tqq9_goodlotmanage",new QFilter[]{f1,f2,f3,f4});
if(tqq9_goodlotmanage1==null&& StringUtils.isNotBlank(lotnumber)){
falg=true;
DynamicObject tqq9_goodlotmanage1 = BusinessDataServiceHelper.loadSingle("tqq9_goodlotmanage", new QFilter[]{f1, f2, f3, f4});
if (tqq9_goodlotmanage1 == null && StringUtils.isNotBlank(lotnumber)) {
falg = true;
tqq9_goodlotmanages.add(tqq9_goodlotmanage);
}
String warehouseNumber = null;
DynamicObject warehouse = entry.getDynamicObject("warehouse");
if (warehouse != null) {
warehouseNumber = warehouse.getString("number");
}
// 将入库物料的批次信息写到商品明细中
DynamicObject tqq9_goods = entry.getDynamicObject("tqq9_goods");
if (tqq9_goods != null) {
tqq9_goods = BusinessDataServiceHelper.loadSingle(tqq9_goods.getPkValue(), tqq9_goods.getDynamicObjectType().getName());
// 物料已经被封装成了商品
boolean isExistEntry = false;//在明细中是否能找到对应的商品信息
DynamicObjectCollection entryies = tqq9_goods.getDynamicObjectCollection("tqq9_entry");
for (DynamicObject entry1 : entryies) {
String lotNumber = null;
DynamicObject tqq9_lot = entry1.getDynamicObject("tqq9_lot");
if (tqq9_lot != null) {
lotNumber = tqq9_lot.getString("number");
}
String whNumber = "";
DynamicObject wh = entry1.getDynamicObject("tqq9_basedatafield");
if (wh != null) {
whNumber = wh.getString("number");
}
Date tqq9_productdate = entry1.getDate("tqq9_productdate");
Date tqq9_todate = entry1.getDate("tqq9_todate");
if ((( kd.bos.dataentity.utils.StringUtils.isBlank(lotNumber) && kd.bos.dataentity.utils.StringUtils.isBlank(lotnumber)) || (lotNumber != null&&lotNumber.equals(lotnumber)))
&& ((kd.bos.dataentity.utils.StringUtils.isBlank(whNumber) && kd.bos.dataentity.utils.StringUtils.isBlank(warehouseNumber)) || whNumber.equals(warehouseNumber))
&& ((tqq9_productdate == null && producedate == null) || (tqq9_productdate.equals(producedate)))
&& ((tqq9_todate == null && expirydate == null) || (tqq9_todate.equals(expirydate)))) {
// 如果现有的商品数据存在
BigDecimal tqq9_availablestock = entry1.getBigDecimal("tqq9_availablestock");
entry1.set("tqq9_availablestock", tqq9_availablestock.add(entry.getBigDecimal("qty")));
BigDecimal tqq9_upstock = entry1.getBigDecimal("tqq9_upstock");
entry1.set("tqq9_upstock", tqq9_upstock.add(entry.getBigDecimal("qty")));
isExistEntry = true;
}
if (isExistEntry) {
break;
}
}
if (!isExistEntry) {
DynamicObject entry1 = entryies.addNew();
entry1.set("tqq9_lot", entry.getDynamicObject("lot"));//批号
entry1.set("tqq9_basedatafield", warehouse);//仓库
entry1.set("tqq9_productdate", producedate);//生产日期
entry1.set("tqq9_todate", expirydate);//到期日期
entry1.set("tqq9_availablestock", entry.getBigDecimal("qty"));//到期日期
entry1.set("tqq9_upstock", entry.getBigDecimal("qty"));//到期日期
}
SaveServiceHelper.save(new DynamicObject[]{tqq9_goods});
}
}
if(falg){
if (falg) {
DynamicObject[] objects = new DynamicObject[tqq9_goodlotmanages.size()];
for (int i = 0; i < tqq9_goodlotmanages.size(); i++) {
objects[i] = tqq9_goodlotmanages.get(i);

View File

@ -71,7 +71,7 @@ public class PurInIotManagePlugin extends AbstractOperationServicePlugIn impleme
QFilter f3 = new QFilter("tqq9_crreatdate", QCP.equals, producedate);
QFilter f4 = new QFilter("tqq9_invaliddate", QCP.equals, expirydate);
DynamicObject tqq9_goodlotmanage1 = BusinessDataServiceHelper.loadSingle("tqq9_goodlotmanage", new QFilter[]{f1,f2,f3,f4});
if (tqq9_goodlotmanage1 == null && StringUtils.isNotBlank(lotnumber)) {
if (tqq9_goodlotmanage1 == null) {
falg = true;
tqq9_goodlotmanages.add(tqq9_goodlotmanage);
}
@ -103,7 +103,7 @@ public class PurInIotManagePlugin extends AbstractOperationServicePlugIn impleme
}
Date tqq9_productdate = entry1.getDate("tqq9_productdate");
Date tqq9_todate = entry1.getDate("tqq9_todate");
if(((StringUtils.isBlank(lotNumber) && StringUtils.isBlank(lotnumber)) || lotNumber.equals(lotnumber))
if(((StringUtils.isBlank(lotNumber) && StringUtils.isBlank(lotnumber)) || (lotNumber!=null&&lotNumber.equals(lotnumber)))
&& ((StringUtils.isBlank(whNumber) && StringUtils.isBlank(warehouseNumber)) || whNumber.equals(warehouseNumber))
&& ((tqq9_productdate == null && producedate == null) || (tqq9_productdate.equals(producedate)))
&& ((tqq9_todate == null && expirydate == null) || (tqq9_todate.equals(expirydate)))){

View File

@ -50,7 +50,7 @@ public class PurOrderPushReceiptNoticePlugin extends AbstractConvertPlugIn imple
if (jsonList != null) {
for (int i = 0; i < jsonList.size(); i++) {
HashMap<String, Object> jsonMap = jsonList.get(i);
BigDecimal entry_qty = (BigDecimal) jsonMap.get("qty");//类型
BigDecimal entry_qty = new BigDecimal(jsonMap.get("qty").toString()).negate();//入库数量
dynamicObject.set("qty", entry_qty);//数量
dynamicObject.set("baseqty", entry_qty);//基本数量
}