Esempio n. 1
0
 private void btnCreateWorkOrder_Click(object sender, EventArgs e)
 {   // 작업지시 생성
     if (!string.IsNullOrEmpty(lblGvCode.Text))
     {
         DateTime          now     = DateTime.Now;
         WorkOrder_Service service = new WorkOrder_Service();
         WorkOrderNewVO    item    = new WorkOrderNewVO();
         item.Ins_Emp   = GlobalUsage.UserID;
         item.Item_Code = txtItemSearch.CodeText;
         item.Mat_LotNo = "MAT" + now.ToString("yyyyMMddHHmmss");
         item.Plan_Qty  = Convert.ToInt32(txtPlanQty.TextBoxText);
         item.Plan_Unit = lblUnit.Text;
         item.Wo_Req_No = lblReqNo.Text;
         item.Req_Seq   = Convert.ToInt32(lblReqSeq.Text);
         item.Wc_Code   = GlobalUsage.WcCode;
         item.Wo_Order  = "4";
         item.Wo_Status = "생산대기";
         item.Prd_Unit  = lblUnit.Text;
         if (service.InsertWorkOrder(item, Convert.ToInt64(lblHistSeq.Text), lblWorkorderno.Text, lblGvCode.Text, Convert.ToInt32(lblStatusSeq.Text)))
         {
             Program.Log.WriteInfo($"{GlobalUsage.UserID}이(가) 생산지시({lblReqNo.Text})에 관한 작업장({GlobalUsage.WcCode})의 작업지시를 {now.ToString("yyyy-MM-dd HH:mm:ss")}에 생성하였음");
             this.Close();
         }
         else
         {
             Program.Log.WriteInfo($"{GlobalUsage.UserID}이(가) 생산지시({lblReqNo.Text})에 관한 작업장({GlobalUsage.WcCode})의 작업지시를 {now.ToString("yyyy-MM-dd HH:mm:ss")}에 생성하려했으나 실패하였음");
             MessageBox.Show("작업지시 생성에 실패하였습니다.");
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 작업지시등록
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool InsertWorkOrder(WorkOrderNewVO item, long?histcode = null, string fromworkorderno = null, string gvcode = null, int?statusseq = null)
        {
            using (SqlCommand comm = new SqlCommand())
            {
                comm.Connection  = new SqlConnection(Connstr);
                comm.CommandText = "InsertWorkOrder";
                comm.CommandType = CommandType.StoredProcedure;

                comm.Parameters.AddWithValue("@WokrOrderNo", "WK" + DateTime.Now.ToString("yyMMddHHmmss"));
                comm.Parameters.AddWithValue("@Item_Code", item.Item_Code);
                comm.Parameters.AddWithValue("@Wc_Code", item.Wc_Code);
                comm.Parameters.AddWithValue("@Plan_Qty", item.Plan_Qty);
                comm.Parameters.AddWithValue("@Plan_Unit", item.Plan_Unit);
                comm.Parameters.AddWithValue("@Wo_Status", item.Wo_Status);
                comm.Parameters.AddWithValue("@Wo_Order", item.Wo_Order);
                comm.Parameters.AddWithValue("@Wo_Req_No", item.Wo_Req_No);
                comm.Parameters.AddWithValue("@Req_Seq", item.Req_Seq);
                comm.Parameters.AddWithValue("@Mat_LotNo", item.Mat_LotNo);
                comm.Parameters.AddWithValue("@Ins_Emp", item.Ins_Emp);
                comm.Parameters.AddWithValue("@Prd_Unit", item.Prd_Unit);
                comm.Parameters.AddWithValue("@histSeq", histcode);
                comm.Parameters.AddWithValue("@fromworkorderno", fromworkorderno);
                comm.Parameters.AddWithValue("@fromgvcode", gvcode);
                comm.Parameters.AddWithValue("@statusseq", statusseq);

                comm.Connection.Open();
                int result = comm.ExecuteNonQuery();
                comm.Connection.Close();
                if (result <= 0)
                {
                    Log.WriteFatal($"{item.Ins_Emp}이(가) 작업지시를 생성하다 DB오류남");
                }

                return(result > 1);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 작업지시등록
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool InsertWorkOrder(WorkOrderNewVO item, long?histcode = null, string fromworkorderno = null, string gvcode = null, int?statusseq = null)
        {
            WorkOrderDAC dac = new WorkOrderDAC();

            return(dac.InsertWorkOrder(item, histcode, fromworkorderno, gvcode, statusseq));
        }