/// <summary> /// 获得序号 /// </summary> /// <param name="Dt">数据集</param> /// <returns>返回获得序号后的数据集</returns> //DataTable GetCountNumber(DataTable Dt) //{ // for (int i = 0; i < Dt.Rows.Count; i++) // { // Dt.Rows[i]["序号"] = i + 1; // } // return Dt; //} private void btnAdd_Click(object sender, EventArgs e) { try { txtProductCode.Text = txtProductCode.Text.ToUpper(); if (!CheckForm()) { return; } //获得入库方式 cmbRKFS.Text = m_findSellIn.GetInStockWay(cmbProduct.Text.ToString(), txtProductCode.Text.ToString()); //检测钢印规则 if (!m_serverProductCode.VerifyProductCodesInfo(Convert.ToInt32(cmbProduct.Tag), txtProductCode.Text.Trim(), GlobalObject.CE_BarCodeType.内部钢印码, out m_err)) { MessageDialog.ShowPromptMessage(m_err); return; } if (!m_findSellIn.IsProductCodeOperationStandard(CE_MarketingType.入库.ToString(), typeof(CE_MarketingType), Convert.ToInt32(cmbProduct.Tag), txtProductCode.Text, cmbStorage.Tag.ToString(), out m_err)) { MessageDialog.ShowPromptMessage(m_err); return; } Service_Manufacture_WorkShop.IWorkShopBasic serverWorkShopBasic = Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>(); WS_WorkShopCode tempWorkCode = serverWorkShopBasic.GetPersonnelWorkShop(BasicInfo.LoginID); if (tempWorkCode == null) { throw new Exception("您不是车间人员,无法执行产品入库业务"); } if (!m_findSellIn.IsProductCodeOperationStandard(CE_SubsidiaryOperationType.营销入库.ToString(), typeof(CE_SubsidiaryOperationType), Convert.ToInt32(cmbProduct.Tag), txtProductCode.Text, tempWorkCode.WSCode, out m_err)) { MessageDialog.ShowPromptMessage(m_err); return; } if (dataGridView1.DataSource != null) { m_dtProductCodes = (DataTable)dataGridView1.DataSource; } DataRow dr = m_dtProductCodes.NewRow(); dr["产品名称"] = cmbProduct.Text.ToString(); dr["箱体编号"] = txtProductCode.Text; dr["入库方式"] = cmbRKFS.Text.ToString(); dr["入库库房"] = cmbStorage.Text.ToString(); dr["物品ID"] = Convert.ToInt32(cmbProduct.Tag); dr["库房ID"] = cmbStorage.Tag.ToString(); ProductCode_AutoCreatePutIn_Subsidiary lnqTemp = new ProductCode_AutoCreatePutIn_Subsidiary(); lnqTemp.GoodsID = Convert.ToInt32(dr["物品ID"]); lnqTemp.ProductCode = dr["箱体编号"].ToString(); lnqTemp.PutInType = dr["入库方式"].ToString(); lnqTemp.StorageID = dr["库房ID"].ToString(); if (!CheckSameGoods(dr)) { return; } m_dtProductCodes.Rows.Add(dr); dataGridView1.DataSource = m_dtProductCodes; m_serverProductCode.Add_AutoCreatePutIn_Subsidiary(lnqTemp); PositioningRecord(dr); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }