private void btn_Add_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(btn_mat_code.Text.Trim())) { MessageBox.Show("物料编码不能为空!"); return; } if (string.IsNullOrEmpty(txt_group.Text.Trim())) { MessageBox.Show("组号不能为空!"); return; } try { Mod_TMO_ORDER mod = new Mod_TMO_ORDER(); mod.C_ID = System.Guid.NewGuid().ToString(); mod.C_ORDER_NO = "TW" + RV.UI.ServerTime.timeNow().ToString("yyyyMMddHHmmssfff"); mod.C_MAT_CODE = btn_mat_code.Text.Trim(); mod.C_MAT_NAME = txt_mat_name.Text.Trim(); mod.C_STL_GRD = txt_Grd.Text.Trim(); mod.C_STD_CODE = txt_STD1.Text.Trim(); mod.C_FREE1 = txt_ZYX1.Text.Trim(); mod.C_FREE2 = txt_ZYX2.Text.Trim(); mod.C_SPEC = Spec; mod.N_TYPE = 10; mod.C_CUST_NAME = "TW"; mod.N_WGT = 100; mod.N_GROUP = Convert.ToInt32(txt_group.Text); mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.C_EMP_NAME = RV.UI.UserInfo.UserName; mod.D_MOD_DT = RV.UI.ServerTime.timeNow(); if (bll_Order.Add(mod)) { Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加头尾订单");//添加操作日志 MessageBox.Show("添加成功!"); NewMethod(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_import_Click(object sender, EventArgs e) { try { WaitingFrom.ShowWait(""); DataTable dt = ReadExcel(this.txtUrl.Text); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { #region 导入订单 string strGUID = System.Guid.NewGuid().ToString(); Mod_TMO_ORDER modorder = new Mod_TMO_ORDER(); modorder.C_ID = System.Guid.NewGuid().ToString(); modorder.C_ORDER_NO = dt.Rows[i]["计划订单号"].ToString(); modorder.D_DT = Convert.ToDateTime(dt.Rows[i]["计划日期"].ToString()); modorder.D_NEED_DT = Convert.ToDateTime(dt.Rows[i]["需求日期"].ToString()); modorder.D_DELIVERY_DT = Convert.ToDateTime(dt.Rows[i]["交货日期"].ToString()); modorder.C_MAT_CODE = dt.Rows[i]["物料编码"].ToString(); modorder.C_STL_GRD = dt.Rows[i]["型号"].ToString(); modorder.C_SPEC = dt.Rows[i]["规格"].ToString(); modorder.C_MAT_NAME = dt.Rows[i]["工艺代码"].ToString(); Mod_TB_MATRL_MAIN modwl = bllwl.GetModel(modorder.C_MAT_CODE); if (modwl != null) { modorder.C_INVBASDOCID = modwl.C_PK_INVBASDOC; modorder.C_MAT_NAME = modwl.C_MAT_NAME; modorder.C_SPEC = modwl.C_SPEC; modorder.C_STL_GRD = modwl.C_STL_GRD; } else { // continue; } modorder.C_FREE1 = dt.Rows[i]["产品标准"].ToString(); modorder.C_FREE2 = dt.Rows[i]["技术要求"].ToString(); Mod_TQB_STD_MAIN modbz = bllbz.GetModel(modorder.C_STL_GRD, modorder.C_FREE1, modorder.C_FREE2); if (modbz != null) { modorder.C_STD_CODE = modbz.C_STD_CODE; } // modorder.C_STD_CODE= modorder.C_PACK = dt.Rows[i]["包装"].ToString(); modorder.N_WGT = Convert.ToDecimal(dt.Rows[i]["需求数量"].ToString()); modorder.C_AREA = dt.Rows[i]["其他要求"].ToString(); modorder.C_TRANSMODE = dt.Rows[i]["内部备注"].ToString(); modorder.C_ORDER_LEV = dt.Rows[i]["订单级别"].ToString(); modorder.C_PRO_USE = dt.Rows[i]["客户用途"].ToString(); modorder.N_PROD_WGT = Convert.ToDecimal(dt.Rows[i]["完工数量"].ToString() == ""?"0": dt.Rows[i]["完工数量"].ToString()); modorder.N_EXEC_STATUS = 0; //订单刚导入状态 modorder.N_TYPE = 8; //线材订单 modorder.N_STATUS = 2; //可执行 modorder.C_REMARK = "导入"; //标志订单是导入的 modorder.C_CON_NO = (Convert.ToInt64(System.DateTime.Now.ToString("yyMMdd") + "0001") + i).ToString(); if (Convert.ToDouble(modorder.N_PROD_WGT) < Convert.ToDouble(modorder.N_WGT) * 0.9) { modorder.N_WGT = modorder.N_WGT - modorder.N_PROD_WGT; bllorder.Add(modorder);//生产量大于90%的视同完成 } #endregion } MessageBox.Show("订单导入成功!"); WaitingFrom.CloseWait(); btn_query_main_Click(null, null); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Save2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cbo_FA.Text.Trim())) { MessageBox.Show("请选择方案号!"); return; } if (string.IsNullOrEmpty(btnEdit_Std.Text.Trim())) { MessageBox.Show("请选择执行标准!"); return; } if (string.IsNullOrEmpty(txt_Std_Grd.Text.Trim())) { MessageBox.Show("请填写钢种!"); return; } if (string.IsNullOrEmpty(cbo_CC.Text.Trim()) || cbo_CC.Text == "全部") { MessageBox.Show("请选择连铸!"); return; } if (string.IsNullOrEmpty(txt_Wgt.Text.Trim())) { MessageBox.Show("请填写重量!"); return; } else { double result = 0; if (!double.TryParse(txt_Wgt.Text.Trim(), out result)) { MessageBox.Show("填写的重量不符合规范!"); return; } } Mod_TMO_ORDER modeOrder = new Mod_TMO_ORDER(); modeOrder.C_ORDER_NO = "SD-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //订单号 modeOrder.C_CON_NO = "SD-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //合同号 modeOrder.C_STL_GRD = txt_Std_Grd.Text.Trim(); //钢种 modeOrder.C_STD_CODE = btnEdit_Std.Text.Trim(); //执行标准 modeOrder.N_STATUS = 2; //订单状态 modeOrder.N_WGT = Convert.ToDecimal(txt_Wgt.Text.Trim()); //订单重量 modeOrder.N_TYPE = 6; //6钢坯;8线材 modeOrder.C_EMP_ID = RV.UI.UserInfo.userID; modeOrder.C_MAT_CODE = txt_MatCode.Text.Trim(); //物料编码 modeOrder.C_MAT_NAME = txt_MatName.Text.Trim(); //物料名称 modeOrder.C_SPEC = txt_Spec.Text.Trim(); //断面 if (bll_TMO_ORDER.Add(modeOrder)) { string s_id = bll_TMO_ORDER.Get_ID(modeOrder.C_ORDER_NO, modeOrder.C_CON_NO, modeOrder.C_STL_GRD, modeOrder.C_STD_CODE); Mod_TPP_INITIALIZE_ORDER modINITIALIZEORDER = new Mod_TPP_INITIALIZE_ORDER(); modINITIALIZEORDER.C_INITIALIZE_ID = cbo_FA.EditValue.ToString(); modINITIALIZEORDER.C_ORDER_ID = s_id; modINITIALIZEORDER.N_WGT = Convert.ToDecimal(txt_Wgt.Text.Trim());//订单重量 modINITIALIZEORDER.C_CCM_STA_ID = cbo_CC.EditValue.ToString(); modINITIALIZEORDER.C_EMP_ID = RV.UI.UserInfo.userID; bll_ini_order.Add(modINITIALIZEORDER); MessageBox.Show("订单手动增加成功!"); Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "手动添加订单");//添加操作日志 } }