public void AddWorkDetails(WorkOrderDetails workOrderDetails)
 {
     using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["OrderDBConnection"].ConnectionString))
     {
         var formParams = new DynamicParameters();
         formParams.Add("@distributorNumber", workOrderDetails.DistributorNumber);
         formParams.Add("@workOrderNumber", workOrderDetails.WorkOrderNumber);
         var result = db.Execute("AddWorkOrderDetails", formParams, commandType: CommandType.StoredProcedure);
     }
 }
Пример #2
0
        public WorkOrderDetails GetWorkOrder(int id)
        {
            var workOrderView        = DbContext.vw_workOrder_description.First(a => a.uniqueId == id);
            var projectDescriptionId = workOrderView.idProjectDescription;
            var workOrder            = new WorkOrderDetails
            {
                WorkOrderDescription = workOrderView,
                Domains              = DbContext.Domains.Where(i => i.idProjectDescription == projectDescriptionId).ToList(),
                EffectedUrls         = DbContext.EffectedURLs.Where(i => i.idProjectDescription == projectDescriptionId).ToList(),
                ThirdPartyCredential = DbContext.ThirdPartyCredentials.Where(i => i.idProjectDescription == projectDescriptionId).ToList(),
                Assets = DbContext.vw_assets_project.Where(i => i.idProjectDescription == projectDescriptionId).ToList()
            };

            return(workOrder);
        }
Пример #3
0
    protected bool SaveToDB(string path, string tablename)
    {
        try
        {
            DataTable dt = ExcelManage.InputFromExcel(path, tablename);
            if (dt != null && dt.Rows.Count > 0)
            {
                WsSystem wbi = new WsSystem();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                    {
                        WorkOrderDetails bb = new WorkOrderDetails();
                        bb.WO               = wbi.GetWorkOrderCode();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString();
                        bb.OrderNumber      = dt.Rows[i][0].ToString();
                        bb.PartsdrawingCode = dt.Rows[i][1].ToString();
                        bb.MachineType      = dt.Rows[i][2].ToString();
                        bb.MachineName      = dt.Rows[i][3].ToString();
                        bb.ProductName      = dt.Rows[i][4].ToString();
                        bb.StartTime        = Convert.ToDateTime(dt.Rows[i][5].ToString());
                        bb.EndTime          = Convert.ToDateTime(dt.Rows[i][6].ToString());
                        bb.BatchNumber      = dt.Rows[i][7].ToString();
                        bb.PlanQuantity     = Convert.ToDecimal(dt.Rows[i][8].ToString());
                        bb.CheckTime        = Convert.ToDateTime(dt.Rows[i][9].ToString());
                        bb.InstockTime      = Convert.ToDateTime(dt.Rows[i][10].ToString());

                        string res = wbi.SaveWorkOrderInfo(bb);
                        if (res != "OK")
                        {
                            Label1.Text = res;
                            return(false);
                        }
                    }
                }
                return(true);
            }
            else
            {
                Label1.Text = "上传完毕,但数据为空,保存失败";
            }
            return(true);
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
            return(false);
        }
    }
Пример #4
0
        public void UpdateWorkOrderDescription(WorkOrderDetails workOrderDetails)
        {
            if (workOrderDetails == null)
            {
                return;
            }
            var workOrder = new WorkOrder
            {
                uniqueId              = workOrderDetails.WorkOrderDescription.uniqueId, // cannot change
                author                = workOrderDetails.WorkOrderDescription.author,
                date                  = workOrderDetails.WorkOrderDescription.date,
                idTypeRequest         = workOrderDetails.WorkOrderDescription.idTypeRequest, // cannot change
                projectName           = workOrderDetails.WorkOrderDescription.projectName,
                referencePreviousJob  = workOrderDetails.WorkOrderDescription.referencePreviousJob,
                agencyPM              = workOrderDetails.WorkOrderDescription.agencyPM,
                agencyAccountDirector = workOrderDetails.WorkOrderDescription.agencyAccountDirector,
                brandManager          = workOrderDetails.WorkOrderDescription.brandManager,
                prodigiousPM          = workOrderDetails.WorkOrderDescription.prodigiousPM,
                secureCode            = workOrderDetails.WorkOrderDescription.secureCode,          // cannot change
                jiraParentUrl         = workOrderDetails.WorkOrderDescription.jiraParentUrl,       // not required yet
                idProjectStatus       = workOrderDetails.WorkOrderDescription.idProjectStatus,     // not required yet
                idProjectDescription  = workOrderDetails.WorkOrderDescription.idProjectDescription // cannot change
            };

            UpdateWorkOrder(workOrder);

            var idProjectDescription = workOrderDetails.WorkOrderDescription.idProjectDescription ?? 0;
            var projectDescription   = new ProjectDescription
            {
                uniqueId            = idProjectDescription, // cannot change
                projectDescription1 = workOrderDetails.WorkOrderDescription.projectDescription,
                kickOffDate         = workOrderDetails.WorkOrderDescription.kickOffDate,
                liveDate            = workOrderDetails.WorkOrderDescription.liveDate,
                targetDevice        = workOrderDetails.WorkOrderDescription.targetDevice, // not implemented yet
                platform            = workOrderDetails.WorkOrderDescription.platform,
                seoAnalytics        = workOrderDetails.WorkOrderDescription.seoAnalytics,
                additionalComments  = workOrderDetails.WorkOrderDescription.additionalComments,
                idWorkOrder         = workOrderDetails.WorkOrderDescription.uniqueId // cannot change
            };

            UpdateProjectDescription(projectDescription);
        }
Пример #5
0
        public ActionResult UpdateWorkOrderDescription(WorkOrderDetails workOrderDetails, string submitButton)
        {
            var idProjectDescription = workOrderDetails.WorkOrderDescription.idProjectDescription ?? 0;

            try
            {
                _repository.UpdateThirdPartyCredential(workOrderDetails.ThirdPartyCredential, idProjectDescription);
                _repository.UpdateEffectedUrls(workOrderDetails.EffectedUrls, idProjectDescription);
                _repository.UpdateDomains(workOrderDetails.Domains, idProjectDescription);
                _repository.UpdateWorkOrderDescription(workOrderDetails);
                _repository.UpdateAssets(workOrderDetails.Assets);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(Content("Work Order NOT Updated! " + e.Message));
            }

            return(submitButton == "ExportPdf" ? Content("Work Order Updated! Preparing PDF file to downloading...") : Content("Work Order Updated!"));
        }
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsSystem wbi = new WsSystem();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     WorkOrderDetails bb = new WorkOrderDetails();
                     bb.WO          = dt.Rows[i][0].ToString();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString();
                     bb.WorkerName  = dt.Rows[i][1].ToString();
                     bb.WORKER      = wbi.FindUserCodeByUserName(bb.WorkerName);
                     bb.StationName = dt.Rows[i][2].ToString();
                     bb.RouteCode   = dt.Rows[i][3].ToString();
                     string res = wbi.SaveWorkOrderAssign(bb);
                     if (res != "OK")
                     {
                         Label1.Text = res;
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   workorder      = Request.QueryString["workorder"];
        string   status         = Request.QueryString["status"];
        string   partsdrawingno = Request.QueryString["partsdrawingno"];
        string   order          = Request.QueryString["order"];
        string   starttime      = Request.QueryString["starttime"];
        string   endtime        = Request.QueryString["endtime"];
        DateTime dtstart        = DateTime.Today.AddDays(-100);
        DateTime dtend          = DateTime.Now;

        if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime))
        {
            dtstart = Convert.ToDateTime(starttime);
            dtend   = Convert.ToDateTime(endtime);
        }
        WorkOrderDetails wo = new WorkOrderDetails();

        wo.WO               = workorder;
        wo.STATUS           = status == "4"?"":status;
        wo.PartsdrawingCode = partsdrawingno;
        wo.OrderNumber      = order;
        wo.StartTime        = dtstart;
        wo.EndTime          = dtend;
        SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo);
        IList <WorkOrderDetails> woobjs = _bal.FindWorkOrderDetailsInfo(wo);
        WsSystem ws = new WsSystem();

        if (woobjs == null || woobjs.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("WorkOrderInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "工单单号,订单单号,零件图号,工单状态,机床类型,机床名称,负责人员,产品名称,计划开始,计划结束,批次,计划数量,产出数量,计划检验,计划入库,操作人,时间,工序,工序号";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        if (woobjs != null)
        {
            for (int i = 2; i <= woobjs.Count + 1; i++)
            {
                row  = hssfSheet.CreateRow(i);
                cell = row.CreateCell(0);
                cell.SetCellValue(woobjs[i - 2].WO);
                cell = row.CreateCell(1);
                cell.SetCellValue(woobjs[i - 2].OrderNumber);
                cell = row.CreateCell(2);
                cell.SetCellValue(woobjs[i - 2].PartsdrawingCode);
                cell = row.CreateCell(3);
                cell.SetCellValue(woobjs[i - 2].StatusMemo);
                cell = row.CreateCell(4);
                cell.SetCellValue(woobjs[i - 2].MachineType);
                cell = row.CreateCell(5);
                cell.SetCellValue(woobjs[i - 2].MachineName);
                cell = row.CreateCell(6);
                cell.SetCellValue(woobjs[i - 2].WorkerName);
                cell = row.CreateCell(7);
                cell.SetCellValue(woobjs[i - 2].ProductName);
                cell = row.CreateCell(8);
                cell.SetCellValue(woobjs[i - 2].StartTime.ToString());
                cell = row.CreateCell(9);
                cell.SetCellValue(woobjs[i - 2].EndTime.ToString());
                cell = row.CreateCell(10);
                cell.SetCellValue(woobjs[i - 2].BatchNumber);
                cell = row.CreateCell(11);
                cell.SetCellValue(woobjs[i - 2].PlanQuantity.ToString());
                cell = row.CreateCell(12);
                cell.SetCellValue(woobjs[i - 2].QUANTITY.ToString());
                cell = row.CreateCell(13);
                cell.SetCellValue(woobjs[i - 2].CheckTime.ToString());
                cell = row.CreateCell(14);
                cell.SetCellValue(woobjs[i - 2].InstockTime.ToString());
                cell = row.CreateCell(15);
                cell.SetCellValue(ws.FindUserNameByCode(woobjs[i - 2].UpdatedBy));
                cell = row.CreateCell(16);
                cell.SetCellValue(woobjs[i - 2].UpdatedDate == null ? woobjs[i - 2].CreatedDate.ToString() : woobjs[i - 2].UpdatedDate.ToString());
                cell = row.CreateCell(17);
                cell.SetCellValue(woobjs[i - 2].StationName.ToString());
                cell = row.CreateCell(18);
                cell.SetCellValue(woobjs[i - 2].RouteCode.ToString());
            }
        }

        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "WorkOrderInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }