コード例 #1
0
        /// <summary>
        /// 新增班次內工程消數、糾數記錄
        /// </summary>
        /// <param name="model">model</param>
        /// <param name="tran">SqlTransaction</param>
        /// <returns></returns>
        public bool AddProjectCorrectRecord(ProjectCorrectRecord model, SqlTransaction tran)
        {
            try
            {
                MappingHelper.HandleNullProperty(model);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into CorrectRecord_ctr(");
                strSql.Append("ctr_RecordID,ctr_SPLID,ctr_PPJID,ctr_cType,ctr_cReasonID,ctr_cReason,ctr_iProdQTY,ctr_iAdjustProdQTY,ctr_lSync,ctr_dAddDate,ctr_dLastDate,ctr_cAddUser)");
                strSql.Append(" values (");
                strSql.Append("@ctr_RecordID,@ctr_SPLID,@ctr_PPJID,@ctr_cType,@ctr_cReasonID,@ctr_cReason,@ctr_iProdQTY,@ctr_iAdjustProdQTY,@ctr_lSync,@ctr_dAddDate,@ctr_dLastDate,@ctr_cAddUser)");
                SqlParameter[] parameters = {
                    DbHelperSQL.MakeInParam("@ctr_RecordID", SqlDbType.UniqueIdentifier,16, model.RecordID),
                    DbHelperSQL.MakeInParam("@ctr_SPLID", SqlDbType.UniqueIdentifier,16, model.ctr_SPLID),
                    DbHelperSQL.MakeInParam("@ctr_PPJID", SqlDbType.UniqueIdentifier,16, model.ctr_PPJID),
                    DbHelperSQL.MakeInParam("@ctr_cType", SqlDbType.NVarChar,20, model.ctr_cType),
                    DbHelperSQL.MakeInParam("@ctr_cReasonID", SqlDbType.NVarChar,10, model.ctr_cReasonID),
                    DbHelperSQL.MakeInParam("@ctr_cReason", SqlDbType.NVarChar,200, model.ctr_cReason),
                    DbHelperSQL.MakeInParam("@ctr_iProdQTY", SqlDbType.Int,4, model.ctr_iProdQTY),
                    DbHelperSQL.MakeInParam("@ctr_iAdjustProdQTY", SqlDbType.Int,4, model.ctr_iAdjustProdQTY),
                    DbHelperSQL.MakeInParam("@ctr_lSync", SqlDbType.Bit,1, 0),// model.ctr_lSync;
                    DbHelperSQL.MakeInParam("@ctr_dAddDate", SqlDbType.DateTime, 0, model.AddDate),
                    DbHelperSQL.MakeInParam("@ctr_dLastDate", SqlDbType.DateTime, 0, model.LastDate),
                    DbHelperSQL.MakeInParam("@ctr_cAddUser", SqlDbType.NVarChar,30, model.AddUser)
                                            };

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

                return true;
            }
            catch (Exception ex) { throw ex; }
        }
コード例 #2
0
        /// <summary>
        /// 糾數
        /// </summary>
        /// <param name="correctRecord"></param>
        public override void CorrectProductionQty(ProjectCorrectRecord correctRecord)
        {
            if (correctRecord != null)
            {
                if (this.ProductionData != null && this.ProductionData.ShiftProjectData != null)
                {
                    //統計糾數數量
                    int correctQty = CountProjectCorrect();

                    correctRecord.ctr_iProdQTY = this.ProductionData.ShiftProjectData.spl_iCalQTY + correctQty;
                    correctRecord.ctr_iAdjustProdQTY = correctRecord.ctr_iProdQTY + correctRecord.ctr_iAdjustProdQTY;//“調整后生產數量”屬性在糾數界面被臨時賦為“修正數量”的值,
                    correctRecord.ctr_cType = CustEnum.KEY2.CORRECTQTY.ToString().Trim();
                    correctRecord.ctr_PPJID = this.ProductionData.ProjectMachineProductionID;
                    correctRecord.ctr_SPLID = this.ProductionData.ShiftProjectID;
                    correctRecord.RecordID = Guid.NewGuid();
                    correctRecord.AddDate = DateTime.Now;
                    correctRecord.LastDate = DateTime.Now;

                    this.ProductionData.ShiftProjectData.CorrectRecords.Add(correctRecord);

                    this.OnProductionChanged(null);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 消數
        /// </summary>
        /// <param name="correctRecord"></param>
        public override void ClearProductionQty(ProjectCorrectRecord correctRecord)
        {
            if (correctRecord != null)
            {
                if (this.ProductionData != null && this.ProductionData.ShiftProjectData != null)
                {
                    //統計糾數數量
                    int correctQty = CountProjectCorrect();

                    correctRecord.ctr_iProdQTY = this.ProductionData.ShiftProjectData.spl_iCalQTY + correctQty;
                    correctRecord.ctr_cType = CustEnum.KEY2.CLEARQTY.ToString().Trim();
                    correctRecord.ctr_iAdjustProdQTY = 0;
                    correctRecord.ctr_PPJID = this.ProductionData.ProjectMachineProductionID;
                    correctRecord.ctr_SPLID = this.ProductionData.ShiftProjectID;
                    correctRecord.RecordID = Guid.NewGuid();
                    correctRecord.AddDate = DateTime.Now;
                    correctRecord.LastDate = DateTime.Now;

                    this.ProductionData.ShiftProjectData.spl_iPLCQTY = 0;//spl_iCalQTY

                    this.ProductionData.ShiftProjectData.CorrectRecords.Add(correctRecord);
                    this.ProductionData.ShiftProjectData.CorrectRecords.RemoveAll(t => t.ctr_cType.Trim() == CustEnum.KEY2.CORRECTQTY.ToString().Trim());

                    this.OnProductionChanged(null);
                }
            }
        }
コード例 #4
0
ファイル: CorrectQty.cs プロジェクト: Klutzdon/PBIMSN
 void OnCorrectProductionQty(ProjectCorrectRecord correctRecord)
 {
     if (this.CorrectProductionQtyEvent != null)
     {
         EventBaseInfo<ProjectCorrectRecord> info = new EventBaseInfo<ProjectCorrectRecord>();
         info.ObjectInformation = correctRecord;
         this.CorrectProductionQtyEvent(this, info);
     }
 }
コード例 #5
0
ファイル: CorrectQty.cs プロジェクト: Klutzdon/PBIMSN
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (clbReason.CheckedItems.Count == 0)
                {
                    ShowInformationMessage("請選擇糾數原因。");
                    return;
                }

                BaseModel reason = clbReason.SelectedItem as BaseModel;
                if (reason != null)
                {
                    ProjectCorrectRecord correctRecord = new ProjectCorrectRecord();
                    correctRecord.ctr_iAdjustProdQTY = 0;
                    correctRecord.ctr_cReasonID = reason.Code;
                    correctRecord.ctr_cReason = reason.Description;

                    if (this.txtCorrectQTY.Value == 0)
                    {
                        ShowInformationMessage("糾數數量不能為零,請檢查。");
                        return;
                    }
                    else if (this.txtCorrectQTY.Value > 0)
                    {
                        FrmSuperUser loginForm = new FrmSuperUser();

                        loginForm.FunctionCode = CommonDefine.SystemFunctionCodeDifine.CorrectQty;

                        DialogResult dr= loginForm.ShowDialog();

                        correctRecord.AddUser=loginForm.LoginName;

                        if (dr == DialogResult.Yes)
                        {
                            correctRecord.ctr_iAdjustProdQTY = this.txtCorrectQTY.Value;
                            this.OnCorrectProductionQty(correctRecord);
                        }
                    }
                    else
                    {
                        correctRecord.ctr_iAdjustProdQTY = this.txtCorrectQTY.Value;
                        this.OnCorrectProductionQty(correctRecord);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
                //throw;
            }

            this.Close();
        }
コード例 #6
0
ファイル: ClearProjectQty.cs プロジェクト: Klutzdon/PBIMSN
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (clbReason.CheckedItems.Count == 0)
            {
                ShowInformationMessage("請選擇消數原因。");
                return;
            }

            BaseModel reason = clbReason.SelectedItem as BaseModel;
            if(reason!=null)
            {
                ProjectCorrectRecord correctRecord = new ProjectCorrectRecord();
                correctRecord.ctr_iAdjustProdQTY = 0;
                correctRecord.ctr_cReasonID = reason.Code;
                correctRecord.ctr_cReason = reason.Description;

                this.OnClearProductionQty(correctRecord);
            }

            this.Close();
        }