/// <summary> /// 编制人修改扣货单 /// </summary> /// <param name="bill">扣货单数据集</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>成功返回True,否则返回False</returns> public bool UpdateBill(S_MaterialDetainBill bill, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var result = from r in dataContxt.S_MaterialDetainBill where r.Bill_ID == bill.Bill_ID select r; if (result.Count() > 0) { S_MaterialDetainBill detain = result.Single(); detain.Bill_Time = ServerModule.ServerTime.Time; detain.Provider = bill.Provider; detain.Reason = bill.Reason; detain.Remark = bill.Remark; detain.BillStatus = "等待领导审核"; } dataContxt.SubmitChanges(); return(true); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 添加扣货单 /// </summary> /// <param name="bill">扣货单数据集</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>成功返回True,否则返回False</returns> public bool AddBill(S_MaterialDetainBill bill, out string error) { error = null; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; try { var result = from r in dataContxt.S_MaterialDetainBill where r.Bill_ID == bill.Bill_ID select r; if (result.Count() == 0) { dataContxt.S_MaterialDetainBill.InsertOnSubmit(bill); } dataContxt.SubmitChanges(); return(true); } catch (Exception exce) { error = exce.Message; return(false); } }
/// <summary> /// 获取S_MaterialDetainBill数据集 /// </summary> /// <returns>返回S_MaterialDetainBill数据集</returns> S_MaterialDetainBill GetData() { S_MaterialDetainBill bill = new S_MaterialDetainBill(); bill.Bill_ID = txtBill_ID.Text; bill.Bill_Time = ServerModule.ServerTime.Time; bill.BillStatus = "新建单据"; bill.Department = BasicInfo.DeptCode; bill.FillInPersonName = BasicInfo.LoginName; bill.FillInPersonCode = BasicInfo.LoginID; bill.Provider = txtProvider.Text; bill.Reason = txtReason.Text; bill.Remark = txtRemark.Text; bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); return(bill); }
/// <summary> /// 回退单据 /// </summary> /// <param name="billNo">单据号</param> /// <param name="billStatus">单据状态</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <param name="rebackReason">回退原因</param> /// <returns>操作成功返回True,操作失败返回False</returns> public bool ReturnBill(string billNo, string billStatus, out string error, string rebackReason) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.S_MaterialDetainBill where a.Bill_ID == billNo select a; string strMsg = ""; if (varData.Count() == 1) { S_MaterialDetainBill lnqTemp = varData.Single(); Nullable <DateTime> nulldt = null; lnqTemp.BillStatus = billStatus; switch (billStatus) { case "新建单据": strMsg = string.Format("{0}号物料扣货单单已回退,请您重新处理单据; 回退原因为" + rebackReason, billNo); m_billMessageServer.PassFlowMessage(billNo, strMsg, BillFlowMessage_ReceivedUserType.用户, lnqTemp.FillInPersonCode); lnqTemp.AuditingDate = nulldt; lnqTemp.AuditingPerson = null; lnqTemp.AuthorizeDate = nulldt; lnqTemp.AuthorizePerson = null; lnqTemp.SQE = null; lnqTemp.SQEDate = nulldt; break; case "等待领导审核": strMsg = string.Format("{0}号物料扣货单单已回退,请您重新处理单据; 回退原因为" + rebackReason, billNo); m_billMessageServer.PassFlowMessage(billNo, strMsg, BillFlowMessage_ReceivedUserType.角色, m_billMessageServer.GetDeptDirectorRoleName(lnqTemp.Department).ToList()); lnqTemp.AuthorizeDate = nulldt; lnqTemp.AuthorizePerson = null; lnqTemp.SQE = null; lnqTemp.SQEDate = nulldt; break; case "等待质管批准": strMsg = string.Format("{0}号物料扣货单单已回退,请您重新处理单据; 回退原因为" + rebackReason, billNo); m_billMessageServer.PassFlowMessage(billNo, strMsg, BillFlowMessage_ReceivedUserType.角色, CE_RoleEnum.质量工程师.ToString()); lnqTemp.SQE = null; lnqTemp.SQEDate = nulldt; break; case "等待SQE确认": strMsg = string.Format("{0}号物料扣货单单已回退,请您重新处理单据; 回退原因为" + rebackReason, billNo); m_billMessageServer.PassFlowMessage(billNo, strMsg, BillFlowMessage_ReceivedUserType.角色, CE_RoleEnum.SQE组员.ToString()); break; default: break; } dataContext.SubmitChanges(); } else { error = "数据不唯一或者为空"; return(false); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
public FormMaterialDetainList(CE_BusinessOperateMode operateMode, string vProvider, string billNo, string status, string Storage) { InitializeComponent(); m_strBillStatus = status; m_strBillID = billNo; S_MaterialDetainBill tempBill = m_goodsServer.GetBill(billNo); m_lnqWSCode = tempBill == null? m_serverWSBasic.GetPersonnelWorkShop(BasicInfo.LoginID) : m_serverWSBasic.GetPersonnelWorkShop(tempBill.FillInPersonCode); if (BasicInfo.LoginRole == CE_RoleEnum.采购员.ToString()) { btnSearch.Visible = true; } if (m_strBillStatus.Equals("新建单据")) { btnUpdate.Visible = true; } m_operateMode = operateMode; if (operateMode == CE_BusinessOperateMode.查看) { toolStrip1.Visible = false; } else if (operateMode == CE_BusinessOperateMode.采购确认) { if (m_strBillStatus.Equals("等待采购确认")) { btnUpdate.Visible = true; btnSearch.Visible = true; btnAdd.Visible = false; btnDelete.Visible = false; btnDeleteAll.Visible = false; btnNew.Visible = false; } else { toolStrip1.Visible = false; } } RefreshDataGridView(m_goodsServer.GetList(m_strBillID, out m_strErr)); m_dataLocalizer = new UserControlDataLocalizer( dataGridView1, this.Name, UniversalFunction.SelectHideFields( this.Name, dataGridView1.Name, BasicInfo.LoginID)); panelTop.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; txtProvider.Text = vProvider; m_strStorageID = Storage; if (!Convert.ToBoolean(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.开启车间管理模块])) { txtCode.FindItem = TextBoxShow.FindType.所有物品批次; txtCode.Enter += new EventHandler(txtCode_Enter); txtBatchNo.Enabled = false; } }