/// <summary> /// 提交入库信息 /// </summary> /// <param name="billID">单据编号</param> /// <param name="inDepotInfo">入库信息, 只取其中入库部分</param> /// <param name="returnBill">添加完毕后查询数据库的返回结果</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作是否成功的标志</returns> public bool SubmitInDepotInfo(string billID, S_HomemadePartBill inDepotInfo, out IQueryResult returnBill, out string error) { returnBill = null; error = null; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from r in dataContxt.S_HomemadePartBill where r.Bill_ID == billID select r; if (result.Count() == 0) { error = string.Format("找不到入库单号为 [{0}] 的自制件入库单!", billID); return(false); } S_HomemadePartBill bill = result.Single(); if (bill.BillStatus == HomemadeBillStatus.已入库.ToString()) { error = string.Format("入库单号为 [{0}] 单据状态为已入库", billID); return(false); } bill.DepotManager = inDepotInfo.DepotManager; bill.ShelfArea = inDepotInfo.ShelfArea; bill.ColumnNumber = inDepotInfo.ColumnNumber; bill.LayerNumber = inDepotInfo.LayerNumber; bill.InDepotCount = inDepotInfo.InDepotCount; bill.BillStatus = inDepotInfo.BillStatus; bill.RebackReason = ""; bill.InDepotTime = ServerTime.Time; //操作账务信息与库存信息 OpertaionDetailAndStock(dataContxt, bill); dataContxt.SubmitChanges(); string mrBillNo = ""; if ((int)bill.DeclareWastrelCount > 0 && bill.InDepotCount > 0) { if (!InsertIntoMaterialRequisition(dataContxt, bill, out mrBillNo, out error)) { throw new Exception(error); } } IFrockStandingBook serviceForck = PMS_ServerFactory.GetServerModule <ServerModule.IFrockStandingBook>(); serviceForck.RecordFrockUseCounts_HomemadePart(dataContxt, bill.GoodsID, bill.InDepotCount); dataContxt.SubmitChanges(); return(GetAllBill(out returnBill, out error)); } catch (Exception exce) { error = exce.Message; return(false); } }