我为SAP B1的MRP模块添加了一个插件,我正在尝试从订单建议创建生产订单。我有一个错误是"组件项目不能是幻影项目"。
我的物品的属性是:
ItemCode:" M1" ,库存和销售项目,计划方法:MRP - 制作
ItemCode:" M2" ,它只是销售项目,计划方法:MRP - 制作
ItemCode:" M3" ,库存,销售和采购项目,计划方法:MRP - 购买
产品树是M1 - > M2 - > M3
出现此错误的原因是什么?当我尝试在没有插件的情况下在标准MIP上创建M1的生产订单时,它会成功运行。
以下是添加生产订单的代码:
public void createWOrderFor(int id,
string itemCode,
string itemName,
int qty,
int satisSip,
string cardCode,
string cardName,
string releaseDate)
{
DataTable dataTable2 = new DataTable();
using (var connection = new SqlConnection("Server=" + server + ";Database=" + database + ";User Id=" + user + ";Password=" + pass + "; connection timeout=30;"))
{
connection.Open();
var comm = new SqlCommand("select Code, Quantity from ITT1 where Father='" + itemCode + "'", connection);
SqlDataReader dr = comm.ExecuteReader();
if (dr.HasRows)
dataTable2.Load(dr);
}
SAPbobsCOM.ProductionOrders BO_itemP;
BO_itemP = (SAPbobsCOM.ProductionOrders)getCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders);
SAPbobsCOM.ProductionOrders_Lines BO_item_lines = null;
BO_itemP.PostingDate = DateTime.Now;
BO_itemP.DueDate = DateTime.Parse(releaseDate);
BO_itemP.ItemNo = itemCode;
BO_itemP.PlannedQuantity = qty;
BO_itemP.ProductionOrderType = SAPbobsCOM.BoProductionOrderTypeEnum.bopotSpecial;
int count2 = 0;
foreach (DataRow row2 in dataTable2.Rows)
{
BO_item_lines = BO_itemP.Lines;
BO_itemP.Lines.ItemNo = row2["Code"].ToString();
BO_itemP.Lines.PlannedQuantity = miktar * qty;
BO_itemP.Lines.SetCurrentLine(count2);
count2++;
BO_itemP.Lines.BaseQuantity = miktar * qty;
BO_itemP.Lines.Warehouse = "1100";
BO_itemP.Lines.Add();
}
var retVal = BO_itemP.Add();
String err = base.getCompany().GetLastErrorDescription();
if (!err.Equals("")) { SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("BO_item Hata: "+err, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error); }
}
答案 0 :(得分:0)
您无法为“幻影”组件创建生产订单。您的组件“ M2”仅标记为销售物料,这将在物料主数据上设置“ Phantom”标记。如果您更改代码以跳过幻像项目,那么它应该可以工作。