Esempio n. 1
0
        /// <summary>
        /// 增加準備項
        /// </summary>
        /// <param name="prepareItemID">準備項ID</param>
        public override void AddPrepareItem(string prepareItemID)
        {
            if (this.ProjectProductionInfo == null || this.PrepareItems==null)
            {
                return;
            }

            ProjectBaseItemModel baseData = this.PrepareItems.SingleOrDefault(t => t.Code.Trim() == prepareItemID.Trim());

            if (baseData == null)
            {
                return;
            }

            ProjectPrepareJobItem jobItem = new ProjectPrepareJobItem();
            jobItem.RecordID = Guid.NewGuid();
            jobItem.PPJID = this.ProjectProductionInfo.ProjectMachineProductionID;
            jobItem.ppji_PPMID = new Guid(prepareItemID);

            if (!baseData.IsParallelable)
            {
                jobItem.PredictPrepairTime = (int)baseData.PredictedTime;
            }

            jobItem.ItemName = baseData.Description;
            jobItem.RecordEditStatus = 1;

            if (this.ProjectProductionInfo.PrepareJobItems == null)
            {
                this.ProjectProductionInfo.PrepareJobItems = new List<ProjectPrepareJobItem>();
            }

            this.ProjectProductionInfo.PrepareJobItems.Add(jobItem);

            this.OnProductionChanged(jobItem);
        }
Esempio n. 2
0
        /// <summary>
        /// 新增準備工作項資料
        /// </summary>
        /// <param name="model">model</param>
        /// <param name="tran">SqlTransaction</param>
        /// <returns></returns>
        public bool AddProjectPrepareJobItem(ProjectPrepareJobItem model, SqlTransaction tran)
        {
            try
            {
                MappingHelper.HandleNullProperty(model);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into ProjectPreJobItem_ppji(");
                strSql.Append("ppji_RecordID,ppji_PPJID,ppji_PPMID,ppji_dAddDate,ppji_dLastDate,ppji_lSync)");
                strSql.Append(" values (");
                strSql.Append("@ppji_RecordID,@ppji_PPJID,@ppji_PPMID,@ppji_dAddDate,@ppji_dLastDate,@ppji_lSync)");
                SqlParameter[] parameters = {
                    DbHelperSQL.MakeInParam("@ppji_RecordID", SqlDbType.UniqueIdentifier,16, model.RecordID),
                    DbHelperSQL.MakeInParam("@ppji_PPJID", SqlDbType.UniqueIdentifier,16, model.PPJID),
                    DbHelperSQL.MakeInParam("@ppji_PPMID", SqlDbType.UniqueIdentifier,16, model.ppji_PPMID),
                    DbHelperSQL.MakeInParam("@ppji_dAddDate", SqlDbType.DateTime, 0, DateTime.Now),
                    DbHelperSQL.MakeInParam("@ppji_dLastDate", SqlDbType.DateTime, 0, DateTime.Now),
                    DbHelperSQL.MakeInParam("@ppji_lSync", SqlDbType.Bit,1,0)};//model.ppji_lSync;

                DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, strSql.ToString(), parameters);

                return true;
            }
            catch (Exception ex) { throw ex; }
        }