Hey everyone! I am having an issue here. I have code that will create a pack list automatically from a button click. This is the scenario:
We have a dashboard that displays items that are shipping to the customer for the day. There can be 2 kinds of shipments, shipments from jobs, and shipments from stock. I have a button that allows for them to create a pack list automatically on the record that is currently selected. This works great for items that are job shipments. However, when it is a stock shipment, I have an issue.
The packlist is created just fine, and the pack line is created just fine, but it will not put in the inventory shipment qty. When I do the same code, but for a job shipment, everything works great. What is going on?!?!?!
Here is my code for creating the PackList Header:
private void createpack(int cust,int bt,string shipnum,int order)
{
// Declare and create an instance of the Adapter.
CustShipAdapter adapterCustShip = new CustShipAdapter(this.oTrans);
adapterCustShip.BOConnect();
adapterCustShip.GetNewShipHead();
DataRow ship = adapterCustShip.CustShipData.ShipHead[adapterCustShip.CustShipData.ShipHead.Rows.Count - 1];
ship["Company"] = "NET";
ship["CurrencyCode"] = "US";
ship["CustNum"] = cust;
ship["BTCustNum"] = bt;
ship["ShipToCustNum"] = cust;
ship["ShipToNum"] = shipnum;
ship["OrderNum"] = order;
ship["ShipStatus"] = "OPEN";
ship["Invoiced"] = 0;
ship["ReadyToInvoice"] = 0;
ship["ShipToNum"] = "";
ship["ShipDate"] = DateTime.Now;
ship["ShipViaCode"] = "FDXG";
ship["ShipPerson"] = "Tablet1";
ship["EntryPerson"] = "Tablet1";
ship["Plant"] = "MfgSys";
adapterCustShip.Update();
// Cleanup Adapter Reference
adapterCustShip.Dispose();
oTrans.Update();
}
This works great, Here is my code for creating a stock shipment line:
private void newline(string job, string order, string line, string rel, string part, string rev, string desc,int qty,int pack,int cust, string shipto)
{
try
{
// Declare and create an instance of the Adapter.
CustShipAdapter adapterCustShip = new CustShipAdapter(this.oTrans);
adapterCustShip.BOConnect();
adapterCustShip.GetByID(pack);
adapterCustShip.GetNewShipDtl(pack);
adapterCustShip.GetNewOrdrShipDtl(pack,Convert.ToInt32(order));
DataRow ship = adapterCustShip.CustShipData.ShipDtl[adapterCustShip.CustShipData.ShipDtl.Rows.Count - 1];
ship["Company"] = "NET";
ship["CustNum"] = cust;
ship["ShipToCustNum"] = cust;
ship["MFCustNum"] = cust;
ship["MFShipToNum"] = shipto;
ship["JobNum"] = job;
ship["OrderNum"] = order;
ship["OrderLine"] = line;
ship["OrderRelNum"] = rel;
ship["PartNum"] = part;
ship["RevisionNum"] = rev;
ship["LineDesc"] = desc;
ship["WIPWarehouseCode"] = "SHIP";
ship["WIPWarehouseCodeDescription"] = "Shipping Area";
ship["WIPBinNum"] = "SHIP-OUT";
ship["JobShipUOM"] = "EA";
ship["SellingShipmentUM"] = "EA";
ship["SellingReqUM"] = "EA";
ship["SellingRemainUM"] = "EA";
ship["SalesUM"] = "EA";
ship["IUM"] = "EA";
ship["WUM"] = "LB";
ship["SellingShipmentQty"] = qty;
ship["OurJobShipQty"] = qty;
adapterCustShip.Update();
// Cleanup Adapter Reference
adapterCustShip.Dispose();
oTrans.Update();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
Again, this works great, no issues. Finally, here is my code for creating a stock shipment line:
private void createstocklines(int pack, int order, int cust,int line, int rel,string part, string rev, string desc, int qty,string shipto)
{
try
{
CustShipAdapter adapterCustShip = new CustShipAdapter(this.oTrans);
adapterCustShip.BOConnect();
adapterCustShip.GetByID(pack);
adapterCustShip.GetNewShipDtl(pack);
adapterCustShip.GetNewOrdrShipDtl(pack,order);
DataRow ship = adapterCustShip.CustShipData.ShipDtl[adapterCustShip.CustShipData.ShipDtl.Rows.Count - 1];
ship["Company"] = "NET";
ship["CustNum"] = cust;
ship["ShipToCustNum"] = cust;
ship["MFCustNum"] = cust;
ship["MFShipToNum"] = shipto;
ship["OrderNum"] = order;
ship["OrderLine"] = line;
ship["OrderRelNum"] = rel;
ship["PartNum"] = part;
ship["RevisionNum"] = rev;
ship["LineDesc"] = desc;
ship["WarehouseCode"] = "SHIP";
ship["WarehouseCodeDescription"] = "Shipping Area";
ship["BinNum"] = "SHIP-OUT";
ship["WarehouseCode"] = "VLM";
ship["WarehouseCodeDescription"] = "VLM Storage";
ship["BinNum"] = "FG";
ship["InventoryShipUOM"] = "EA";
ship["JobShipUOM"] = "EA";
ship["SellingShippedUM"] = "EA";
ship["SellingShipmentUM"] = "EA";
ship["SellingReqUM"] = "EA";
ship["SellingRemainUM"] = "EA";
ship["SalesUM"] = "EA";
ship["IUM"] = "EA";
ship["WUM"] = "LB";
ship["SellingInventoryShipQty"] = qty;
ship["OurInventoryShipQty"] = qty;
adapterCustShip.Update();
// Cleanup Adapter Reference
adapterCustShip.Dispose();
oTrans.Update();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
Everything in this section works fine, but it will not put any data into the “OurInventoryShipQty” field. No errors, just doesn’t complete it. Sorry for the long post, but does anyone have any suggestions???