/// <summary> /// 删除库房信息 /// </summary> /// <param name="stroageID">库房ID</param> /// <param name="stroageName">库房名称</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>删除成功返回True,删除失败返回False</returns> public bool DeleteStorage(string stroageID, string stroageName, out string error) { try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; error = null; var varData = from a in dataContxt.BASE_Storage where a.StorageID == stroageID && a.StorageName == stroageName select a; foreach (var item in varData) { dataContxt.BASE_Storage.DeleteOnSubmit(item); } var varDataList = from b in dataContxt.BASE_StorageAndPersonnel where b.StorageID == stroageID select b; foreach (var itemList in varDataList) { dataContxt.BASE_StorageAndPersonnel.DeleteOnSubmit(itemList); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除单据 /// </summary> /// <param name="billNo">单据号</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>删除成功返回True,删除失败返回False</returns> public bool ScrapBill(string billNo, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var varIsolation = from a in dataContxt.S_IsolationManageBill where a.DJH == billNo select a; if (varIsolation.Count() != 1) { error = "记录不唯一"; return(false); } else { S_IsolationManageBill Isalation = varIsolation.Single(); dataContxt.S_IsolationManageBill.DeleteAllOnSubmit(varIsolation); if (!m_serverStore.ChangeStockStatus(dataContxt, Isalation, 0, out error)) { return(false); } dataContxt.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 打印单据添加打印次数,记录日志 /// </summary> /// <param name="billNo">单据号</param> /// <param name="error">错误信息</param> /// <returns>成功反复True,失败返回false</returns> public bool PrintUpodateData(string billNo, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from a in dataContxt.S_MarketingPartBill where a.BillNo == billNo select a; if (result.Count() == 1) { S_MarketingPartBill bill = result.Single(); bill.PrintCount += 1; SystemLog_MarketPart log = new SystemLog_MarketPart(); log.BillNo = billNo; log.Content = ServerTime.Time + "财务人员【" + BasicInfo.LoginName + "】打印。"; log.Recorder = BasicInfo.LoginID; log.RecordTime = ServerTime.Time; dataContxt.SystemLog_MarketPart.InsertOnSubmit(log); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 审核流程 /// </summary> /// <param name="releseProcess">LNQ数据集</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回false </returns> public bool AuditInfo(FM_RevisedAbolishedBill raBill, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.FM_RevisedAbolishedBill where a.BillNo == raBill.BillNo select a; if (varData.Count() != 1) { error = "数据错误"; return(false); } else { FM_RevisedAbolishedBill lnqTemp = varData.Single(); lnqTemp.BillStatus = "等待批准"; lnqTemp.Auditor = BasicInfo.LoginName; lnqTemp.AuditorAdvise = raBill.AuditorAdvise; lnqTemp.AuditorTime = ServerTime.Time; } ctx.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 修改岗位 /// </summary> /// <param name="operatPost">岗位信息</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>成功返回True,失败返回false</returns> public bool UpdatePost(HR_OperatingPost operatPost, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var result = from e in dataContxt.HR_OperatingPost where e.PostID == operatPost.PostID select e; if (result.Count() == 1) { HR_OperatingPost updatePost = result.Single(); updatePost.PostName = operatPost.PostName; updatePost.PostStatement = operatPost.PostStatement; updatePost.PostPrinciple = operatPost.PostPrinciple; updatePost.IsCorePost = operatPost.IsCorePost; updatePost.PostTypeID = operatPost.PostTypeID; updatePost.Remark = operatPost.Remark; updatePost.Recorder = operatPost.Recorder; updatePost.RecordTime = operatPost.RecordTime; updatePost.Dept = operatPost.Dept; } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除节假日信息 /// </summary> /// <param name="id">编号</param> /// <param name="error">错误信息</param> /// <returns>成功返回True 失败返回False</returns> public bool DeleteHoliday(int id, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from a in dataContxt.HR_Holiday where a.ID == id select a; if (result.Count() == 1) { if (result.Single().BeginTime.Month < ServerTime.Time.Month) { error = "节假日的起止时间在本月之前,不能删除!"; return(false); } dataContxt.HR_Holiday.DeleteAllOnSubmit(result); } else { error = "节假日已经存在,请重新确认!"; return(false); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除单据 /// </summary> /// <param name="billNo">单据号</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool DeleteBill(int billNo, out string error) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.Out_BuyingBill where a.ID == billNo select a; if (varData.Count() != 1) { error = "数据为空或者不唯一"; return(false); } else { var varList = from a in dataContext.Out_BuyingList where a.BillID == varData.Single().ID select a; dataContext.Out_BuyingBill.DeleteAllOnSubmit(varData); dataContext.Out_BuyingList.DeleteAllOnSubmit(varList); dataContext.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 确认到货数 /// </summary> /// <param name="billID">单据编号</param> /// <param name="confirmAmountSignatory">仓库收货员签名</param> /// <param name="goodsAmount">货物数量</param> /// <param name="billStatusInfo">单据状态消息</param> /// <param name="returnBill">返回的单据查询结果集</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作是否成功的标志</returns> public bool AffirmGoodsAmount(string billID, string confirmAmountSignatory, int goodsAmount, string billStatusInfo, 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(); bill.DepotManagerAffirmCount = goodsAmount; bill.BillStatus = billStatusInfo; bill.ConfirmAmountSignatory = confirmAmountSignatory; bill.RebackReason = ""; dataContxt.SubmitChanges(); return(GetAllBill(out returnBill, out error)); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 更新信息 /// </summary> /// <param name="updateGoodsID">旧物品ID</param> /// <param name="logistic">LINQ信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool UpdateInfo(int updateGoodsID, S_LogisticSafeStock logistic, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.S_LogisticSafeStock where a.GoodsID == updateGoodsID select a; if (varData.Count() != 1) { error = "数据不唯一"; return(false); } else { S_LogisticSafeStock lnqLogistic = varData.Single(); lnqLogistic.GoodsID = logistic.GoodsID; lnqLogistic.MaxValue = logistic.MaxValue; lnqLogistic.MinValue = logistic.MinValue; lnqLogistic.Remark = logistic.Remark; ctx.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 通过单据号删除单据信息 /// </summary> /// <param name="billID">单据号</param> /// <param name="error">错误信息</param> /// <returns>成功返回True失败返回False</returns> public bool DeleteWorkScheduling(int billID, out string error) { error = ""; try { View_HR_WorkScheduling workTemp = GetWorkSchedulingByBillNo(billID); if (workTemp.单据状态 == "已完成" || workTemp.单据状态 == "等待下次排班") { throw new Exception("单据无法删除"); } DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var resultPersonnel = from a in dataContxt.HR_WorkSchedulingDetail where a.ParentID == billID select a; dataContxt.HR_WorkSchedulingDetail.DeleteAllOnSubmit(resultPersonnel); var result = from c in dataContxt.HR_WorkScheduling where c.ID == billID select c; dataContxt.HR_WorkScheduling.DeleteAllOnSubmit(result); dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除库房信息 /// </summary> /// <param name="secStorageID">库房编码</param> /// <returns>成功返回True,失败返回False</returns> public bool DeleteInfo(string secStorageID, out string error) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.Out_StockInfo where a.SecStorageID == secStorageID select a; dataContext.Out_StockInfo.DeleteAllOnSubmit(varData); dataContext.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 变更单据状态(检测) /// </summary> /// <param name="djID">单据ID</param> /// <param name="remark">备注</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>变更成功返回True,变更失败返回False</returns> public bool QualityBill(int djID, string remark, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var varData = from a in dataContxt.S_CannibalizeBill where a.ID == djID select a; if (varData.Count() == 0) { error = "无记录"; } else { S_CannibalizeBill lnqMarkBill = varData.Single(); lnqMarkBill.Checker = BasicInfo.LoginID; lnqMarkBill.DJZT = "已检测"; lnqMarkBill.Remark = remark; lnqMarkBill.CheckTime = ServerTime.Time; dataContxt.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 更新说明 /// </summary> /// <param name="data">要更新的数据</param> /// <returns>操作是否成功的标志</returns> public bool UpdateRemark(View_ZPX_CVTOffLineTestResult data) { DepotManagementDataContext context = CommentParameter.DepotDataContext; var result = from r in context.ZPX_CVTOffLineTestResult where r.ID == data.编号 select r; if (result.Count() == 0) { throw new Exception("找不到要更新的记录,无法进行此操作"); } ZPX_CVTOffLineTestResult updateData = result.Single(); if (updateData.UserCode != GlobalObject.BasicInfo.LoginID) { throw new Exception("不是记录创建人员不允许进行此操作"); } View_ZPX_CVTOffLineTestResult old = (from r in context.View_ZPX_CVTOffLineTestResult where r.编号 == data.编号 select r).Single(); PlatformManagement.ILogManagement log = PlatformManagement.PlatformFactory.GetObject <PlatformManagement.ILogManagement>(); log.WriteUpdateLog <View_ZPX_CVTOffLineTestResult>(GlobalObject.BasicInfo.LoginID, "下线试验信息管理", new List <string>(new string[] { "编号" }), old, data); updateData.Remark = data.备注; context.SubmitChanges(); return(true); }
/// <summary> /// 批量删除单据信息 /// </summary> /// <param name="billIDLis">批量删除单据号的集合</param> /// <param name="error">出错时返回的错误信息</param> /// <returns>True 删除成功 False 删除失败</returns> public bool DeleteBill(List <string> billIDLis, out string error) { try { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from r in dataContxt.YX_AfterServiceMakePartsBill where billIDLis.Contains(r.BillID) select r; dataContxt.YX_AfterServiceMakePartsBill.DeleteAllOnSubmit(result); dataContxt.SubmitChanges(); return(true); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 通过考勤编码删除考勤方案 /// </summary> /// <param name="schemeCode">考勤编码</param> /// <param name="error">错误信息</param> /// <returns>成功返回True失败返回False</returns> public bool DeleteAttendanceScheme(string schemeCode, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var resultUse = from a in dataContxt.HR_AttendanceSetting where a.SchemeCode == schemeCode select a; if (resultUse.Count() > 0) { error = "已有人员适用于该考勤,不能删除"; return(false); } var result = from c in dataContxt.HR_AttendanceScheme where c.SchemeCode == schemeCode select c; if (result.Count() > 0) { dataContxt.HR_AttendanceScheme.DeleteAllOnSubmit(result); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 通过单据号删除单据信息 /// </summary> /// <param name="billID">单据号</param> /// <param name="error">错误信息</param> /// <returns>成功返回True失败返回False</returns> public bool DeleteOnBusinessBill(int billID, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from e in dataContxt.HR_OnBusinessBill where e.ID == billID select e; HR_OnBusinessBill bill = result.Single(); dataContxt.HR_OnBusinessBill.DeleteOnSubmit(bill); var resultPersonnel = from a in dataContxt.HR_OnBusinessPersonnel where a.BillID == billID select a; dataContxt.HR_OnBusinessPersonnel.DeleteAllOnSubmit(resultPersonnel); var resultSchedule = from c in dataContxt.HR_OnBusinessSchedule where c.BillID == billID select c; dataContxt.HR_OnBusinessSchedule.DeleteAllOnSubmit(resultSchedule); dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除产品信息 /// </summary> /// <param name="id">要删除的产品信息ID</param> /// <param name="returnProductInfo">返回重新查询到的产品信息</param> /// <param name="error">出错时返回的错误信息</param> /// <returns>操作是否成功的标志</returns> public bool DeleteProductInfo(int id, out IQueryable <View_P_ProductInfo> returnProductInfo, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { Table <P_ProductInfo> table = dataContxt.GetTable <P_ProductInfo>(); var delRow = from c in table where c.ID == id select c; table.DeleteAllOnSubmit(delRow); dataContxt.SubmitChanges(); return(GetAllProductInfo(out returnProductInfo, out error)); } catch (Exception err) { return(SetReturnError(err, out returnProductInfo, out error)); } }
void OperationInfo_EffectValue(DepotManagementDataContext ctx, Business_CWQC_CreativePersentation_EffectValue effectValue) { Business_CWQC_CreativePersentation_EffectValue lnqInfo = GetInfo_EffectValue(ctx, effectValue.BillNo); if (lnqInfo == null) { ctx.Business_CWQC_CreativePersentation_EffectValue.InsertOnSubmit(effectValue); } else { lnqInfo.ElseContent = effectValue.ElseContent; lnqInfo.ElseEffectValue = effectValue.ElseEffectValue; lnqInfo.MaterialReduce1 = effectValue.MaterialReduce1; lnqInfo.MaterialReduce2 = effectValue.MaterialReduce2; lnqInfo.MaterialReduce3 = effectValue.MaterialReduce3; lnqInfo.MaterialReduce4 = effectValue.MaterialReduce4; lnqInfo.WorkReduce1 = effectValue.WorkReduce1; lnqInfo.WorkReduce2 = effectValue.WorkReduce2; lnqInfo.WorkReduce3 = effectValue.WorkReduce3; lnqInfo.WorkReduce4 = effectValue.WorkReduce4; } ctx.SubmitChanges(); }
public void UpdateFilePath(string billNo, string fileNo, SelfSimpleEnum_CreativeePersentation simple) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.Business_CWQC_CreativePersentation where a.BillNo == billNo select a; if (varData.Count() == 1) { Business_CWQC_CreativePersentation tempInfo = varData.Single(); if (simple == SelfSimpleEnum_CreativeePersentation.Before) { tempInfo.ImproveConditions_Before_FileNo = fileNo; } else if (simple == SelfSimpleEnum_CreativeePersentation.After) { tempInfo.ImproveConditions_After_FileNo = fileNo; } } ctx.SubmitChanges(); }
/// <summary> /// 删除物品信息 /// </summary> /// <param name="id">要删除的物品ID列表</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> public bool DeleteGoods(List <long> id, out string error) { try { error = null; IsolationManageBill serverIsolation = new IsolationManageBill(); DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from r in dataContxt.S_HomemadeRejectList where id.Contains(r.ID) select r; if (result.Count() > 0) { foreach (var item in result) { if (!serverIsolation.ClearGoodsDate(dataContxt, item.Bill_ID, item.GoodsID, item.BatchNo, out error)) { return(false); } } dataContxt.S_HomemadeRejectList.DeleteAllOnSubmit(result); dataContxt.SubmitChanges(); } return(true); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 删除报检入库单 /// </summary> /// <param name="billNo">入库单号</param> /// <param name="error">出错时返回错误信息</param> /// <returns>操作是否成功的标志</returns> public bool DeleteBill(string billNo, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { Table <S_CheckOutInDepotBill> table = dataContxt.GetTable <S_CheckOutInDepotBill>(); var delRow = from c in table where c.Bill_ID == billNo select c; table.DeleteAllOnSubmit(delRow); dataContxt.SubmitChanges(); return(true); //GetAllBill(out returnBill, out error); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 添加普通入库单物品 /// </summary> /// <param name="billNo">单据编号</param> /// <param name="goods">物品信息</param> /// <param name="returnInfo">操作完毕后查询数据库的返回结果</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作是否成功的标志</returns> public bool AddGoods(string billNo, S_OrdinaryInDepotGoodsBill goods, out IQueryable <View_S_OrdinaryInDepotGoodsBill> returnInfo, out string error) { returnInfo = null; error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { ClearNullValue(goods); dataContxt.S_OrdinaryInDepotGoodsBill.InsertOnSubmit(goods); dataContxt.SubmitChanges(); returnInfo = GetGoodsViewInfo(billNo); return(true); } catch (Exception err) { error = err.Message; return(false); } }
/// <summary> /// 插入新数据 /// </summary> /// <param name="inMess">反馈单信息</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>插入成功返回True,插入失败返回False</returns> public bool AddData(S_MessMessageFeedback inMess, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.S_MessMessageFeedback where a.InDepotBillID == inMess.InDepotBillID select a; ctx.S_MessMessageFeedback.DeleteAllOnSubmit(varData); S_MessMessageFeedback lnqMess = new S_MessMessageFeedback(); lnqMess.DJH = inMess.DJH; lnqMess.ForGoodsStatus = inMess.ForGoodsStatus; lnqMess.MessageFromStatus = inMess.MessageFromStatus; lnqMess.DisqualificationDepict = inMess.DisqualificationDepict; lnqMess.QCRY = BasicInfo.LoginID; lnqMess.QCRQ = ServerTime.Time; lnqMess.DJZT = "等待STA意见"; lnqMess.InDepotBillID = inMess.InDepotBillID; ctx.S_MessMessageFeedback.InsertOnSubmit(lnqMess); ctx.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 修改岗位类别 /// </summary> /// <param name="postType">岗位类别信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True ,失败返回False</returns> public bool UpdatePostType(HR_PostType postType, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from a in dataContxt.HR_PostType where a.TypeID == postType.TypeID select a; if (result.Count() == 0) { error = "找不到相关记录,无法进行操作"; return(false); } HR_PostType postTypeList = result.Single(); postTypeList.TypeName = postType.TypeName; postTypeList.IsMiddleLevel = postType.IsMiddleLevel; postTypeList.IsHighLevel = postType.IsHighLevel; postTypeList.Remark = postType.Remark; postTypeList.Recorder = postType.Recorder; postTypeList.RecordTime = postType.RecordTime; dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 单个员工设置考勤 /// </summary> /// <param name="workID">员工编号</param> /// <param name="schemeCode">考勤编码</param> /// <param name="isSubsidize">是否有餐补</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool AddAttendanceSetting(string workID, string schemeCode, bool isSubsidize, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from a in dataContxt.HR_AttendanceSetting where a.SchemeCode == schemeCode && a.WorkID == workID select a; if (result.Count() > 0) { error = "该员工已经设置了该考勤!"; return(false); } HR_AttendanceSetting attendance = new HR_AttendanceSetting(); attendance.SchemeCode = schemeCode; attendance.WorkID = workID; attendance.IsSubsidize = isSubsidize; attendance.Recorder = BasicInfo.LoginID; attendance.RecordTime = ServerTime.Time; dataContxt.HR_AttendanceSetting.InsertOnSubmit(attendance); dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 通过岗位编号删除岗位类别 /// </summary> /// <param name="typeID">岗位编号</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool DeletePostType(int typeID, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from a in dataContxt.HR_OperatingPost where a.PostTypeID == typeID select a; if (result.Count() > 0) { error = "岗位类别已经关联岗位信息,不能删除"; return(false); } var resultType = from c in dataContxt.HR_PostType where c.TypeID == typeID select c; foreach (var item in resultType) { dataContxt.HR_PostType.DeleteOnSubmit(item); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除单据明细 /// </summary> /// <param name="billID">单据号</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>成功返回TRUE</returns> private bool DeleteSellInList(string billID, out string error) { error = null; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var varData = from a in dataContxt.S_QuarantineList where a.Bill_ID == billID select a; foreach (var item in varData) { //还原原有数据的状态 if (!UpdateProductStockStatus(item.ProductStockCode, item.GoodID.ToString(), true, out error)) { return(false); } } if (varData.Count() != 0) { dataContxt.S_QuarantineList.DeleteAllOnSubmit(varData); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 添加/更新部门工作岗位 /// </summary> /// <param name="deptPost">工作岗位信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool AddDeptPost(HR_DeptPost deptPost, out string error) { error = ""; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; var result = from a in dataContxt.HR_DeptPost where a.PostID == deptPost.PostID && a.DeptCode == deptPost.DeptCode select a; if (result.Count() > 0) { HR_DeptPost deptPostList = result.Single(); deptPostList.NumberOfPeople = deptPost.NumberOfPeople; deptPostList.Recorder = deptPost.Recorder; deptPostList.RecordTime = deptPost.RecordTime; deptPostList.Remark = deptPost.Remark; deptPostList.ExistAmount = deptPost.NumberOfPeople; } else { dataContxt.HR_DeptPost.InsertOnSubmit(deptPost); } dataContxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 更新工位 /// </summary> /// <param name="oldWorkbench">旧工位号</param> /// <param name="newWorkbench">新工位号</param> /// <param name="remark">工位备注</param> /// <param name="returnWorkbench">输出操作后重新查询的所有工位信息</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>返回是否成功删除工位信息</returns> public bool Update(string oldWorkbench, string newWorkbench, string remark, out IQueryable <View_P_Workbench> returnWorkbench, out string error) { returnWorkbench = null; error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var result = from c in dataContxt.P_Workbench where c.Workbench == newWorkbench select c; if (result.Count() == 0) { result.Single().Workbench = newWorkbench; result.Single().Remark = remark; dataContxt.SubmitChanges(); returnWorkbench = Workbenchs; return(true); } else { error = string.Format("已存在 {1} 工位信息, 无法将 {0} 修改为 {1}", oldWorkbench, newWorkbench); return(false); } } catch (Exception err) { error = err.Message; return(false); } }
/// <summary> /// 设置删除标志 /// </summary> /// <param name="goodsID">物品ID</param> /// <param name="batchNo">批次号</param> /// <returns>成功返回True,失败返回False</returns> public bool UpdateDeleteFlag(int goodsID, string batchNo) { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.KF_GoodsShelfLife where a.GoodsID == goodsID && a.BatchNo == batchNo select a; if (varData.Count() != 1) { return(false); } else { KF_GoodsShelfLife lnqShelfLife = varData.Single(); lnqShelfLife.IsDelete = true; } dataContext.SubmitChanges(); return(true); }