parent
35bba33183
commit
5863306307
@ -1,7 +1,10 @@
|
|||||||
package com.yem.wm.es.storagetrans.form;
|
package com.yem.wm.es.storagetrans.form;
|
||||||
|
|
||||||
import com.yem.or.utils.OrderApiUtils;
|
import com.yem.or.utils.OrderApiUtils;
|
||||||
|
import com.yem.wm.es.Util.PlanJobCMMP;
|
||||||
import com.yem.wm.es.Util.TotalUtil;
|
import com.yem.wm.es.Util.TotalUtil;
|
||||||
|
import com.yem.wm.es.Util.ViewInterfaceDocking;
|
||||||
|
import com.yem.wm.es.Util.ZJUtils;
|
||||||
import com.yem.wm.es.contactbook.op.ContactBookSaveOp;
|
import com.yem.wm.es.contactbook.op.ContactBookSaveOp;
|
||||||
import com.yem.wm.es.salesorder.utils.SalesOrderUtils;
|
import com.yem.wm.es.salesorder.utils.SalesOrderUtils;
|
||||||
import com.yem.wm.utils.CalendarUtils;
|
import com.yem.wm.utils.CalendarUtils;
|
||||||
@ -643,6 +646,58 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele
|
|||||||
String operateKey = formOperate.getOperateKey();
|
String operateKey = formOperate.getOperateKey();
|
||||||
DynamicObject dataEntity = model.getDataEntity(true);
|
DynamicObject dataEntity = model.getDataEntity(true);
|
||||||
IFormView view = this.getView();
|
IFormView view = this.getView();
|
||||||
|
if (operateKey.equals("getmachine")) {
|
||||||
|
// ZJUtils.renewMachineProductInfo(view, model);
|
||||||
|
// renewMachineProductInfo();
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
Set<String> resourcesCodeSet = new HashSet();
|
||||||
|
Set<String> vehicleNoSet = new HashSet();
|
||||||
|
int machineProductInfoRows = model.getEntryRowCount("yem_es_salesorder_z");
|
||||||
|
for (int i = 0; i < machineProductInfoRows; i++) {
|
||||||
|
DynamicObject resourcesCode = (DynamicObject) model.getValue("yem_resourcescode", i);
|
||||||
|
if (YEM.isNotEmpty(resourcesCode)) {
|
||||||
|
resourcesCodeSet.add(resourcesCode.getString("number"));
|
||||||
|
}
|
||||||
|
String vehicleNo = (String) model.getValue("yem_vehicleno", i);
|
||||||
|
vehicleNoSet.add(vehicleNo);
|
||||||
|
}
|
||||||
|
if (resourcesCodeSet.size() > 0) {
|
||||||
|
map.put(PlanJobCMMP.productCode, resourcesCodeSet);
|
||||||
|
}
|
||||||
|
if (vehicleNoSet.size() > 0) {
|
||||||
|
map.put(PlanJobCMMP.planPin, vehicleNoSet);
|
||||||
|
}
|
||||||
|
int rowIndex = this.getModel().getEntryCurrentRowIndex("yem_es_materialinfo");
|
||||||
|
long productsid = this.getModel().getEntryEntity("yem_es_materialinfo").get(rowIndex).getDynamicObject("yem_products").getLong("id");
|
||||||
|
List<Map> dockings = ViewInterfaceDocking.docking(ViewInterfaceDocking.PLAN_JOB, map, productsid);
|
||||||
|
|
||||||
|
if (YEM.isNotEmpty(dockings)) {
|
||||||
|
dockings.sort(new Comparator<Map>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Map o1, Map o2) {
|
||||||
|
Date date1 = (Date) o1.get(PlanJobCMMP.jobTime);
|
||||||
|
Date date2 = (Date) o1.get(PlanJobCMMP.jobTime);
|
||||||
|
return date1.compareTo(date2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (int i = 0; i < machineProductInfoRows; i++) {
|
||||||
|
DynamicObject resourcesCodeObj = (DynamicObject) model.getValue("yem_resourcescode", i);
|
||||||
|
String resourcesCode = YEM.isNotEmpty(resourcesCodeObj) ? resourcesCodeObj.getString("number") : "";
|
||||||
|
String vehicleNo = (String) model.getValue("yem_vehicleno", i);
|
||||||
|
for (Map docking : dockings) {
|
||||||
|
String planPin = (String) docking.get(PlanJobCMMP.planPin);
|
||||||
|
String productCode = (String) docking.get(PlanJobCMMP.productCode);
|
||||||
|
if (resourcesCode.equals(productCode) && vehicleNo.equals(planPin)) {
|
||||||
|
model.setValue("yem_engineno", docking.get(PlanJobCMMP.stockBatch), i);//发动机号
|
||||||
|
model.setValue("yem_enginemodel", docking.get(PlanJobCMMP.specification), i);//发动机型号
|
||||||
|
model.setValue("yem_enginevendor", docking.get(PlanJobCMMP.supName), i);//发动机厂商
|
||||||
|
ZJUtils.setInstructionValue(model, docking, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
view.invokeOperation("save");
|
||||||
|
}
|
||||||
if ("draw".equals(operateKey)) {
|
if ("draw".equals(operateKey)) {
|
||||||
String creditbackstatus = dataEntity.getString("yem_creditbackstatus");
|
String creditbackstatus = dataEntity.getString("yem_creditbackstatus");
|
||||||
if ("A".equals(creditbackstatus)) {
|
if ("A".equals(creditbackstatus)) {
|
||||||
@ -659,50 +714,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ("creditconfirm".equals(operateKey)) {
|
if ("creditconfirm".equals(operateKey)) {
|
||||||
// DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("yem_creditdetail");
|
|
||||||
// if (dynamicObjectCollection.size()>0){
|
|
||||||
// Map<Long,BigDecimal> map = new HashMap<>();
|
|
||||||
// for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
|
||||||
// DynamicObject yemSalecontractno = dynamicObject.getDynamicObject("yem_salecontractno");
|
|
||||||
// BigDecimal yemCreditamtCd = dynamicObject.getBigDecimal("yem_creditamt_cd");
|
|
||||||
// if (yemSalecontractno!=null){
|
|
||||||
// long aLong = yemSalecontractno.getLong("id");
|
|
||||||
// if (map.get(aLong)!=null){
|
|
||||||
// BigDecimal bigDecimal = map.get(aLong);
|
|
||||||
// map.put(aLong, yemCreditamtCd.add(bigDecimal));
|
|
||||||
// }else {
|
|
||||||
// map.put(aLong, yemCreditamtCd);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
|
||||||
// DynamicObject yemSalecontractno = dynamicObject.getDynamicObject("yem_salecontractno");
|
|
||||||
// if (yemSalecontractno!=null){
|
|
||||||
// long aLong = yemSalecontractno.getLong("id");
|
|
||||||
// BigDecimal bigDecimal = map.get(aLong);
|
|
||||||
// String selectfield = DynamicObjectUtil.getSelectfields("yem_es_salesorder", false);
|
|
||||||
// String selectfields = DynamicObjectUtil.getEntrySelectfields(selectfield, "yem_es_salesorder", "yem_es_salescontrac_s", false);
|
|
||||||
// DynamicObject yemEsSalesorder = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", selectfields
|
|
||||||
// , new QFilter[]{new QFilter("id", QCP.equals, aLong)});
|
|
||||||
// if (yemEsSalesorder != null) {
|
|
||||||
// DynamicObjectCollection yemEsMaterialinfo = yemEsSalesorder.getDynamicObjectCollection("yem_es_salescontrac_s");
|
|
||||||
// if (yemEsMaterialinfo.size()>0){
|
|
||||||
// BigDecimal salescontrac = BigDecimal.ZERO;
|
|
||||||
// for (DynamicObject object : yemEsMaterialinfo) {
|
|
||||||
// boolean yemIspre = object.getBoolean("yem_ispre");
|
|
||||||
// if (!yemIspre){
|
|
||||||
// salescontrac = salescontrac.add(object.getBigDecimal("yem_rapamt"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (salescontrac.compareTo(bigDecimal)<0){
|
|
||||||
// view.showTipNotification(yemEsSalesorder.getString("billno")+"非预收收汇金额不足,请修改金额!!!");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
int rowCount = model.getEntryRowCount("yem_creditdetail");
|
int rowCount = model.getEntryRowCount("yem_creditdetail");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < rowCount; i++) {
|
for (int i = 0; i < rowCount; i++) {
|
||||||
@ -717,6 +729,13 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele
|
|||||||
DynamicObject company = dataEntity.getDynamicObject("yem_company.yem_erporg");
|
DynamicObject company = dataEntity.getDynamicObject("yem_company.yem_erporg");
|
||||||
String swiftCode = TotalUtil.getSwiftCode(dataEntity);
|
String swiftCode = TotalUtil.getSwiftCode(dataEntity);
|
||||||
DynamicObject csrCreditLine = TotalUtil.getCsrCreditLine(customer, method, company, swiftCode);
|
DynamicObject csrCreditLine = TotalUtil.getCsrCreditLine(customer, method, company, swiftCode);
|
||||||
|
if (YEM.isEmpty(csrCreditLine)) {
|
||||||
|
sb.append("未找到该客户的信保额度申请,请检查额度申请是否存在,是否已审核!\r\n");
|
||||||
|
e.setCancel(true);
|
||||||
|
view.showErrorNotification(sb.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 剩余限额
|
// 剩余限额
|
||||||
BigDecimal balance = csrCreditLine.getBigDecimal("yem_balance");
|
BigDecimal balance = csrCreditLine.getBigDecimal("yem_balance");
|
||||||
if (stcreditpreamt_cd.compareTo(preamt_cd) < 0) {
|
if (stcreditpreamt_cd.compareTo(preamt_cd) < 0) {
|
||||||
@ -744,13 +763,17 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele
|
|||||||
balance.setScale(2, RoundingMode.HALF_UP)));
|
balance.setScale(2, RoundingMode.HALF_UP)));
|
||||||
}
|
}
|
||||||
BigDecimal attcount = dataEntity.getBigDecimal("yem_attcount");
|
BigDecimal attcount = dataEntity.getBigDecimal("yem_attcount");
|
||||||
|
BigDecimal yemPreradioCd = BigDecimal.ZERO;
|
||||||
|
DynamicObjectCollection yemCreditdetail = dataEntity.getDynamicObjectCollection("yem_creditdetail");
|
||||||
|
if (!yemCreditdetail.isEmpty()) {
|
||||||
|
for (DynamicObject dynamicObject : yemCreditdetail) {
|
||||||
|
yemPreradioCd = yemPreradioCd.add(dynamicObject.getBigDecimal("yem_preradio_cd"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (yemPreradioCd.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
if (attcount.compareTo(BigDecimal.ZERO) == 0) {
|
if (attcount.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
sb.append(String.format("未上传客户汇款水单附件,不能进行信保确认!\n\r"));
|
sb.append(String.format("未上传客户汇款水单附件,不能进行信保确认!\n\r"));
|
||||||
}
|
}
|
||||||
if (csrCreditLine != null && customer != null) {
|
|
||||||
} else {
|
|
||||||
sb.append(String.format("当前客户不存在信保额度申请,不允许进行信保确认\n\r"));
|
|
||||||
// view.showErrorNotification("当前客户不存在信保额度申请,不允许进行信保确认");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
package com.yem.wm.es.storagetrans.form;
|
package com.yem.wm.es.storagetrans.form;
|
||||||
|
|
||||||
|
import com.yem.wm.utils.DynamicObjectUtil;
|
||||||
import com.yem.wm.utils.YEM;
|
import com.yem.wm.utils.YEM;
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.metadata.IDataEntityProperty;
|
|
||||||
import kd.bos.entity.datamodel.IDataModel;
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
import kd.bos.entity.datamodel.events.ChangeData;
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.entity.operate.result.OperationResult;
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.form.IFormView;
|
import kd.bos.form.IFormView;
|
||||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.form.operate.FormOperate;
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -46,18 +47,6 @@ public class StorageTransEdit_xbs extends AbstractBillPlugIn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeDoOperation(BeforeDoOperationEventArgs e) {
|
|
||||||
super.beforeDoOperation(e);
|
|
||||||
FormOperate source = (FormOperate) e.getSource();
|
|
||||||
String operateKey = source.getOperateKey();
|
|
||||||
IDataModel model = this.getModel();
|
|
||||||
IFormView view = this.getView();
|
|
||||||
if ("creditconfirm".equals(operateKey)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterDoOperation(AfterDoOperationEventArgs e) {
|
public void afterDoOperation(AfterDoOperationEventArgs e) {
|
||||||
super.afterDoOperation(e);
|
super.afterDoOperation(e);
|
||||||
@ -71,7 +60,7 @@ public class StorageTransEdit_xbs extends AbstractBillPlugIn {
|
|||||||
for (DynamicObject dynamicObject : collection) {
|
for (DynamicObject dynamicObject : collection) {
|
||||||
Date yemYearE = dynamicObject.getDate("yem_year_e");
|
Date yemYearE = dynamicObject.getDate("yem_year_e");
|
||||||
if (yemYearE != null) {
|
if (yemYearE != null) {
|
||||||
dynamicObject.set("yem_creditstatus_e", "A");
|
extracted(dynamicObject, "A", dataEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SaveServiceHelper.update(dataEntity);
|
SaveServiceHelper.update(dataEntity);
|
||||||
@ -81,11 +70,34 @@ public class StorageTransEdit_xbs extends AbstractBillPlugIn {
|
|||||||
if ("statusconvert_un_s".equals(operateKey)) {
|
if ("statusconvert_un_s".equals(operateKey)) {
|
||||||
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_creditdetail");
|
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_creditdetail");
|
||||||
for (DynamicObject dynamicObject : collection) {
|
for (DynamicObject dynamicObject : collection) {
|
||||||
dynamicObject.set("yem_creditstatus_e", "B");
|
extracted(dynamicObject, "B", dataEntity);
|
||||||
}
|
}
|
||||||
SaveServiceHelper.update(dataEntity);
|
SaveServiceHelper.update(dataEntity);
|
||||||
view.invokeOperation("refresh");
|
view.invokeOperation("refresh");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void extracted(DynamicObject dynamicObject, String B, DynamicObject dataEntity) {
|
||||||
|
long id = dynamicObject.getLong("id");
|
||||||
|
dynamicObject.set("yem_creditstatus_e", B);
|
||||||
|
String billno = dataEntity.getString("billno");
|
||||||
|
String selectfield = DynamicObjectUtil.getSelectfields("yem_im_csrcreditline", false);
|
||||||
|
String selectfields = DynamicObjectUtil.getEntrySelectfields(selectfield, "yem_im_csrcreditline", "yem_im_info", false);
|
||||||
|
DynamicObject yemImCsrcreditline = BusinessDataServiceHelper.loadSingle("yem_im_csrcreditline", selectfields
|
||||||
|
, new QFilter[]{new QFilter("yem_im_info.yem_storagetransno.billno", QCP.equals, billno)});
|
||||||
|
if (yemImCsrcreditline != null) {
|
||||||
|
DynamicObjectCollection yemImInfo = yemImCsrcreditline.getDynamicObjectCollection("yem_im_info");
|
||||||
|
if (YEM.isNotEmpty(yemImInfo)) {
|
||||||
|
for (DynamicObject dynamicObjects : yemImInfo) {
|
||||||
|
Long yemStoragetransno = dynamicObjects.getLong("yem_storagetranentryid");
|
||||||
|
if (yemStoragetransno == id) {
|
||||||
|
dynamicObjects.set("yem_creditstatus_e", B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SaveServiceHelper.update(yemImCsrcreditline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user