public bool Add(InBillMaster inBillMaster, string userName) { bool result = false; var ibm = new InBillMaster(); var employee = EmployeeRepository.GetQueryable().FirstOrDefault(i => i.UserName == userName); if (employee != null) { ibm.BillNo = inBillMaster.BillNo; ibm.BillDate = inBillMaster.BillDate; ibm.BillTypeCode = inBillMaster.BillTypeCode; ibm.WarehouseCode = inBillMaster.WarehouseCode; ibm.OperatePersonID = employee.ID; ibm.Status = "1"; ibm.VerifyPersonID = inBillMaster.VerifyPersonID; ibm.VerifyDate = inBillMaster.VerifyDate; ibm.Description = inBillMaster.Description; //ibm.IsActive = inBillMaster.IsActive; ibm.IsActive = "1"; ibm.UpdateTime = DateTime.Now; InBillMasterRepository.Add(ibm); InBillMasterRepository.SaveChanges(); result = true; } return(result); }
public bool DownInBillMaster(string BeginDate, string EndDate, out string errorInfo) { errorInfo = string.Empty; bool result = false; string inBillStr = ""; string inBillMasterStr = ""; try { var inBillNos = InBillMasterRepository.GetQueryable().Where(i => i.BillNo == i.BillNo).Select(i => new { i.BillNo }).ToArray(); for (int i = 0; i < inBillNos.Length; i++) { inBillStr += inBillNos[i].BillNo + ","; } InBillMaster[] inBillMasterList = InBillMasterDownService.GetInBillMaster(inBillStr); foreach (var master in inBillMasterList) { var inBillMaster = new InBillMaster(); inBillMaster.BillNo = master.BillNo; inBillMaster.BillDate = master.BillDate; inBillMaster.BillTypeCode = master.BillTypeCode; inBillMaster.WarehouseCode = master.WarehouseCode; inBillMaster.Status = "1"; inBillMaster.IsActive = master.IsActive; inBillMaster.UpdateTime = DateTime.Now; InBillMasterRepository.Add(inBillMaster); inBillMasterStr += master.BillNo + ","; } if (inBillMasterStr != string.Empty) { InBillDetail[] inBillDetailList = InBillMasterDownService.GetInBillDetail(inBillMasterStr); foreach (var detail in inBillDetailList) { var inBillDetail = new InBillDetail(); inBillDetail.BillNo = detail.BillNo; inBillDetail.ProductCode = detail.ProductCode; inBillDetail.UnitCode = detail.UnitCode; inBillDetail.Price = detail.Price; inBillDetail.BillQuantity = detail.BillQuantity; inBillDetail.AllotQuantity = detail.AllotQuantity; inBillDetail.RealQuantity = detail.RealQuantity; inBillDetail.Description = detail.Description; InBillDetailRepository.Add(inBillDetail); } } InBillMasterRepository.SaveChanges(); result = true; } catch (Exception e) { errorInfo = "出错,原因:" + e.Message; } return(result); }
/// <summary> /// 入库单新增 /// </summary> /// <param name="inBillMaster">入库主单</param> /// <param name="userName">用户名</param> /// <returns></returns> public bool Add(InBillMaster inBillMaster, string userName, out string strResult) { strResult = string.Empty; bool result = false; var ibm = new InBillMaster(); var employee = EmployeeRepository.GetQueryable().FirstOrDefault(i => i.UserName == userName); if (employee != null) { try { ibm.BillNo = inBillMaster.BillNo; ibm.BillDate = inBillMaster.BillDate; ibm.BillTypeCode = inBillMaster.BillTypeCode; ibm.WarehouseCode = inBillMaster.WarehouseCode; ibm.OperatePersonID = employee.ID; ibm.Status = "1"; ibm.VerifyPersonID = inBillMaster.VerifyPersonID; ibm.VerifyDate = inBillMaster.VerifyDate; ibm.Description = inBillMaster.Description; //ibm.IsActive = inBillMaster.IsActive; ibm.IsActive = "1"; ibm.UpdateTime = DateTime.Now; ibm.TargetCellCode = inBillMaster.TargetCellCode; InBillMasterRepository.Add(ibm); InBillMasterRepository.SaveChanges(); result = true; } catch (Exception ex) { strResult = "新增失败,原因:" + ex.Message; } } else { strResult = "找不到当前登陆用户!请重新登陆!"; } return(result); }