コード例 #1
0
        /// <summary>
        /// 调拨处理
        /// </summary>
        /// <returns></returns>
        public string AllotHandler(string staID, string stove, string grd, string spec, string std,
                                   string matCode, int num, string slabwhCode, string shift, string group)
        {
            string result = "1";

            try
            {
                TransactionHelper.BeginTransaction();

                DataTable billet = new DataTable();
                if (dal.AllotGrdType(staID, stove, grd, spec, std, matCode, num, slabwhCode, shift, group, out billet) != num)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }



                if (billet != null && billet.Rows.Count > 0)
                {
                    DateTime time = DateTime.Now;
                    foreach (DataRow item in billet.Rows)
                    {
                        Mod_TSC_ALLOT_CENTER model = new Mod_TSC_ALLOT_CENTER();
                        model.C_STL_GRD      = grd;
                        model.C_SPEC         = spec;
                        model.C_STD_CODE     = std;
                        model.C_MAT_CODE     = matCode;
                        model.C_STOVE        = stove;
                        model.C_SLAB_MAIN_ID = item["C_ID"].ToString();
                        model.C_SLABWH_CODE  = slabwhCode;
                        model.C_STA_ID       = staID;
                        model.N_TYPE         = 1;
                        model.D_MOD_DT       = time;
                        model.C_EMP_ID       = RV.UI.UserInfo.userID;
                        if (!centerDal.Add(model))
                        {
                            TransactionHelper.RollBack();
                            return("0");
                        }
                    }

                    foreach (DataRow item in billet.Rows)
                    {
                        Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG();
                        model.C_STL_GRD      = grd;
                        model.C_SPEC         = spec;
                        model.C_STD_CODE     = std;
                        model.C_MAT_CODE     = matCode;
                        model.C_STOVE        = stove;
                        model.C_SLAB_MAIN_ID = item["C_ID"].ToString();
                        model.C_SLABWH_CODE  = slabwhCode;
                        model.C_STA_ID       = staID;
                        model.N_TYPE         = 1;
                        model.D_MOD_DT       = time;
                        model.C_EMP_ID       = RV.UI.UserInfo.userID;
                        if (!logDal.Add(model))
                        {
                            TransactionHelper.RollBack();
                            return("0");
                        }
                    }
                }

                TransactionHelper.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }

            return(result);
        }