예제 #1
0
        public OutReserveModel ReaderBind(IDataReader dataReader)
        {
            OutReserveModel model = new OutReserveModel {
                orid    = dataReader["orid"].ToString(),
                orcode  = dataReader["orcode"].ToString(),
                procode = dataReader["procode"].ToString(),
                tcode   = dataReader["tcode"].ToString()
            };
            object obj2 = dataReader["flowstate"];

            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                model.flowstate = (int)obj2;
            }
            obj2 = dataReader["isout"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                model.isout = (bool)obj2;
            }
            model.person = dataReader["person"].ToString();
            obj2         = dataReader["intime"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                model.intime = (DateTime)obj2;
            }
            model.annx          = dataReader["annx"].ToString();
            model.explain       = dataReader["explain"].ToString();
            model.PickingPeople = dataReader["PickingPeople"].ToString();
            model.PickingSector = dataReader["PickingSector"].ToString();
            model.EquipmentId   = dataReader["EquipmentId"].ToString();
            return(model);
        }
예제 #2
0
    private void saveImg(string v)
    {
        string          strImg   = dataUrl.Value.ToString();
        string          strKeyId = KeyId.Value.ToString();
        OutReserveModel model2   = this.outReserveBll.GetModelByIc(strKeyId);

        //model2.isout = true;
        //model2.IsOutTime = DateTime.Now;
        model2.writeName = strImg;
        int num2 = this.outReserveBll.Update(null, model2);

        if (num2 > 0)
        {
            base.RegisterScript("alert('系统提示:\\n\\n操作成功');");
        }
        else
        {
            base.RegisterScript("alert('系统提示:\\n\\n操作失败');");
        }
        if (v == "pc")
        {
            base.RegisterScript("location='QOutReserve.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
        }
        if (v == "wx")
        {
            base.RegisterScript("location='QOutReserveWX.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
        }
    }
예제 #3
0
 protected void btnDel_Click(object sender, EventArgs e)
 {
     using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
     {
         sqlConnection.Open();
         SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
         List <string>  list           = new List <string>();
         try
         {
             foreach (GridViewRow gridViewRow in this.gvPurchaseplan.Rows)
             {
                 CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox;
                 if (checkBox != null && checkBox.Checked)
                 {
                     sm_receiveNote  modelByrnId = this.receiveNote.GetModelByrnId(checkBox.ToolTip);
                     OutReserveModel modelByIc   = this.outReserveBll.GetModelByIc(modelByrnId.soId);
                     if (modelByIc != null)
                     {
                         this.outStockBll.DeleteByWhere(sqlTransaction, " where orcode ='" + modelByIc.orcode + "'");
                         this.outReserveBll.Delete(sqlTransaction, modelByIc.orcode);
                     }
                     StorageModel modelBySid = this.storage.GetModelBySid(modelByrnId.stId);
                     if (modelBySid != null)
                     {
                         list.Add(modelBySid.scode);
                     }
                     if (!string.IsNullOrEmpty(modelByrnId.SAllocationId))
                     {
                         AllocationBllAction allocationBllAction = new AllocationBllAction();
                         AllocationModel     allocationModel     = new AllocationModel();
                         allocationModel = allocationBllAction.ReturnAllocatonModel(" aid='" + modelByrnId.SAllocationId + "'");
                         if (allocationModel != null)
                         {
                             allocationBllAction.DelAllocationStockByAcode(sqlTransaction, allocationModel.Acode);
                             allocationBllAction.Delete(sqlTransaction, allocationModel.Acode);
                         }
                     }
                     this.receiveGoods.Delete(sqlTransaction, modelByrnId.rnId);
                     this.receiveNote.Delete(sqlTransaction, modelByrnId.rnId);
                     this.sendNote.UpdateStateNo(sqlTransaction, modelByrnId.snId);
                 }
             }
             if (list.Count != 0)
             {
                 this.storage.DelByTrans(sqlTransaction, list);
             }
             sqlTransaction.Commit();
             this.BindGv();
         }
         catch
         {
             sqlTransaction.Rollback();
             base.RegisterScript("alert('系统提示:\\n\\n对不起撤销失败!');");
         }
     }
 }
예제 #4
0
파일: OutReserve.cs 프로젝트: zxl881203/src
        public int Update(SqlTransaction trans, OutReserveModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update Sm_OutReserve set ");
            builder.Append("orid=@orid,");
            builder.Append("procode=@procode,");
            builder.Append("tcode=@tcode,");
            builder.Append("flowstate=@flowstate,");
            builder.Append("isout=@isout,");
            builder.Append("person=@person,");
            builder.Append("intime=@intime,");
            builder.Append("annx=@annx,");
            builder.Append("explain=@explain,");
            builder.Append("PickingPeople=@PickingPeople,");
            builder.Append("PickingSector=@PickingSector,");
            builder.Append("isouttime=@isouttime,");
            builder.Append("writeName=@writeName,");
            builder.Append("EquipmentId=@EquipmentId ");
            builder.Append(" where orcode=@orcode ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@orid", SqlDbType.NVarChar, 50), new SqlParameter("@orcode", SqlDbType.NVarChar, 0x40), new SqlParameter("@procode", SqlDbType.NVarChar, 0x40), new SqlParameter("@tcode", SqlDbType.NVarChar, 0x200), new SqlParameter("@flowstate", SqlDbType.Int, 4), new SqlParameter("@isout", SqlDbType.Bit, 1), new SqlParameter("@person", SqlDbType.NVarChar, 0x40), new SqlParameter("@intime", SqlDbType.SmallDateTime), new SqlParameter("@annx", SqlDbType.NVarChar, 0x80), new SqlParameter("@explain", SqlDbType.NVarChar, 0x800), new SqlParameter("@PickingPeople", SqlDbType.NVarChar, 0x200), new SqlParameter("@PickingSector", SqlDbType.NVarChar, 0x200), new SqlParameter("@isouttime", SqlDateTime.MinValue), new SqlParameter("@writeName", SqlDbType.Text), new SqlParameter("@EquipmentId", SqlDbType.NVarChar, 500) };
            commandParameters[0].Value  = model.orid;
            commandParameters[1].Value  = model.orcode;
            commandParameters[2].Value  = model.procode;
            commandParameters[3].Value  = model.tcode;
            commandParameters[4].Value  = model.flowstate;
            commandParameters[5].Value  = model.isout;
            commandParameters[6].Value  = model.person;
            commandParameters[7].Value  = model.intime;
            commandParameters[8].Value  = model.annx;
            commandParameters[9].Value  = model.explain;
            commandParameters[10].Value = model.PickingPeople;
            commandParameters[11].Value = model.PickingSector;
            commandParameters[12].Value = model.IsOutTime;
            commandParameters[13].Value = model.writeName;
            if (!string.IsNullOrEmpty(model.EquipmentId))
            {
                commandParameters[14].Value = model.EquipmentId;
            }
            else
            {
                commandParameters[14].Value = DBNull.Value;
            }
            if (trans == null)
            {
                return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
            }
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }
예제 #5
0
 public void SuperDelete(object key)
 {
     using (SqlConnection connection = new SqlConnection(SqlHelper.ConnectionString))
     {
         connection.Open();
         SqlTransaction trans          = connection.BeginTransaction();
         List <string>  lstStorageCode = new List <string>();
         try
         {
             sm_receiveNote  modelByrnId = this.receiveNote.GetModelByrnId(key.ToString());
             OutReserveModel modelByIc   = this.outReserveBll.GetModelByIc(modelByrnId.soId);
             if (modelByIc != null)
             {
                 this.outStockBll.DeleteByWhere(trans, " where orcode ='" + modelByIc.orcode + "'");
                 this.outReserveBll.Delete(trans, modelByIc.orcode);
             }
             StorageModel modelBySid = this.storage.GetModelBySid(modelByrnId.stId);
             if (modelBySid != null)
             {
                 lstStorageCode.Add(modelBySid.scode);
             }
             if (!string.IsNullOrEmpty(modelByrnId.SAllocationId))
             {
                 AllocationBllAction action = new AllocationBllAction();
                 AllocationModel     model3 = new AllocationModel();
                 model3 = action.ReturnAllocatonModel(" aid='" + modelByrnId.SAllocationId + "'");
                 if (model3 != null)
                 {
                     action.DelAllocationStockByAcode(trans, model3.Acode);
                     action.Delete(trans, model3.Acode);
                 }
             }
             this.receiveGood.Delete(trans, modelByrnId.rnId);
             this.receiveNote.Delete(trans, modelByrnId.rnId);
             this.sendnote.UpdateStateNo(trans, modelByrnId.snId);
             if (lstStorageCode.Count != 0)
             {
                 this.storage.DelByTrans(trans, lstStorageCode);
             }
             trans.Commit();
         }
         catch
         {
             trans.Rollback();
             base.RegisterScript(@"alert('系统提示:\n\n对不起撤销失败!');");
         }
     }
 }
예제 #6
0
        public OutReserveModel GetModelByIc(string ic)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select orid,orcode,procode,tcode,flowstate,isout,person,intime,annx,explain,PickingPeople,PickingSector,EquipmentId from Sm_OutReserve ");
            builder.Append(" where orid=@orid ");
            OutReserveModel model = null;

            using (IDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, builder.ToString(), new SqlParameter[] { new SqlParameter("@orid", ic) }))
            {
                if (reader.Read())
                {
                    model = this.ReaderBind(reader);
                }
            }
            return(model);
        }
예제 #7
0
        private void smOutReserve(SqlTransaction trans)
        {
            OutReserveModel model = new OutReserveModel {
                annx      = "",
                explain   = "",
                flowstate = 1,
                intime    = DateTime.Now,
                isout     = true,
                orcode    = DateTime.Now.ToString("yyyyMMddHHmmss"),
                orid      = Guid.NewGuid().ToString()
            };

            this.ReceiveNoteModel.soId = model.orid;
            model.person        = this.UserName;
            model.procode       = this.SendNoteMdoleInfo.prjCode.ToString();
            model.tcode         = this.TreasuryCode;
            model.PickingSector = this.getUserDepartmentName(this.sendNoteMdoleInfo.snAddUser);
            model.PickingPeople = this.UserName;
            model.IsOutTime     = DateTime.Now;
            if (this.outReserveBll.Add(trans, model) != 0)
            {
                this.outStockBll.DeleteByWhere(trans, " where orcode='" + model.orcode + "'");
                DataTable table = (DataTable)this.ViewState["DataTable"];
                if (table != null)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        OutStockModel model2 = new OutStockModel {
                            corp   = row["suppyCode"].ToString(),
                            number = Convert.ToDecimal(row["number"].ToString()),
                            orcode = model.orcode,
                            orsid  = Guid.NewGuid().ToString(),
                            scode  = row["scode"].ToString(),
                            sprice = Convert.ToDecimal(row["price"]),
                            TaskId = string.Empty
                        };
                        this.outStockBll.Add(trans, model2);
                    }
                }
            }
        }
예제 #8
0
        public int Add(SqlTransaction trans, OutReserveModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into Sm_OutReserve(");
            builder.Append("orid,orcode,procode,tcode,flowstate,isout,person,intime,annx,explain,PickingPeople,PickingSector,isouttime,EquipmentId)");
            builder.Append(" values (");
            builder.Append("@orid,@orcode,@procode,@tcode,@flowstate,@isout,@person,@intime,@annx,@explain,@PickingPeople,@PickingSector,@isouttime,@EquipmentId)");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@orid", SqlDbType.NVarChar, 50), new SqlParameter("@orcode", SqlDbType.NVarChar, 0x40), new SqlParameter("@procode", SqlDbType.NVarChar, 0x40), new SqlParameter("@tcode", SqlDbType.NVarChar, 0x200), new SqlParameter("@flowstate", SqlDbType.Int, 4), new SqlParameter("@isout", SqlDbType.Bit, 1), new SqlParameter("@person", SqlDbType.NVarChar, 0x40), new SqlParameter("@intime", SqlDbType.SmallDateTime), new SqlParameter("@annx", SqlDbType.NVarChar, 0x80), new SqlParameter("@explain", SqlDbType.NVarChar, 0x800), new SqlParameter("@PickingPeople", SqlDbType.NVarChar, 0x200), new SqlParameter("@PickingSector", SqlDbType.NVarChar, 0x200), new SqlParameter("@isouttime", SqlDbType.SmallDateTime), new SqlParameter("@EquipmentId", SqlDbType.NVarChar, 500) };
            commandParameters[0].Value  = model.orid;
            commandParameters[1].Value  = model.orcode;
            commandParameters[2].Value  = model.procode;
            commandParameters[3].Value  = model.tcode;
            commandParameters[4].Value  = model.flowstate;
            commandParameters[5].Value  = model.isout;
            commandParameters[6].Value  = model.person;
            commandParameters[7].Value  = model.intime;
            commandParameters[8].Value  = model.annx;
            commandParameters[9].Value  = model.explain;
            commandParameters[10].Value = model.PickingPeople;
            commandParameters[11].Value = model.PickingSector;
            commandParameters[12].Value = model.IsOutTime;
            if (!string.IsNullOrEmpty(model.EquipmentId))
            {
                commandParameters[13].Value = model.EquipmentId;
            }
            else
            {
                commandParameters[13].Value = DBNull.Value;
            }
            if (trans == null)
            {
                return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
            }
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }
예제 #9
0
    private void save(string type)
    {
        int       ii        = 0;
        DataTable dataTable = (DataTable)this.ViewState["DataTable"];

        foreach (DataRow dr in dataTable.Rows)
        {
            if (Convert.ToDouble(dr["number"].ToString()) > Convert.ToDouble(dr["snumber"].ToString()))
            {
                ii = 1;
                break;
            }
            if (Convert.ToDouble(dr["number"].ToString()) < 0)
            {
                ii = 2;
                break;
            }
        }
        if (ii == 1)
        {
            if (type == "pc")
            {
                base.RegisterScript("top.ui.show('出库数量超过了库存数量!');");
            }
            else
            {
                base.RegisterScript("alert('出库数量超过了库存数量!');");
            }
        }
        else if (ii == 2)
        {
            if (type == "pc")
            {
                base.RegisterScript("top.ui.show('出库数量不能小于零!');");
            }
            else
            {
                base.RegisterScript("alert('出库数量不能小于零!');");
            }
        }
        else
        {
            using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
            {
                sqlConnection.Open();
                SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
                try
                {
                    OutReserveModel outReserveModel = new OutReserveModel();
                    outReserveModel.annx          = "";
                    outReserveModel.explain       = this.txtExplain.Text;
                    outReserveModel.flowstate     = Convert.ToInt32(this.hdflowstate.Value);
                    outReserveModel.intime        = Convert.ToDateTime(this.txtInTime.Text);
                    outReserveModel.isout         = false;
                    outReserveModel.orcode        = this.txtPPCode.Text;
                    outReserveModel.orid          = this.hdGuid.Value;
                    outReserveModel.person        = this.txtPeople.Value;
                    outReserveModel.procode       = this.prjId;
                    outReserveModel.tcode         = this.hfldTrea.Value;
                    outReserveModel.PickingSector = this.txtPickingSector.Text;
                    outReserveModel.PickingPeople = this.txtPickingPeople.Text;
                    outReserveModel.EquipmentId   = this.hfldEquId.Value;
                    int num;
                    if (base.Request.QueryString["id"] != null)
                    {
                        num = this.outReserveBll.Update(sqlTransaction, outReserveModel);
                    }
                    else
                    {
                        num = this.outReserveBll.Add(sqlTransaction, outReserveModel);
                    }
                    if (num != 0)
                    {
                        this.outStockBll.DeleteByWhere(sqlTransaction, " where orcode='" + outReserveModel.orcode + "'");
                        this.UpdateDataSource();
                        //DataTable dataTable = (DataTable)this.ViewState["DataTable"];
                        if (dataTable != null)
                        {
                            foreach (DataRow dataRow in dataTable.Rows)
                            {
                                //OutStockModel outStockModel = new OutStockModel();
                                //outStockModel.corp = dataRow["CorpId"].ToString();
                                decimal dc = this.GetNumByOrsid(dataRow["scode"].ToString(), dataRow["sprice"].ToString(), dataRow["corpId"].ToString());
                                //outStockModel.number = dc;
                                //outStockModel.orcode = this.txtPPCode.Text;
                                //outStockModel.orsid = Guid.NewGuid().ToString();
                                //outStockModel.scode = dataRow["scode"].ToString();
                                //outStockModel.sprice = Convert.ToDecimal(dataRow["sprice"]);
                                //outStockModel.TaskId = dataRow["TaskId"].ToString();

                                //


                                string strSQL = string.Format(@"insert into Sm_out_Stock (orsid,orcode,scode,sprice,number,corp,TaskId,wpcode) values (
                                                    '{0}','{1}','{2}',{3},{4},'{5}','{6}','{7}')", Guid.NewGuid().ToString(), this.txtPPCode.Text, dataRow["scode"].ToString(),
                                                              Convert.ToDecimal(dataRow["sprice"]), dc, dataRow["CorpId"].ToString(), dataRow["TaskId"].ToString(), dataRow["wpcode"].ToString());
                                //publicDbOpClass.ExecSqlString(strSQL);
                                //try
                                //{
                                SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSQL);
                                //sqlTransaction.Commit();
                                // base.RegisterScript("top.ui.tabSuccess({parentName:'_Task'});");
                                //}
                                //catch
                                //{
                                //    sqlTransaction.Rollback();
                                //    //base.RegisterScript("alert('系统提示:\\n\\保存失败!');");
                                //}

                                //string strSql = "UPDATE Sm_Wantplan_Stock set outNums = ("+ dc + " + outNums)  where wpcode = '"+ dataRow["wpcode"].ToString() + "' and scode = '" + dataRow["scode"].ToString() + "'";
                                // publicDbOpClass.ExecSqlString(strSql);
                                //this.outStockBll.Add(sqlTransaction, outStockModel);
                            }
                        }
                    }
                    sqlTransaction.Commit();
                    StringBuilder stringBuilder = new StringBuilder();
                    if (type == "pc")
                    {
                        stringBuilder.Append("top.ui.show('" + this.SetMsg() + "成功!');").Append(Environment.NewLine);
                        if (base.Request["ifXQ"].ToString() == "byXQ")
                        {
                            stringBuilder.Append("winclose('AddReserve','SmOutReserveListByXQ.aspx?prjGuid=" + this.prjId + "',true)");
                        }
                        else
                        {
                            stringBuilder.Append("winclose('AddReserve','SmOutReserveList.aspx?prjGuid=" + this.prjId + "',true)");
                        }
                    }
                    else
                    {
                        stringBuilder.Append("alert('添加成功');");
                        stringBuilder.Append("parent.location.reload();");
                    }
                    base.RegisterScript(stringBuilder.ToString());
                }
                catch (Exception ex)
                {
                    sqlTransaction.Rollback();
                    if (type == "pc")
                    {
                        base.RegisterScript("top.ui.show('" + this.SetMsg() + "失败!');");
                    }
                    else
                    {
                        base.RegisterScript("alert('系统提示:\\n\\n添加失败!');");
                    }
                }
            }
        }
    }
예제 #10
0
 public void InitPage()
 {
     if (base.Request.QueryString["t"] != null)
     {
         this.btnDel.Enabled        = false;
         this.btnSave.Enabled       = false;
         this.btnSelectByd.Disabled = true;
     }
     if (base.Request.QueryString["id"] != null)
     {
         this.lblTitle.Text = "编辑出库单";
         OutReserveModel model = this.outReserveBll.GetModel(base.Request.QueryString["id"]);
         this.hdTsid.Value          = "1";
         this.txtExplain.Text       = model.explain;
         this.txtInTime.Text        = model.intime.ToString();
         this.txtPeople.Value       = model.person;
         this.txtPPCode.Text        = model.orcode;
         this.txtPickingPeople.Text = model.PickingPeople;
         this.txtPickingSector.Text = model.PickingSector;
         this.txtProjectName.Value  = this.pTPrjInfoBll.GetModelByPrjGuid(model.procode).PrjName;
         this.hdGuid.Value          = model.orid;
         this.hdflowstate.Value     = model.flowstate.ToString();
         this.hfldTrea.Value        = model.tcode;
         this.txtTrea.Text          = this.treasury.GetModel(model.tcode).tname;
         string equipmentId = model.EquipmentId;
         if (!string.IsNullOrEmpty(equipmentId))
         {
             this.hfldEquId.Value = equipmentId;
             EquEquipmentService equEquipmentService = new EquEquipmentService();
             EquEquipment        byId = equEquipmentService.GetById(equipmentId);
             if (byId != null)
             {
                 this.txtEquCode.Text = byId.EquCode;
             }
         }
         List <OutStockModel> listArray = this.outStockBll.GetListArray(" where orcode='" + model.orcode + "'");
         string text = "";
         foreach (OutStockModel current in listArray)
         {
             text = text + "'" + current.scode + "',";
         }
         if (text != "")
         {
             text = text.Substring(0, text.Length - 1);
         }
         this.ViewState["DataTable"] = this.outStockBll.GetTableByOrcode(model.orcode, model.tcode);
         this.BindGv();
     }
     else
     {
         this.lblTitle.Text          = "新增出库单";
         this.txtProjectName.Value   = this.pTPrjInfoBll.GetModelByPrjGuid(this.prjId).PrjName;
         this.txtPPCode.Text         = DateTime.Now.ToString("yyyyMMddHHmmss");
         this.txtInTime.Text         = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         this.hdGuid.Value           = Guid.NewGuid().ToString();
         this.txtPeople.Value        = PageHelper.QueryUser(this, base.UserCode);
         this.ViewState["DataTable"] = this.outStockBll.GetTableByOrcode("''", "");
         this.BindGv();
     }
     this.FileLink1.MID  = 1804;
     this.FileLink1.FID  = this.hdGuid.Value;
     this.FileLink1.Type = 1;
 }
예제 #11
0
 public int Update(SqlTransaction trans, OutReserveModel model)
 {
     return(this.outReserve.Update(trans, model));
 }
예제 #12
0
 public int Add(SqlTransaction trans, OutReserveModel model)
 {
     return(this.outReserve.Add(trans, model));
 }
예제 #13
0
    public void InitPage()
    {
        OutReserveModel model = null;

        if (base.Request.QueryString["id"] != null && base.Request.QueryString["ic"] == null)
        {
            model = this.outReserveBll.GetModel(base.Request.QueryString["id"]);
        }
        else
        {
            if (base.Request.QueryString["ic"] != null)
            {
                model = this.outReserveBll.GetModelByIc(base.Request.QueryString["ic"]);
            }
        }

        this.lblExplain.Text       = model.explain;
        this.lblInTime.Text        = Common2.GetTime(model.intime.ToString());
        this.lblPeople.Text        = model.person;
        this.lblPPCode.Text        = model.orcode;
        this.lblPickingPeople.Text = model.PickingPeople;
        PTdbmService source = new PTdbmService();
        PTdbm        pTdbm  = (
            from dbm in source
            where dbm.V_bmbm == model.PickingSector && dbm.C_sfyx == "y"
            select dbm).FirstOrDefault <PTdbm>();

        if (pTdbm != null)
        {
            this.lblPickingSector.Text = pTdbm.V_BMMC;
        }
        else
        {
            this.lblPickingSector.Text = model.PickingSector;
        }
        PrjInfoModel modelByPrjGuid = this.pTPrjInfoBll.GetModelByPrjGuid(model.procode);

        if (modelByPrjGuid != null)
        {
            this.lblProjectName.Text = modelByPrjGuid.PrjName;
        }
        else
        {
            DataTable tableByPrjGuid = this.pTPrjInfoBll.GetTableByPrjGuid(model.procode);
            if (tableByPrjGuid.Rows.Count > 0)
            {
                this.lblProjectName.Text = tableByPrjGuid.Rows[0]["prjName"].ToString().Trim();
            }
        }
        this.lblBllProducer.Text  = model.person;
        this.lblPrintDate.Text    = DateTime.Now.ToShortDateString();
        this.hdnProjectCode.Value = model.procode;
        this.hdGuid.Value         = model.orid;
        this.hdImg.Value          = model.writeName;

        this.hdflowstate.Value    = model.flowstate.ToString();
        this.lblTerasuryName.Text = this.treasury.GetModel(model.tcode).tname;
        string equipmentId = model.EquipmentId;

        if (!string.IsNullOrEmpty(equipmentId))
        {
            EquEquipmentService equEquipmentService = new EquEquipmentService();
            EquEquipment        byId = equEquipmentService.GetById(equipmentId);
            if (byId != null)
            {
                this.lblEquCode.Text = byId.EquCode;
            }
        }
        List <OutStockModel> listArray = this.outStockBll.GetListArray(" where orcode='" + model.orcode + "'");
        string text = "";

        foreach (OutStockModel current in listArray)
        {
            text = text + "'" + current.scode + "',";
        }
        if (text != "")
        {
            text = text.Substring(0, text.Length - 1);
        }
        this.ViewState["DataTable"] = this.outStockBll.GetTableByOrcode(model.orcode, model.tcode);
        this.BindGv();
        this.FileLink1.MID  = 1804;
        this.FileLink1.FID  = this.hdGuid.Value;
        this.FileLink1.Type = 1;
    }
예제 #14
0
    private void save(string v)
    {
        string strImg = dataUrl.Value.ToString();

        using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
        {
            sqlConnection.Open();
            SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
            try
            {
                foreach (GridViewRow gridViewRow in this.gvOutReserve.Rows)
                {
                    CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox;
                    if (checkBox != null && checkBox.Checked)
                    {
                        List <OutStockModel> listArray = this.outStockBll.GetListArray(" where orcode='" + checkBox.ToolTip + "'");
                        OutReserveModel      model     = this.outReserveBll.GetModel(checkBox.ToolTip);
                        foreach (OutStockModel current in listArray)
                        {
                            List <TreasuryStockModel> listArray2 = this.treasuryStockBll.GetListArray(string.Concat(new object[]
                            {
                                " where scode='",
                                current.scode,
                                "' and sprice=",
                                current.sprice,
                                " and corp='",
                                current.corp,
                                "' and tcode='",
                                model.tcode,
                                "'  order by intime asc"
                            }));
                            decimal num = 0m;
                            foreach (TreasuryStockModel current2 in listArray2)
                            {
                                num += current2.snumber;
                            }
                            if (current.number > num)
                            {
                                base.RegisterScript("alert('库存量不足!!')");
                                //base.RegisterScript("location='QOutReserve.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
                                if (v == "wx")
                                {
                                    base.RegisterScript("location='QOutReserveWX.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
                                }
                                if (v == "pc")
                                {
                                    base.RegisterScript("location='QOutReserve.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
                                }
                                return;
                            }
                            foreach (TreasuryStockModel current3 in listArray2)
                            {
                                if (current3.snumber >= current.number)
                                {
                                    current3.snumber -= current.number;
                                    if (current3.snumber == 0m)
                                    {
                                        this.treasuryStockBll.Delete(current3.tsid);
                                    }
                                    else
                                    {
                                        this.treasuryStockBll.Update(current3);
                                    }
                                    Common2.AlarmMethod(current3.tcode, current3.scode);
                                    break;
                                }
                                if (current3.snumber < current.number)
                                {
                                    current.number -= current3.snumber;
                                    this.treasuryStockBll.Delete(current3.tsid);
                                }
                            }
                        }
                        OutReserveModel model2 = this.outReserveBll.GetModel(checkBox.ToolTip);
                        model2.isout     = true;
                        model2.IsOutTime = DateTime.Now;
                        model2.writeName = strImg;
                        int num2 = this.outReserveBll.Update(null, model2);
                        if (num2 > 0)
                        {
                            base.RegisterScript("alert('系统提示:\\n\\n操作成功');");
                        }
                        else
                        {
                            base.RegisterScript("alert('系统提示:\\n\\n操作失败');");
                        }
                    }
                }
            }
            catch (Exception)
            {
                sqlTransaction.Rollback();
                base.RegisterScript("alert('系统提示:\\n\\n出库出现异常,出库失败!');");
            }
        }
        if (v == "wx")
        {
            base.RegisterScript("location='QOutReserveWX.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
        }
        if (v == "pc")
        {
            base.RegisterScript("location='QOutReserve.aspx?prjGuid=" + base.Request["prjGuid"].ToString() + "'");
        }
    }