入库单优化
This commit is contained in:
		
							parent
							
								
									3b2f145c47
								
							
						
					
					
						commit
						c286a55d19
					
				| 
						 | 
					@ -414,10 +414,10 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void fieldLockLogic() {
 | 
					    public void fieldLockLogic() {
 | 
				
			||||||
        boolean isAdjustamount = this.getModel().getDataEntity().getBoolean("adjustamount");
 | 
					        boolean isAdjustamount = this.getModel().getDataEntity().getBoolean("adjustamount");//微调金额
 | 
				
			||||||
        boolean isAdjustoftax = this.getModel().getDataEntity().getBoolean("adjustoftax");
 | 
					        boolean isAdjustoftax = this.getModel().getDataEntity().getBoolean("adjustoftax");//微调税额
 | 
				
			||||||
        boolean isInputtaxprice = this.getModel().getDataEntity().getBoolean("inputtaxprice");
 | 
					        boolean isInputtaxprice = this.getModel().getDataEntity().getBoolean("inputtaxprice");//录入含税价
 | 
				
			||||||
        boolean isInputtotalprice = this.getModel().getDataEntity().getBoolean("inputtotalprice");
 | 
					        boolean isInputtotalprice = this.getModel().getDataEntity().getBoolean("inputtotalprice");//录入总价
 | 
				
			||||||
        DynamicObjectCollection entryentity = this.getView().getModel().getEntryEntity("entryentity");
 | 
					        DynamicObjectCollection entryentity = this.getView().getModel().getEntryEntity("entryentity");
 | 
				
			||||||
        if (entryentity.size() >= 1) {
 | 
					        if (entryentity.size() >= 1) {
 | 
				
			||||||
            int i;
 | 
					            int i;
 | 
				
			||||||
| 
						 | 
					@ -467,8 +467,8 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
 | 
				
			||||||
    protected void initFormPage(int rowIndex) {
 | 
					    protected void initFormPage(int rowIndex) {
 | 
				
			||||||
/*        this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "price", "ismainmaterial"});
 | 
					/*        this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "price", "ismainmaterial"});
 | 
				
			||||||
        this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "oftaxamount", "notaxamount"});//系统源码*/
 | 
					        this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "oftaxamount", "notaxamount"});//系统源码*/
 | 
				
			||||||
        this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "ismainmaterial", "notaxamount"});//二开修改添加金额字段,去除入库单价
 | 
					        this.getView().setEnable(true, rowIndex, new String[]{"lot", "lotid", "measureunit", "entrytaxrate", "price","ismainmaterial", "notaxamount"});//二开修改添加金额字段
 | 
				
			||||||
        this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "price", "oftaxamount"});//二开修改去除金额字段,添加入库单价
 | 
					        this.getView().setEnable(false, rowIndex, new String[]{"taxprice", "taxamount", "contprice", "oftaxamount"});//二开修改去除金额字段
 | 
				
			||||||
        Boolean poundIn = (Boolean) this.getModel().getValue("poundin");
 | 
					        Boolean poundIn = (Boolean) this.getModel().getValue("poundin");
 | 
				
			||||||
        this.getView().setEnable(!poundIn, rowIndex, new String[]{"material", "modelnum", "qty"});
 | 
					        this.getView().setEnable(!poundIn, rowIndex, new String[]{"material", "modelnum", "qty"});
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,8 @@ import kd.bos.dataentity.entity.DynamicObject;
 | 
				
			||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
					import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
				
			||||||
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
 | 
					import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
 | 
				
			||||||
import kd.bos.dataentity.resource.ResManager;
 | 
					import kd.bos.dataentity.resource.ResManager;
 | 
				
			||||||
 | 
					import kd.bos.entity.datamodel.RowDataEntity;
 | 
				
			||||||
 | 
					import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
 | 
				
			||||||
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.form.*;
 | 
					import kd.bos.form.*;
 | 
				
			||||||
| 
						 | 
					@ -70,6 +72,24 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void afterAddRow(AfterAddRowEventArgs e) {
 | 
				
			||||||
 | 
					        super.afterAddRow(e);
 | 
				
			||||||
 | 
					        String entryName = e.getEntryProp().getName();//新增行单据体名
 | 
				
			||||||
 | 
					        if ("entryentity".equals(entryName)) {
 | 
				
			||||||
 | 
					            //入库单明细-新增行
 | 
				
			||||||
 | 
					            Object invoice_type = this.getModel().getValue("zcgj_invoice_type");//发票类型
 | 
				
			||||||
 | 
					            if (invoice_type != null && invoice_type.equals("0")) {
 | 
				
			||||||
 | 
					                DynamicObject bd_taxrate = BusinessDataServiceHelper.loadSingle("bd_taxrate",
 | 
				
			||||||
 | 
					                        new QFilter[]{new QFilter("number", QCP.equals, "V0")});//税率-默认增值税0
 | 
				
			||||||
 | 
					                RowDataEntity[] rowDataEntities = e.getRowDataEntities();
 | 
				
			||||||
 | 
					                for (RowDataEntity rowDataEntity : rowDataEntities) {
 | 
				
			||||||
 | 
					                    int rowIndex = rowDataEntity.getRowIndex();
 | 
				
			||||||
 | 
					                    this.getModel().setValue("entrytaxrate", bd_taxrate, rowIndex);//入库单明细-税率
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void propertyChanged(PropertyChangedArgs e) {
 | 
					    public void propertyChanged(PropertyChangedArgs e) {
 | 
				
			||||||
        super.propertyChanged(e);
 | 
					        super.propertyChanged(e);
 | 
				
			||||||
| 
						 | 
					@ -192,11 +212,11 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
 | 
				
			||||||
            this.getView().updateView("transoftaxamount");
 | 
					            this.getView().updateView("transoftaxamount");
 | 
				
			||||||
            this.getView().updateView("totaloftaxamount");
 | 
					            this.getView().updateView("totaloftaxamount");
 | 
				
			||||||
            this.getModel().endInit();
 | 
					            this.getModel().endInit();
 | 
				
			||||||
        } else if ("oftaxamount".equals(key)) {
 | 
					        } else if ("oftaxamount".equals(key) || "taxprice".equals(key)) {
 | 
				
			||||||
            //入库单明细-含税金额
 | 
					            //入库单明细-含税金额、入库单明细-入库含税单价
 | 
				
			||||||
            boolean inputtaxprice = (boolean) this.getModel().getValue("inputtaxprice");//录入含税价
 | 
					            boolean inputtaxprice = (boolean) this.getModel().getValue("inputtaxprice");//录入含税价
 | 
				
			||||||
            boolean inputtotalprice = (boolean) this.getModel().getValue("inputtotalprice");//录入总价
 | 
					            boolean inputtotalprice = (boolean) this.getModel().getValue("inputtotalprice");//录入总价
 | 
				
			||||||
            if (inputtaxprice && inputtotalprice) {
 | 
					            if ((inputtaxprice && inputtotalprice) || ("taxprice".equals(key) && inputtaxprice)) {
 | 
				
			||||||
                BigDecimal matAmount = (BigDecimal) this.getModel().getValue("matamount");//材料总金额
 | 
					                BigDecimal matAmount = (BigDecimal) this.getModel().getValue("matamount");//材料总金额
 | 
				
			||||||
                BigDecimal transAmount = (BigDecimal) this.getModel().getValue("transamount");//总运费
 | 
					                BigDecimal transAmount = (BigDecimal) this.getModel().getValue("transamount");//总运费
 | 
				
			||||||
                BigDecimal totalAmount = matAmount.add(transAmount);
 | 
					                BigDecimal totalAmount = matAmount.add(transAmount);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +44,7 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
 | 
				
			||||||
                DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity();
 | 
					                DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity();
 | 
				
			||||||
                DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
 | 
					                DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
 | 
				
			||||||
                DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
 | 
					                DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
 | 
				
			||||||
 | 
					                String invoice_type = ecma_MaterialInBill.getString("zcgj_invoice_type");//发票类型
 | 
				
			||||||
                if (entryEntityCollection != null && entryEntityCollection.size() > 0 && entryEntity2Collection != null && entryEntity2Collection.size() > 0) {
 | 
					                if (entryEntityCollection != null && entryEntityCollection.size() > 0 && entryEntity2Collection != null && entryEntity2Collection.size() > 0) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    BigDecimal totalInvoiceAmount = BigDecimal.ZERO;      // 发票总金额(不含税
 | 
					                    BigDecimal totalInvoiceAmount = BigDecimal.ZERO;      // 发票总金额(不含税
 | 
				
			||||||
| 
						 | 
					@ -83,15 +84,18 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
 | 
				
			||||||
                            totalEntryTotal = totalEntryTotal.add(oftaxAmount);
 | 
					                            totalEntryTotal = totalEntryTotal.add(oftaxAmount);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }*/
 | 
					                    }*/
 | 
				
			||||||
 | 
					                    if (totalInvoiceTotal.compareTo(totalEntryTotal) != 0) {
 | 
				
			||||||
 | 
					                        this.addFatalErrorMessage(extendedDataEntity, "入库含税总金额与合同进项发票信息价税合计汇总不匹配!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (invoice_type != null && invoice_type.equals("1")) {
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    if (totalInvoiceAmount.compareTo(totalEntryAmount) != 0) {
 | 
					                    if (totalInvoiceAmount.compareTo(totalEntryAmount) != 0) {
 | 
				
			||||||
                        this.addFatalErrorMessage(extendedDataEntity, "入库总金额与合同进项发票信息金额汇总不匹配!");
 | 
					                        this.addFatalErrorMessage(extendedDataEntity, "入库总金额与合同进项发票信息金额汇总不匹配!");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (totalInvoiceTax.compareTo(totalEntryTax) != 0) {
 | 
					                    if (totalInvoiceTax.compareTo(totalEntryTax) != 0) {
 | 
				
			||||||
                        this.addFatalErrorMessage(extendedDataEntity, "税额与合同进项发票信息税额汇总不匹配!");
 | 
					                        this.addFatalErrorMessage(extendedDataEntity, "税额与合同进项发票信息税额汇总不匹配!");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (totalInvoiceTotal.compareTo(totalEntryTotal) != 0) {
 | 
					 | 
				
			||||||
                        this.addFatalErrorMessage(extendedDataEntity, "入库含税总金额与合同进项发票信息价税合计汇总不匹配!");
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue