private void 产品编号_Load(object sender, EventArgs e) { if (!UniversalFunction.IsProduct(m_barCodeInfo.GoodsID)) { this.Close(); } this.timer1.Enabled = true; m_blIsTCUFlag = Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(m_barCodeInfo.GoodsID, CE_GoodsAttributeName.TCU)); txtGoodsName.Text = m_barCodeInfo.GoodsName; txtGoodsName.Tag = m_barCodeInfo.GoodsID; txtGoodsCode.Text = m_barCodeInfo.GoodsCode; txtSpec.Text = m_barCodeInfo.Spec; txtBatchNo.Text = m_barCodeInfo.BatchNo; txtCount.Text = m_barCodeInfo.Count.ToString(); //if (!m_blIsTCUFlag) //{ // BoxNo.Visible = false; // txtBoxNo.Visible = false; // label12.Visible = false; // timer1.Enabled = false; //} IProductListServer serverProductList = ServerModule.ServerModuleFactory.GetServerModule <IProductListServer>(); if (Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(m_barCodeInfo.GoodsID, CE_GoodsAttributeName.CVT))) { txtCode.Enabled = false; } ShowDate(); dataGridView1.DataSource = m_dtProductCodes; }
/// <summary> /// 添加事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { if (CheckForm()) { if (CheckSameGoods()) { DataRow dr = m_dtMxRK.NewRow(); dr["CPID"] = Convert.ToInt32(tbsGoods.Tag); dr["GoodsCode"] = txtGoodsCode.Text; dr["GoodsName"] = tbsGoods.Text; dr["Spec"] = txtSpce.Text; dr["Depot"] = txtGoodsCode.Tag.ToString(); dr["BatchNo"] = txtBatchNo.Text; dr["UnitPrice"] = numUnitPrice.Value; dr["Count"] = numCount.Value; dr["Unit"] = lbUnit.Text; dr["Price"] = Math.Round(numCount.Value * numUnitPrice.Value, 4); dr["Remark"] = txtRemark.Text; dr["Provider"] = txtSpce.Tag.ToString(); IProductListServer serverProductList = ServerModule.ServerModuleFactory.GetServerModule <IProductListServer>(); if (Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(Convert.ToInt32(tbsGoods.Tag), CE_GoodsAttributeName.TCU))) { dr["Version"] = cmbType.Text.Trim() + " " + numVersion.Value.ToString(); } else { dr["Version"] = ""; } m_dtMxRK.Rows.Add(dr); dgv_Main.DataSource = m_dtMxRK; if (m_dtMxRK.Rows.Count > 0) { txtPrice.Text = (Convert.ToDecimal(txtPrice.Text) + Convert.ToDecimal(dr["Price"])).ToString(); } else { txtPrice.Text = dr["Prcie"].ToString(); } ClearDate(); } } }
private void btnCheck_Click(object sender, EventArgs e) { if (m_strDJZTFlag == "已审核") { if (m_findSellIn.ExamineBill(txtSellID.Text, txtRemarkAll.Text, out m_err)) { IProductListServer serverProductList = ServerModule.ServerModuleFactory.GetServerModule <IProductListServer>(); bool flag = false; for (int i = 0; i < dgv_Main.Rows.Count; i++) { if (Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(Convert.ToInt32(dgv_Main.Rows[i].Cells["CPID"].Value), CE_GoodsAttributeName.TCU))) { flag = true; break; } } if (flag) { m_billMessageServer.PassFlowMessage(txtSellID.Text, string.Format("【退货方式】:{0} 【库房】:{1} ※※※ 等待【TCU车间主管】处理", cmbTHFS.Text, cmbStorage.Text), CE_RoleEnum.TCU主管.ToString(), true); } else { m_billMessageServer.PassFlowMessage(txtSellID.Text, string.Format("【退货方式】:{0} 【库房】:{1} ※※※ 等待【下线主管】处理", cmbTHFS.Text, cmbStorage.Text), CE_RoleEnum.线主管.ToString(), true); } MessageBox.Show("检验通过!", "提示"); this.Close(); } } else { MessageBox.Show("请重新确认单据状态", "提示"); } }
/// <summary> /// 窗体检查 /// </summary> /// <returns>检测通过返回True,否则返回False</returns> private bool CheckForm() { if (tbsGoods.Text.Trim() == "" || tbsGoods.Tag == null || tbsGoods.Tag.ToString() == "" || tbsGoods.Tag.ToString() == "-1") { MessageBox.Show("请选择产品", "提示"); tbsGoods.Focus(); return(false); } if (cmbRKFS.Text == "") { MessageDialog.ShowPromptMessage("请选择入库方式"); cmbRKFS.Focus(); return(false); } if (cmbStorage.Text == "") { cmbStorage.Focus(); MessageDialog.ShowPromptMessage("所属库房不允许为空!"); return(false); } IProductListServer serverProductList = ServerModule.ServerModuleFactory.GetServerModule <IProductListServer>(); if (Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(Convert.ToInt32(tbsGoods.Tag.ToString()), CE_GoodsAttributeName.TCU)) && (cmbType.Text.Trim() == "" || numVersion.Value == 0)) { cmbType.Focus(); MessageDialog.ShowPromptMessage("请选择所属型号及版本号"); return(false); } return(true); }
/// <summary> /// 插入客户信息历史记录,若更换的是CVT,则修改客户信息中对应的车架号的CVT编号 /// </summary> /// <param name="serviceID">反馈单号</param> /// <param name="vehicleShelfNumber">车架号</param> /// <param name="cvtType">变速箱型号</param> /// <param name="carModel">车型</param> /// <param name="clientName">客户名称</param> /// <param name="dealerName">经销商名称</param> /// <param name="replaceAccessoryList">更换件列表</param> /// <param name="error">错误信息</param> /// <returns>操作成功返回True,操作失败返回False</returns> public bool InsertCustomerHistoryInfo(string serviceID, string vehicleShelfNumber, string cvtType, string carModel, string clientName, string dealerName, DataTable replaceAccessoryList, out string error) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; for (int i = 0; i < replaceAccessoryList.Rows.Count; i++) { YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory(); lnqCustomerHistory.CarModel = carModel; lnqCustomerHistory.ClientName = clientName; lnqCustomerHistory.CVTType = cvtType; lnqCustomerHistory.DealerName = dealerName; lnqCustomerHistory.FinishDate = ServerTime.Time; lnqCustomerHistory.FinishPersonnel = BasicInfo.LoginName; lnqCustomerHistory.NewPartCode = replaceAccessoryList.Rows[i]["NewGoodsID"].ToString().Trim() == "" ? replaceAccessoryList.Rows[i]["NewCvtID"].ToString().Trim() : replaceAccessoryList.Rows[i]["NewGoodsID"].ToString().Trim(); lnqCustomerHistory.OldPartCode = replaceAccessoryList.Rows[i]["OldGoodsID"].ToString().Trim() == "" ? replaceAccessoryList.Rows[i]["OldCvtID"].ToString().Trim() : replaceAccessoryList.Rows[i]["OldGoodsID"].ToString().Trim(); lnqCustomerHistory.ReplaceCode = replaceAccessoryList.Rows[i]["OldGoodsCode"].ToString(); lnqCustomerHistory.ReplaceName = replaceAccessoryList.Rows[i]["OldGoodsName"].ToString(); lnqCustomerHistory.ReplaceSpec = replaceAccessoryList.Rows[i]["OldSpec"].ToString(); lnqCustomerHistory.VehicleShelfNumber = vehicleShelfNumber; lnqCustomerHistory.Remark = "由单号为【" + serviceID + "】售后反馈单,自动生成"; dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory); IProductListServer serverProductList = ServerModuleFactory.GetServerModule <IProductListServer>(); int intGoodsID = serverProductList.GetProductGoodsID(replaceAccessoryList.Rows[i]["OldGoodsCode"].ToString(), 0, true); if (intGoodsID != 0) { var varData = from a in dataContext.YX_CVTCustomerInformation where a.VehicleShelfNumber == vehicleShelfNumber select a; if (varData.Count() == 1) { YX_CVTCustomerInformation lnqCustomerInfo = varData.Single(); lnqCustomerInfo.ProductID = intGoodsID; lnqCustomerInfo.CVTNumber = replaceAccessoryList.Rows[i]["NewCvtID"].ToString().Trim(); } else { error = "车架号在客户信息内不唯一或者不存在"; return(false); } } } dataContext.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 更改数据CVT客户基础信息 /// </summary> /// <param name="cvtCustomer">CVT客户信息</param> /// <param name="error">c错误信息</param> /// <returns>更改成功返回True,更改失败返回False</returns> public bool UpdateCVTCustomerInformation(YX_CVTCustomerInformation cvtCustomer, out string error) { error = null; try { DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.YX_CVTCustomerInformation where a.ID != cvtCustomer.ID && a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber select a; if (varData.Count() != 0) { error = "数据不唯一"; return(false); } else { var varCVT = from a in dataContext.YX_CVTCustomerInformation where a.ID == cvtCustomer.ID select a; if (varCVT.Count() == 1) { YX_CVTCustomerInformation lnqCustomer = varCVT.Single(); lnqCustomer.CarModelID = cvtCustomer.CarModelID; lnqCustomer.ClientName = cvtCustomer.ClientName; lnqCustomer.CVTNumber = cvtCustomer.CVTNumber; lnqCustomer.DealerName = cvtCustomer.DealerName; lnqCustomer.FullAddress = cvtCustomer.FullAddress; lnqCustomer.PhoneNumber = cvtCustomer.PhoneNumber; lnqCustomer.ProductID = cvtCustomer.ProductID; lnqCustomer.Remark = cvtCustomer.Remark; lnqCustomer.SellDate = cvtCustomer.SellDate; lnqCustomer.SiteCity = cvtCustomer.SiteCity; lnqCustomer.SiteProvince = cvtCustomer.SiteProvince; lnqCustomer.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber; lnqCustomer.VKT = cvtCustomer.VKT; lnqCustomer.OverTheReason = cvtCustomer.OverTheReason; lnqCustomer.ProofNo = cvtCustomer.ProofNo; var varInfo = from a in dataContext.YX_CVTCustomerInformation where a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber select a; if (varInfo.Count() == 1) { YX_CVTCustomerInformation lnqInfo = varInfo.Single(); if (lnqInfo.CVTNumber != cvtCustomer.CVTNumber) { YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory(); IProductListServer serverProcutList = ServerModuleFactory.GetServerModule <IProductListServer>(); lnqCustomerHistory.CarModel = serverProcutList.GetMotorcycleInfo(Convert.ToInt32(cvtCustomer.CarModelID)); lnqCustomerHistory.ClientName = cvtCustomer.ClientName; IBasicGoodsServer serverBasicGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>(); F_GoodsPlanCost lnqGoods = serverBasicGoods.GetGoodsInfo(Convert.ToInt32(cvtCustomer.ProductID)); lnqCustomerHistory.CVTType = lnqGoods.GoodsCode; lnqCustomerHistory.DealerName = cvtCustomer.DealerName; lnqCustomerHistory.FinishDate = ServerTime.Time; lnqCustomerHistory.FinishPersonnel = BasicInfo.LoginName; lnqCustomerHistory.NewPartCode = cvtCustomer.CVTNumber; lnqCustomerHistory.OldPartCode = lnqInfo.CVTNumber; lnqCustomerHistory.Remark = "手动修改"; lnqCustomerHistory.ReplaceCode = lnqGoods.GoodsCode; lnqCustomerHistory.ReplaceName = lnqGoods.GoodsName; lnqCustomerHistory.ReplaceSpec = lnqGoods.Spec; lnqCustomerHistory.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber; dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory); } } } } dataContext.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 点击确认,把信息添加到DataTable中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { if (txtOldCode.Text.Trim() == "" && txtGoodsSpec.Text.Trim() == "") { MessageDialog.ShowPromptMessage("请选择返回件及返回日期!"); return; } if ((txtOldCvtID.Text != "" && txtOldCvtID.Text.Trim().Length < 9) || (txtNewCvtID.Text != "" && txtNewCvtID.Text.Trim().Length < 9)) { MessageDialog.ShowPromptMessage("请填写正确的总成编号!"); return; } if (dtpGiveOutDate.Checked == false) { MessageDialog.ShowPromptMessage("请填写旧件发出日期!"); return; } if (dtpGiveOutDate.Value > dtpBackTime.Value) { MessageDialog.ShowPromptMessage("旧件发出日期不能大于旧件返回日期!"); return; } if (txtOldCode.Text.Trim() != "") { if (UniversalFunction.IsProduct(Convert.ToInt32(txtOldCode.Tag.ToString()))) { m_flag = true; if (!m_serverProductCode.VerifyProductCodesInfo(Convert.ToInt32(txtOldCode.Tag.ToString()), txtOldGoodsID.Text.Trim(), GlobalObject.CE_BarCodeType.内部钢印码, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } IProductListServer serverProductList = ServerModule.ServerModuleFactory.GetServerModule <IProductListServer>(); if (Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(Convert.ToInt32(txtOldCode.Tag.ToString()), GlobalObject.CE_GoodsAttributeName.CVT))) { m_NewGoodsCode = txtOldCode.Text; m_NewGoodsID = txtOldCvtID.Text; if (txtOldGoodsID.Text.Trim() != txtOldCvtID.Text.Trim()) { MessageDialog.ShowPromptMessage("当返回件是总成时,返回件编号和总成编号必须一致"); return; } } } } if (txtNewCode.Text.Trim() != "") { if (UniversalFunction.IsProduct(Convert.ToInt32(txtNewCode.Tag.ToString()))) { if (!m_serverProductCode.VerifyProductCodesInfo(Convert.ToInt32(txtNewCode.Tag.ToString()), txtNewGoodsID.Text.Trim(), GlobalObject.CE_BarCodeType.内部钢印码, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } IProductListServer serverProductList = ServerModule.ServerModuleFactory.GetServerModule <IProductListServer>(); if (Convert.ToBoolean(UniversalFunction.GetGoodsAttributeInfo(Convert.ToInt32(txtNewCode.Tag), GlobalObject.CE_GoodsAttributeName.CVT))) { if (txtNewCvtID.Text.Trim() != txtNewGoodsID.Text.Trim()) { MessageDialog.ShowPromptMessage("当更新件是总成时,更新件编号和总成编号必须一致"); return; } } else { m_newGoodsID = txtNewGoodsID.Text; } } } if (CheckSameGoods()) { DataRow dr = m_dtList.NewRow(); dr["ServiceID"] = m_strServiceID; dr["OldGoodsName"] = txtGoodsName.Text; dr["OldGoodsCode"] = txtOldCode.Text; dr["OldSpec"] = txtGoodsSpec.Text; dr["OldCvtID"] = txtOldCvtID.Text; dr["BackTime"] = dtpBackTime.Value; dr["NewGoodsName"] = textBox2.Text; dr["NewGoodsCode"] = txtNewCode.Text; dr["NewSpec"] = textBox1.Text; dr["NewCvtID"] = txtNewCvtID.Text; dr["NewGoodsID"] = txtNewGoodsID.Text; dr["OldGoodsID"] = txtOldGoodsID.Text; dr["Count"] = txtCount.Value.ToString(); dr["Unit"] = txtUnit.Text; dr["GiveOutDate"] = dtpGiveOutDate.Value; m_dtList.Rows.Add(dr); m_strBackCvtID = dr["OldCvtID"].ToString(); dataGridView1.DataSource = m_dtList; txtOldCode.Text = ""; txtGoodsName.Text = ""; txtGoodsSpec.Text = ""; txtOldCvtID.Text = ""; txtNewCvtID.Text = ""; txtNewCode.Text = ""; txtCount.Text = "0"; textBox1.Text = ""; textBox2.Text = ""; txtUnit.Text = ""; } }