Inspection Processing InspectReceipt TranQty

If anyone can help, I would love some suggestions. I am trying to complete a PO Receipt inspection using the InspectReceipt method. Almost everything works as expected, with the exception on the part transaction qty to stock. The method is creating the PartTran record, but the TranQty and POReceiptQty is zero every time. I get no errors and the InspectionPending clears from the receipt.

Here is the code:

    private void SubmitRcvInsp()
    {
		string legalNumberMessage = "";
		int iDMRNum = 0;
		int iNonConfID = 0;
		bool reqUserInput = false;
		string pcPCBinAction = "";
		string pcPCBinMessage = "";

		DataRowView currentRow = edvV_RcvInsp_Updateable_1View.dataView[edvV_RcvInsp_Updateable_1View.Row];
		string strPackSlip = currentRow["RcvHead_PackSlip"].ToString();
		string strPurPoint = currentRow["RcvHead_PurPoint"].ToString();
		int intPackLine = (int)currentRow["RcvDtl_PackLine"];
		int intVendorNum = (int)currentRow["RcvHead_VendorNum"];

		InspProcessingAdapter inspAdapter = new InspProcessingAdapter(this.oTrans);
		inspAdapter.BOConnect();
		bool resultInsp = inspAdapter.GetReceiptByID(intVendorNum,strPurPoint,strPackSlip,intPackLine);
		
		if(resultInsp)
		{
			Erp.BO.InspProcessingDataSet dsInsp = inspAdapter.InspProcessingData;

			dsInsp.InspRcpt[0].PassedQty = dsInsp.InspRcpt[0].OurQty;
			dsInsp.InspRcpt[0].FailedQty = 0;
			dsInsp.InspRcpt[0].InspectorID = "DONEALL";
			dsInsp.InspRcpt[0].InspectedBy = "DONEALL";
			dsInsp.InspRcpt[0].PassedWarehouseCode = "FA1";
			dsInsp.InspRcpt[0].PassedBin = "DEFAULT";

			inspAdapter.CheckPlanningContractBin("Receipt", out pcPCBinAction, out pcPCBinMessage);
			inspAdapter.GetPassedLegalNumGenOpts(dsInsp,"Receipt",out reqUserInput);
			if(reqUserInput==false)
			{
				inspAdapter.InspectReceipt(out legalNumberMessage, out iDMRNum, out iNonConfID, dsInsp);
			}
		}
		
		inspAdapter.Dispose();
    }

You may be missing some calls there. Run a trace and see exactly which methods are called. In my version is:
-AssignInspectorReceipt
-OnChangePassedQty (if you have passed qty’s)
-OnChangeFailedQty (if you have failed qty’s)
-CheckPlanningContractBin
-GetPassedLegalNumGenOpts
-InspectReceipt

Thanks for the suggestion Dragos. I tried that already. Same result unfortunately. I thought maybe the OnChangePassedQty might be the trick, but no.

Which form are you running that code from ?

Also, going back a little, if you’re passing all qty’s ‘by default’ and always have failed qty=0, why not just uncheck Inspection Required in the PO line ?

I am calling the method from a Classic dashboard. I am only passing the entire qty for now while testing. If I can get it working, the user will be able to enter the Pass/Fail qty as normal.
Also, just updating the InspectionRequired to false does not create the part transaction from inspection to stock. The parts will never show up in inventory.

The calls must be in a specific order - again, run the trace and see what’s happening there.
I would start with something like this:

  • set inspector (like dsInsp.InspRcpt[0].InspectorID = “DONEALL”)
  • call AssignInspectorReceipt
  • set passed qty (dsInsp.InspRcpt[0].PassedQty = dsInsp.InspRcpt[0].OurQty)
  • call OnChangePassedQty
  • and so on

Thanks again for the suggestions Dragos. I reorganized the code to do as you suggested, but it still has the same result. However… In the process of testing your suggestions, I was looking at the data again, and found the solution.

I use this code to write the values of the dataset to a CSV file before and after I make all the updates to the dataset…

			string filePath = "c:\\temp\\dsInsp_before.csv";
			using (StreamWriter writer = new StreamWriter(filePath))
			{
			    string headerRow = string.Join(",", GetColumnNames(dsInsp.Tables[3].Columns));
			    writer.WriteLine(headerRow);
			    foreach (DataRow row in dsInsp.Tables[3].Rows)
			    {
			        string[] sanitizedRowItems = Array.ConvertAll(row.ItemArray, item => Regex.Replace(item.ToString(), ",", ""));
			        string dataRow = string.Join(",", sanitizedRowItems);
			        writer.WriteLine(dataRow);
			    }
			}

When I was comparing the before and after dataset, I noticed a field named “DimPassedQty” that still had a value of zero after I performed the OnChangePassedQty method call. So I ran another test where I manually set the value of that field, and it worked! I now have a TranQty in the INS-STK part transaction.

1 Like