public 工装总成信息(int goodsID, string frocknumber, bool flag, AuthorityFlag m_authFlag, bool addflag) { InitializeComponent(); m_strAuthFlag = m_authFlag; FaceAuthoritySetting.SetEnable(this.Controls, m_authFlag); FaceAuthoritySetting.SetVisibly(this.toolStrip1, m_authFlag); toolStrip1.Visible = true; lbScarpPersonnel.Text = ""; lbScarpTime.Text = ""; if (!flag) { labelTitle.Text = "工装分装台帐信息"; this.StartPosition = FormStartPosition.WindowsDefaultLocation; tabControl1.TabPages.RemoveAt(1); } else { labelTitle.Text = "工装总装台帐信息"; } if (addflag) { txtName.ShowResultForm = true; txtFrockNumber.Text = m_serverFrockStandingBook.GetNewFrockNumber(); txtFrockNumber.ReadOnly = false; if (goodsID != 0 && frocknumber != "") { txtParentFrockNumber.Text = frocknumber; F_GoodsPlanCost lnqGoodsInfo = m_serverBasicGoods.GetGoodsInfo(goodsID); txtParentCode.Text = lnqGoodsInfo.GoodsCode; txtParentName.Text = lnqGoodsInfo.GoodsName; txtParentName.Tag = goodsID; } } else { txtName.ShowResultForm = false; txtFrockNumber.ReadOnly = true; DataRow drInfo = m_serverFrockStandingBook.GetInDepotBillInfo(frocknumber); if (drInfo != null) { txtProposer.Text = drInfo["申请人"].ToString(); txtProposer.Tag = drInfo["申请人工号"].ToString(); txtProviderCode.Text = drInfo["供应商编码"].ToString(); txtProviderName.Text = drInfo["供应商简称"].ToString(); txtDesigner.Text = drInfo["设计人"].ToString(); txtDesigner.Tag = drInfo["设计人工号"].ToString(); } m_lnqStandingBook = m_serverFrockStandingBook.GetBookInfo(goodsID, frocknumber); } ShowMessage(); }
/// <summary> /// 改变子父关系 /// </summary> /// <param name="lnqSelfFrock">自身工装信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool ChangeParentChildRelationships(S_FrockStandingBook lnqSelfFrock, out string error) { error = null; DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.S_FrockStandingBook where a.GoodsID == lnqSelfFrock.GoodsID && a.FrockNumber == lnqSelfFrock.FrockNumber select a; if (varData.Count() != 1) { error = "数据不唯一或者为空"; return(false); } else { S_FrockStandingBook lnqFrock = varData.Single(); lnqFrock.ParentFrockNumber = lnqSelfFrock.ParentFrockNumber; lnqFrock.ParentGoodsID = lnqSelfFrock.ParentGoodsID; dataContext.SubmitChanges(); return(true); } }
private void tvFormel_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent(typeof(TreeNode))) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (DestinationNode != NewNode) { int parentGoodsID = 0; int selfGoodsID = 0; string parentFrockNumber = ""; string selfFrockNumber = ""; S_FrockStandingBook selfFrock = new S_FrockStandingBook(); SeparateString(DestinationNode.Tag.ToString(), out parentGoodsID, out parentFrockNumber); SeparateString(NewNode.Tag.ToString(), out selfGoodsID, out selfFrockNumber); selfFrock.GoodsID = selfGoodsID; selfFrock.FrockNumber = selfFrockNumber; if (parentGoodsID != 0 && parentFrockNumber != "") { selfFrock.ParentGoodsID = parentGoodsID; selfFrock.ParentFrockNumber = parentFrockNumber; } if (!m_serverFrockStandingBook.ChangeParentChildRelationships(selfFrock, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } else { DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); //删除已经移动的节点 NewNode.Remove(); RefrshData(); } } } }
/// <summary> /// 获得信息 /// </summary> void GetMessage() { m_lnqStandingBook = new S_FrockStandingBook(); m_lnqStandingBook.IsInStock = chkIsInStock.Checked; m_lnqStandingBook.ApplyToDevice = txtApplyToDevice.Text; m_lnqStandingBook.ApplyToProcess = txtApplyToProcess.Text; m_lnqStandingBook.ApplyToProductCode = txtApplyToProductCode.Text; m_lnqStandingBook.ApplyToProductName = txtApplyToProductName.Text; m_lnqStandingBook.ApplyToWorkShop = cmbApplyToWorkShop.Text; m_lnqStandingBook.Designer = txtDesigner.Text; m_lnqStandingBook.IdentifyCycle = numIdentifyCycle.Value; m_lnqStandingBook.FinalPersonnel = BasicInfo.LoginName; m_lnqStandingBook.FinalTime = ServerTime.Time; m_lnqStandingBook.FrockNumber = txtFrockNumber.Text; m_lnqStandingBook.GoodsID = Convert.ToInt32(txtName.Tag); if (rbTypeCount.Checked) { m_lnqStandingBook.IdentifyCycleType = rbTypeCount.Text; } else if (rbTypeTime.Checked) { m_lnqStandingBook.IdentifyCycleType = rbTypeTime.Text; } if (txtParentName.Text.Trim() == "") { m_lnqStandingBook.ParentGoodsID = null; m_lnqStandingBook.ParentFrockNumber = null; } else { m_lnqStandingBook.ParentFrockNumber = txtParentFrockNumber.Text; m_lnqStandingBook.ParentGoodsID = Convert.ToInt32(txtParentName.Tag); } if (txtScarpBillID.Text.Trim() != "") { m_lnqStandingBook.ScarpBillID = txtScarpBillID.Text; m_lnqStandingBook.ScarpPersonnel = lbScarpPersonnel.Text.Trim() == "" ? BasicInfo.LoginName : lbScarpPersonnel.Text; m_lnqStandingBook.ScarpTime = lbScarpTime.Text.Trim() == "" ? ServerTime.Time : Convert.ToDateTime(lbScarpTime.Text); m_lnqStandingBook.ScarpReason = txtScarpReason.Text; } }
private void btnReferenceInfo_Click(object sender, EventArgs e) { FormQueryInfo form = QueryInfoDialog.GetFrockStandingBook(txtName.Tag == null ? 0 : Convert.ToInt32(txtName.Tag)); if (form != null && form.ShowDialog() == DialogResult.OK) { S_FrockStandingBook lnqTemp = m_serverFrockStandingBook.GetBookInfo(m_lnqStandingBook == null ? Convert.ToInt32(form.GetDataItem("物品ID")) : m_lnqStandingBook.GoodsID, form.GetDataItem("工装编号").ToString()); View_F_GoodsPlanCost tempGoodsLnq = UniversalFunction.GetGoodsInfo(Convert.ToInt32(lnqTemp.GoodsID)); View_F_GoodsPlanCost tempParentGoodsLnq = UniversalFunction.GetGoodsInfo(Convert.ToInt32(lnqTemp.ParentGoodsID)); if (tempParentGoodsLnq != null) { txtParentCode.Text = tempParentGoodsLnq.图号型号; txtParentName.Text = tempParentGoodsLnq.物品名称; txtParentName.Tag = Convert.ToInt32(m_lnqStandingBook.ParentGoodsID); txtParentFrockNumber.Text = m_lnqStandingBook.ParentFrockNumber; } if (tempGoodsLnq == null) { MessageDialog.ShowPromptMessage("系统中无此物品信息"); } txtCode.Text = tempGoodsLnq.图号型号; txtName.Text = tempGoodsLnq.物品名称; txtName.Tag = Convert.ToInt32(lnqTemp.GoodsID); numIdentifyCycle.Value = Convert.ToDecimal(lnqTemp.IdentifyCycle); txtApplyToDevice.Text = lnqTemp.ApplyToDevice; txtApplyToProcess.Text = lnqTemp.ApplyToProcess; txtApplyToProductCode.Text = lnqTemp.ApplyToProductCode; txtApplyToProductName.Text = lnqTemp.ApplyToProductName; txtDesigner.Text = lnqTemp.Designer; cmbApplyToWorkShop.Text = lnqTemp.ApplyToWorkShop; if (lnqTemp.IdentifyCycleType != null) { rbTypeCount.Checked = (bool)(lnqTemp.IdentifyCycleType == rbTypeCount.Text); rbTypeTime.Checked = (bool)(lnqTemp.IdentifyCycleType == rbTypeTime.Text); } } }
private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode DestinationNode = treeView1.SelectedNode; if (DestinationNode != m_trNode) { int parentGoodsID = 0; int selfGoodsID = 0; string parentFrockNumber = ""; string selfFrockNumber = ""; S_FrockStandingBook selfFrock = new S_FrockStandingBook(); SeparateString(DestinationNode.Tag.ToString(), out parentGoodsID, out parentFrockNumber); SeparateString(m_trNode.Tag.ToString(), out selfGoodsID, out selfFrockNumber); selfFrock.GoodsID = selfGoodsID; selfFrock.FrockNumber = selfFrockNumber; if (parentGoodsID != 0 && parentFrockNumber != "") { selfFrock.ParentGoodsID = parentGoodsID; selfFrock.ParentFrockNumber = parentFrockNumber; } if (!m_serverFrockStandingBook.ChangeParentChildRelationships(selfFrock, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } else { DestinationNode.Nodes.Add((TreeNode)m_trNode.Clone()); DestinationNode.Expand(); //删除已经移动的节点 m_trNode.Remove(); RefrshData(); } m_trNode = null; } }
/// <summary> /// 插入工装所有信息 /// </summary> /// <param name="ordinarybill">普通入库单信息</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> bool CreateNewFrockMessage(S_OrdinaryInDepotBill ordinarybill, out string error) { error = null; FrockProvingReport serverFrockProvingReport = new FrockProvingReport(); try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.S_OrdinaryInDepotGoodsBill where a.Bill_ID == ordinarybill.Bill_ID select a; foreach (var item in varData) { for (int i = 0; i < item.Amount; i++) { string strFrockNumber = m_serverFrockStandingBook.GetNewFrockNumber(); S_FrockProvingReport lnqReport = new S_FrockProvingReport(); lnqReport.DJH = m_assignBill.AssignNewNo(serverFrockProvingReport, "工装验证报告单"); lnqReport.DJZT = "等待检验要求"; lnqReport.BillType = "入库检验"; lnqReport.BZRQ = ServerTime.Time; lnqReport.ConnectBillNumber = ordinarybill.Bill_ID; lnqReport.FrockNumber = strFrockNumber; lnqReport.GoodsID = item.GoodsID; if (!serverFrockProvingReport.AddBill(lnqReport, null, out error)) { return(false); } S_FrockStandingBook lnqBook = new S_FrockStandingBook(); lnqBook.GoodsID = item.GoodsID; lnqBook.FrockNumber = strFrockNumber; lnqBook.Designer = UniversalFunction.GetPersonnelName(ordinarybill.Designer); if (!m_serverFrockStandingBook.UpdateFrockStandingBook(lnqBook, null, out error)) { return(false); } View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(lnqBook.GoodsID); m_billMessageServer.DestroyMessage(lnqReport.DJH); m_billMessageServer.SendNewFlowMessage(lnqReport.DJH, string.Format("【工装编号】:{0} 【图号型号】:{1} 【物品名称】:{2},※※※ 等待【工艺人员】处理", lnqReport.FrockNumber, goodsInfo.图号型号, goodsInfo.物品名称), CE_RoleEnum.工艺人员); } } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 更新工装台帐信息 /// </summary> /// <param name="frockStandingBook">工装台帐数据集</param> /// <param name="serviceTable">维修信息表</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> public bool UpdateFrockStandingBook(S_FrockStandingBook frockStandingBook, DataTable serviceTable, out string error) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.S_FrockStandingBook where a.GoodsID == frockStandingBook.GoodsID && a.FrockNumber == frockStandingBook.FrockNumber select a; if (varData.Count() == 0) { //string strSql = "select * from S_FrockProvingReport where GoodsID = " + frockStandingBook.GoodsID // + " and FrockNumber = '" + frockStandingBook.FrockNumber + "'"; //DataTable dtTemp = GlobalObject.DatabaseServer.QueryInfo(strSql); //if (dtTemp.Rows.Count > 0) //{ // error = "不能添加已存在工装验证报告单的工装台帐"; // return false; //} dataContext.S_FrockStandingBook.InsertOnSubmit(frockStandingBook); } else if (varData.Count() == 1) { S_FrockStandingBook lnqFrockStandingBook = varData.Single(); lnqFrockStandingBook.ApplyToDevice = frockStandingBook.ApplyToDevice; lnqFrockStandingBook.ApplyToProcess = frockStandingBook.ApplyToProcess; lnqFrockStandingBook.ApplyToProductCode = frockStandingBook.ApplyToProductCode; lnqFrockStandingBook.ApplyToProductName = frockStandingBook.ApplyToProductName; lnqFrockStandingBook.ApplyToWorkShop = frockStandingBook.ApplyToWorkShop; lnqFrockStandingBook.Designer = frockStandingBook.Designer; lnqFrockStandingBook.ParentFrockNumber = frockStandingBook.ParentFrockNumber; lnqFrockStandingBook.ParentGoodsID = frockStandingBook.ParentGoodsID; lnqFrockStandingBook.ScarpBillID = frockStandingBook.ScarpBillID; lnqFrockStandingBook.ScarpPersonnel = frockStandingBook.ScarpPersonnel; lnqFrockStandingBook.ScarpReason = frockStandingBook.ScarpReason; lnqFrockStandingBook.ScarpTime = frockStandingBook.ScarpTime; lnqFrockStandingBook.FinalPersonnel = BasicInfo.LoginName; lnqFrockStandingBook.FinalTime = ServerTime.Time; lnqFrockStandingBook.IdentifyCycle = frockStandingBook.IdentifyCycle; lnqFrockStandingBook.IdentifyCycleType = frockStandingBook.IdentifyCycleType; } else { error = "数据不唯一"; return(false); } if (!UpdateServiceData(dataContext, frockStandingBook.GoodsID, frockStandingBook.FrockNumber, serviceTable, out error)) { return(false); } dataContext.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 插入工装所有信息 /// </summary> /// <param name="frockBill">自制件工装信息</param> /// <param name="flag">是否进入工装台帐</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> bool CreateNewFrockMessage(S_FrockInDepotBill frockBill, bool flag, out string error) { error = null; FrockProvingReport serverFrockProvingReport = new FrockProvingReport(); try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.S_FrockInDepotGoodsBill where a.Bill_ID == frockBill.Bill_ID select a; foreach (var item in varData) { for (int i = 0; i < item.Amount; i++) { string strFrockNumber = GetNewFrockNumber(); S_FrockProvingReport lnqReport = new S_FrockProvingReport(); lnqReport.DJH = m_assignBill.AssignNewNo(serverFrockProvingReport, "工装验证报告单"); lnqReport.DJZT = "等待检验要求"; lnqReport.BillType = "入库检验"; lnqReport.BZRQ = ServerTime.Time; lnqReport.ConnectBillNumber = frockBill.Bill_ID; lnqReport.FrockNumber = strFrockNumber; lnqReport.GoodsID = item.GoodsID; if (!serverFrockProvingReport.AddBill(lnqReport, null, out error)) { return(false); } m_billMessageServer.SendNewFlowMessage(lnqReport.DJH, string.Format("{0} ※※※ 请【{1}】处理", UniversalFunction.GetGoodsMessage(lnqReport.GoodsID), CE_RoleEnum.工艺人员.ToString()), CE_RoleEnum.工艺人员); if (flag) { S_FrockStandingBook lnqBook = new S_FrockStandingBook(); lnqBook.GoodsID = item.GoodsID; lnqBook.FrockNumber = strFrockNumber; lnqBook.Designer = UniversalFunction.GetPersonnelName(frockBill.DesignerID); if (!m_serverFrockStandingBook.UpdateFrockStandingBook(lnqBook, null, out error)) { return(false); } } } } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }